+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $html_editor_quote
+
+EOF
+ # Output HTML editor textarea
+ my $ts = &get_webmin_version();
+ $ts =~ s/[.-]+//g;
+ $html_editor_scripts = <
+
+
+
+ var Parchment = Quill.import('parchment');
+ // Whitelist attrs (useful on preserving)
+ const attrs_whitelist = [
+ 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left',
+ 'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left',
+ 'border', 'border-right', 'border-left',
+ 'font-size', 'font-family', 'href', 'target',
+ ]
+
+ attrs_whitelist.forEach(function(attr) {
+ Quill.register(new Parchment.Attributor.Style(attr, attr, {}));
+ });
+
+ Quill.register(qs, true);
+ Quill.register(qf, true);
+ var editor = new Quill('.ql-container', {
+ modules: {
+ formula: false,
+ syntax: false,
+ imageDrop: true,
+ imageResize: {
+ modules: [
+ 'DisplaySize',
+ 'Resize',
+ ],
+ },
+ toolbar: '.ql-toolbar',
+ },
+ bounds: '.ql-compose-container',
+ theme: 'snow'
+ });
+ // Google Mail editor like keybind for quoting
+ var isMacOS = navigator.userAgent.toLowerCase().includes('mac');
+ editor.keyboard.addBinding({
+ key: '9',
+ shiftKey: true,
+ ctrlKey: !isMacOS,
+ metaKey: isMacOS,
+ format: ['blockquote'],
+ }, function(range, context) {
+ this.quill.format('blockquote', false);
+ });
+ editor.keyboard.addBinding({
+ key: '9',
+ shiftKey: true,
+ ctrlKey: !isMacOS,
+ metaKey: isMacOS,
+ }, function(range, context) {
+ this.quill.format('blockquote', true);
+ });
+ editor.on('text-change', function() {
+ targ.value = escapeHTML_(editor.root.innerHTML + "
");
+ var quoteHTML = String(), err = false;
+ try {
+ quoteHTML = document.querySelector('#quote-mail-iframe').contentWindow.document.querySelector('.iframe_quote[contenteditable]#webmin-iframe-quote').innerHTML;
+ } catch(e) {
+ err = true;
+ }
+ if (!err) {
+ targ.value = targ.value + escapeHTML_(quoteHTML);
+ }
+ });
+ editor.pasteHTML(targ.value);
+ })();
+
EOF
}
- else {
- print '';
- }
+ $sig =~ s/\n/
\n/g,
+ $sig =~ s/^\s+//g
+ if ($sig);
print &ui_table_row(undef,
- &ui_textarea("body", $quote, 16, 80, undef, 0,
- "style='width:99%' id=body"), 2);
+ &ui_textarea("body", "$sig", 16, 80, undef, 0,
+ "style='display: none' id=body").$html_editor_template.$html_editor_scripts, 2);
}
else {
# Show text editing area