20 lines
875 B
JavaScript
20 lines
875 B
JavaScript
(function(){
|
|
const runtime = window.MAILCOW_PLUGIN_RUNTIME;
|
|
if (!runtime) return;
|
|
runtime.registerMount('owncloud-attach','mail.compose.toolbar','toolbar-button', async (target, context) => {
|
|
target.innerHTML = '';
|
|
const button = document.createElement('button');
|
|
button.className = 'owncloud-attach-button';
|
|
button.textContent = context.contribution.label || 'ownCloud';
|
|
button.addEventListener('click', async () => {
|
|
const panelTarget = document.querySelector('[data-plugin-target="owncloud-attach:mail.compose.attachments:attachments-panel"]');
|
|
if (panelTarget) {
|
|
panelTarget.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
panelTarget.classList.add('owncloud-flash');
|
|
setTimeout(() => panelTarget.classList.remove('owncloud-flash'), 1200);
|
|
}
|
|
});
|
|
target.appendChild(button);
|
|
});
|
|
})();
|