mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-03-04 02:37:19 +08:00
update squire to v2.3.2 and fix willPaste listener/sanitizer
This commit is contained in:
parent
8b5547104d
commit
95af4f60ea
3 changed files with 368 additions and 444 deletions
|
@ -6,7 +6,7 @@ class CompactComposerPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
NAME = 'Compact Composer',
|
NAME = 'Compact Composer',
|
||||||
AUTHOR = 'Sergey Mosin',
|
AUTHOR = 'Sergey Mosin',
|
||||||
URL = 'https://github.com/the-djmaze/snappymail/pull/1466',
|
URL = 'https://github.com/the-djmaze/snappymail/pull/1466',
|
||||||
VERSION = '1.0.5',
|
VERSION = '1.0.6',
|
||||||
RELEASE = '2024-08-08',
|
RELEASE = '2024-08-08',
|
||||||
REQUIRED = '2.34.0',
|
REQUIRED = '2.34.0',
|
||||||
LICENSE = 'AGPL v3',
|
LICENSE = 'AGPL v3',
|
||||||
|
|
|
@ -100,10 +100,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
pasteSanitizer = (event) => {
|
|
||||||
return rl.Utils.cleanHtml(event.detail.html).html;
|
|
||||||
},
|
|
||||||
|
|
||||||
pasteImageHandler = (e, squire) => {
|
pasteImageHandler = (e, squire) => {
|
||||||
|
|
||||||
const items = [...e.detail.clipboardData.items];
|
const items = [...e.detail.clipboardData.items];
|
||||||
|
@ -142,7 +138,12 @@
|
||||||
toolbar.className = 'squire-toolbar btn-toolbar';
|
toolbar.className = 'squire-toolbar btn-toolbar';
|
||||||
const actions = this.makeActions(squire, toolbar);
|
const actions = this.makeActions(squire, toolbar);
|
||||||
|
|
||||||
this.squire.addEventListener('willPaste', pasteSanitizer);
|
this.squire.addEventListener('willPaste', (event) => {
|
||||||
|
// https://github.com/fastmail/Squire?tab=readme-ov-file#addeventlistener
|
||||||
|
// The content that will be inserted is available as either the fragment property, or the text property for plain text, on the detail property of the event. You can modify this text/fragment in your event handler to change what will be pasted
|
||||||
|
tpl.innerHTML = rl.Utils.cleanHtml(event.detail.html).html;
|
||||||
|
event.detail.fragment = tpl.content;
|
||||||
|
});
|
||||||
this.squire.addEventListener('pasteImage', (e) => {
|
this.squire.addEventListener('pasteImage', (e) => {
|
||||||
pasteImageHandler(e, squire);
|
pasteImageHandler(e, squire);
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue