mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Add support for bullet list hotkey
This commit is contained in:
@@ -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 + "<br>";
|
||||
|
||||
Reference in New Issue
Block a user