diff --git a/html-editor-lib.pl b/html-editor-lib.pl index 6c00b0b6d..9abe0088e 100644 --- a/html-editor-lib.pl +++ b/html-editor-lib.pl @@ -277,24 +277,36 @@ my $html_editor_init_script = theme: 'snow' }); - // Google Mail editor like keybind for quoting + // Google Mail like key bind for creating bullet list (Ctrl+Shift+8) editor.keyboard.addBinding({ - key: '9', - shiftKey: true, - ctrlKey: !isMac, - metaKey: isMac, - format: ['blockquote'], + key: '8', + shiftKey: true, + ctrlKey: !isMac, + metaKey: isMac, }, function(range, context) { - this.quill.format('blockquote', false); + const currentFormat = this.quill.getFormat(range.index); + if (currentFormat.list === 'bullet') { + this.quill.format('list', false); + } else { + this.quill.format('list', 'bullet'); + } }); + + // Google Mail like key bind for creating blockquote (Ctrl+Shift+9) editor.keyboard.addBinding({ - key: '9', - shiftKey: true, - ctrlKey: !isMac, - metaKey: isMac, + key: '9', + shiftKey: true, + ctrlKey: !isMac, + metaKey: isMac, }, function(range, context) { - this.quill.format('blockquote', true); + const currentFormat = this.quill.getFormat(range.index); + if (currentFormat.blockquote) { + this.quill.format('blockquote', false); + } else { + this.quill.format('blockquote', true); + } }); + editor.on('text-change', function() { // This should most probably go to onSubmit event targ.value = editor.root.innerHTML + "
";