mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +03:00
Lexical: Table cell bg and format setting fixes
- Updated table cell background color setting to be stable by specifically using the background property over the general styles. - Updated format shorcuts to be correct header levels as per old editor and format menu. - Updated format changes to properly update UI afterwards.
This commit is contained in:
@@ -13,14 +13,16 @@ import {$showLinkForm} from "../ui/defaults/forms/objects";
|
||||
import {showLinkSelector} from "../utils/links";
|
||||
import {HeadingTagType} from "@lexical/rich-text/LexicalHeadingNode";
|
||||
|
||||
function headerHandler(editor: LexicalEditor, tag: HeadingTagType): boolean {
|
||||
toggleSelectionAsHeading(editor, tag);
|
||||
function headerHandler(context: EditorUiContext, tag: HeadingTagType): boolean {
|
||||
toggleSelectionAsHeading(context.editor, tag);
|
||||
context.manager.triggerFutureStateRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
function wrapFormatAction(formatAction: (editor: LexicalEditor) => any): ShortcutAction {
|
||||
return (editor: LexicalEditor) => {
|
||||
return (editor: LexicalEditor, context: EditorUiContext) => {
|
||||
formatAction(editor);
|
||||
context.manager.triggerFutureStateRefresh();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
@@ -45,10 +47,10 @@ const actionsByKeys: Record<string, ShortcutAction> = {
|
||||
window.$events.emit('editor-save-page');
|
||||
return true;
|
||||
},
|
||||
'meta+1': (editor) => headerHandler(editor, 'h1'),
|
||||
'meta+2': (editor) => headerHandler(editor, 'h2'),
|
||||
'meta+3': (editor) => headerHandler(editor, 'h3'),
|
||||
'meta+4': (editor) => headerHandler(editor, 'h4'),
|
||||
'meta+1': (editor, context) => headerHandler(context, 'h2'),
|
||||
'meta+2': (editor, context) => headerHandler(context, 'h3'),
|
||||
'meta+3': (editor, context) => headerHandler(context, 'h4'),
|
||||
'meta+4': (editor, context) => headerHandler(context, 'h5'),
|
||||
'meta+5': wrapFormatAction(toggleSelectionAsParagraph),
|
||||
'meta+d': wrapFormatAction(toggleSelectionAsParagraph),
|
||||
'meta+6': wrapFormatAction(toggleSelectionAsBlockquote),
|
||||
|
Reference in New Issue
Block a user