Skip to content

Commit d301b93

Browse files
authored
Merge pull request #1845 from SergeyMosin/compact-composer-plugin-v1.0.6
Update squire to v2.3.2 and fix willPaste listener/sanitizer
2 parents 66553a3 + 95af4f6 commit d301b93

File tree

3 files changed

+368
-444
lines changed

3 files changed

+368
-444
lines changed

plugins/compact-composer/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class CompactComposerPlugin extends \RainLoop\Plugins\AbstractPlugin
66
NAME = 'Compact Composer',
77
AUTHOR = 'Sergey Mosin',
88
URL = 'https://github.com/the-djmaze/snappymail/pull/1466',
9-
VERSION = '1.0.5',
9+
VERSION = '1.0.6',
1010
RELEASE = '2024-08-08',
1111
REQUIRED = '2.34.0',
1212
LICENSE = 'AGPL v3',

plugins/compact-composer/js/CompactComposer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@
100100
}
101101
},
102102

103-
pasteSanitizer = (event) => {
104-
return rl.Utils.cleanHtml(event.detail.html).html;
105-
},
106-
107103
pasteImageHandler = (e, squire) => {
108104

109105
const items = [...e.detail.clipboardData.items];
@@ -142,7 +138,12 @@
142138
toolbar.className = 'squire-toolbar btn-toolbar';
143139
const actions = this.makeActions(squire, toolbar);
144140

145-
this.squire.addEventListener('willPaste', pasteSanitizer);
141+
this.squire.addEventListener('willPaste', (event) => {
142+
// https://github.com/fastmail/Squire?tab=readme-ov-file#addeventlistener
143+
// 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
144+
tpl.innerHTML = rl.Utils.cleanHtml(event.detail.html).html;
145+
event.detail.fragment = tpl.content;
146+
});
146147
this.squire.addEventListener('pasteImage', (e) => {
147148
pasteImageHandler(e, squire);
148149
});

0 commit comments

Comments
 (0)