feat: use keyboard shortcuts to insert bullet points (#6134)
Co-authored-by: Erez Rokah <erezrokah@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
parent
6c924db10b
commit
dd149f6d04
@ -209,6 +209,14 @@ function ListPlugin({ defaultType, unorderedListType, orderedListType }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
onKeyDown(event, editor, next) {
|
onKeyDown(event, editor, next) {
|
||||||
|
// Handle space ('*' + <space>) or ('-' + <space>)
|
||||||
|
if (isHotkey('space', event)) {
|
||||||
|
if (editor.value.startBlock.text === '*' || editor.value.startBlock.text === '-') {
|
||||||
|
event.preventDefault();
|
||||||
|
return editor.wrapInList('bulleted-list').deleteBackward(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle Backspace
|
// Handle Backspace
|
||||||
if (isHotkey('backspace', event) && editor.value.selection.isCollapsed) {
|
if (isHotkey('backspace', event) && editor.value.selection.isCollapsed) {
|
||||||
// If beginning block is not of default type, do nothing
|
// If beginning block is not of default type, do nothing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user