From 8e8a0a94eb6b62df3fc0bf89dd101e4247750997 Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Fri, 18 Nov 2022 22:58:08 +0100 Subject: [PATCH] [editor] Enable some shortcut expression for TextEditor ...but disable the list auto-generation for bullet and ordered lists. #226 #369 --- .../editor/src/app/text-editor/extensions/bullet-list.ts | 4 ++++ .../editor/src/app/text-editor/extensions/ordered-list.ts | 4 ++++ .../src/app/text-editor/rich-text-editor.component.ts | 8 ++------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/projects/editor/src/app/text-editor/extensions/bullet-list.ts b/projects/editor/src/app/text-editor/extensions/bullet-list.ts index 9f817b81d..08cf38570 100644 --- a/projects/editor/src/app/text-editor/extensions/bullet-list.ts +++ b/projects/editor/src/app/text-editor/extensions/bullet-list.ts @@ -28,5 +28,9 @@ export const BulletListExtension = BulletList.extend({ return commands.updateAttributes(this.name, { listStyle: newStyle }); } }; + }, + + addInputRules() { + return []; } }); diff --git a/projects/editor/src/app/text-editor/extensions/ordered-list.ts b/projects/editor/src/app/text-editor/extensions/ordered-list.ts index 5a1d5e121..fc46c91d5 100644 --- a/projects/editor/src/app/text-editor/extensions/ordered-list.ts +++ b/projects/editor/src/app/text-editor/extensions/ordered-list.ts @@ -39,5 +39,9 @@ export const OrderedListExtension = OrderedList.extend({ commands.updateAttributes(this.name, { fontSize: fontSize }) ) }; + }, + + addInputRules() { + return []; } }); diff --git a/projects/editor/src/app/text-editor/rich-text-editor.component.ts b/projects/editor/src/app/text-editor/rich-text-editor.component.ts index 59181bf10..3c6a1a5d9 100644 --- a/projects/editor/src/app/text-editor/rich-text-editor.component.ts +++ b/projects/editor/src/app/text-editor/rich-text-editor.component.ts @@ -84,9 +84,7 @@ export class RichTextEditorComponent implements OnInit, AfterViewInit { ]; editor: Editor = new Editor({ - extensions: this.defaultExtensions, - enablePasteRules: false, - enableInputRules: false + extensions: this.defaultExtensions }); constructor(private injector: Injector) { } @@ -100,9 +98,7 @@ export class RichTextEditorComponent implements OnInit, AfterViewInit { activeExtensions.push(ButtonComponentExtension(this.injector)); } this.editor = new Editor({ - extensions: activeExtensions, - enablePasteRules: false, - enableInputRules: false + extensions: activeExtensions }); } -- GitLab