mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-16 12:10:28 +03:00
Add ESC btn to toolbar to quickly exit formatting (#1283)
* Add ESC btn to toolbar to quickly exit formatting * add horizontal scroll to toolbar item * make editor toolbar usable in touch device * fix editor hotkeys not working in window * remove unused import
This commit is contained in:
parent
2883b4c35b
commit
bc5e7445d9
7 changed files with 210 additions and 108 deletions
|
|
@ -15,7 +15,7 @@ export const INLINE_HOTKEYS: Record<string, MarkType> = {
|
|||
const INLINE_KEYS = Object.keys(INLINE_HOTKEYS);
|
||||
|
||||
export const BLOCK_HOTKEYS: Record<string, BlockType> = {
|
||||
'mod+shift+0': BlockType.OrderedList,
|
||||
'mod+shift+7': BlockType.OrderedList,
|
||||
'mod+shift+8': BlockType.UnorderedList,
|
||||
"mod+shift+'": BlockType.BlockQuote,
|
||||
'mod+shift+;': BlockType.CodeBlock,
|
||||
|
|
@ -26,12 +26,12 @@ const BLOCK_KEYS = Object.keys(BLOCK_HOTKEYS);
|
|||
* @return boolean true if shortcut is toggled.
|
||||
*/
|
||||
export const toggleKeyboardShortcut = (editor: Editor, event: KeyboardEvent<Element>): boolean => {
|
||||
if (isHotkey('escape', event)) {
|
||||
if (isHotkey('mod+e', event)) {
|
||||
if (isAnyMarkActive(editor)) {
|
||||
removeAllMark(editor);
|
||||
return true;
|
||||
}
|
||||
console.log(isBlockActive(editor, BlockType.Paragraph));
|
||||
|
||||
if (!isBlockActive(editor, BlockType.Paragraph)) {
|
||||
toggleBlock(editor, BlockType.Paragraph);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue