Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update squire to v2.3.2 and fix willPaste listener/sanitizer #1845

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/compact-composer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CompactComposerPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Compact Composer',
AUTHOR = 'Sergey Mosin',
URL = 'https://github.com/the-djmaze/snappymail/pull/1466',
VERSION = '1.0.5',
VERSION = '1.0.6',
RELEASE = '2024-08-08',
REQUIRED = '2.34.0',
LICENSE = 'AGPL v3',
Expand Down
11 changes: 6 additions & 5 deletions plugins/compact-composer/js/CompactComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@
}
},

pasteSanitizer = (event) => {
return rl.Utils.cleanHtml(event.detail.html).html;
},

pasteImageHandler = (e, squire) => {

const items = [...e.detail.clipboardData.items];
Expand Down Expand Up @@ -142,7 +138,12 @@
toolbar.className = 'squire-toolbar btn-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) => {
pasteImageHandler(e, squire);
});
Expand Down
Loading
Loading