diff --git a/packages/editor/lite-text-editor/src/ui/extensions/enter-key-extension.tsx b/packages/editor/lite-text-editor/src/ui/extensions/enter-key-extension.tsx new file mode 100644 index 000000000..3d19703ec --- /dev/null +++ b/packages/editor/lite-text-editor/src/ui/extensions/enter-key-extension.tsx @@ -0,0 +1,14 @@ +import { Extension } from '@tiptap/core'; + +export const EnterKeyExtension = Extension.create({ + name: 'enterKey', + + addKeyboardShortcuts() { + return { + 'Enter': () => { + console.log('Submit comment'); + return true; + }, + } + }, +}); diff --git a/packages/editor/lite-text-editor/src/ui/extensions/index.tsx b/packages/editor/lite-text-editor/src/ui/extensions/index.tsx new file mode 100644 index 000000000..e1ef3db84 --- /dev/null +++ b/packages/editor/lite-text-editor/src/ui/extensions/index.tsx @@ -0,0 +1,5 @@ +import { EnterKeyExtension } from "./enter-key-extension"; + +export const LiteTextEditorExtensions = () => [ + EnterKeyExtension + ]; diff --git a/packages/editor/lite-text-editor/src/ui/index.tsx b/packages/editor/lite-text-editor/src/ui/index.tsx index 85321fccb..dfdee1505 100644 --- a/packages/editor/lite-text-editor/src/ui/index.tsx +++ b/packages/editor/lite-text-editor/src/ui/index.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { EditorContainer, EditorContentWrapper, getEditorClassNames, useEditor } from '@plane/editor-core'; import { FixedMenu } from './menus/fixed-menu'; +import { LiteTextEditorExtensions } from './extensions'; export type UploadImage = (file: File) => Promise; export type DeleteImage = (assetUrlWithWorkspaceId: string) => Promise; @@ -67,6 +68,7 @@ const LiteTextEditor = ({ uploadFile, deleteFile, forwardedRef, + extensions: LiteTextEditorExtensions(), }); const editorClassNames = getEditorClassNames({ noBorder, borderOnFocus, customClassName }); diff --git a/packages/editor/rich-text-editor/tsconfig.json b/packages/editor/rich-text-editor/tsconfig.json index bf38514e1..f83a493ea 100644 --- a/packages/editor/rich-text-editor/tsconfig.json +++ b/packages/editor/rich-text-editor/tsconfig.json @@ -3,7 +3,7 @@ "include": [ "src/**/*", "index.d.ts" - ], +, "../lite-text-editor/src/ui/extensions/enter-key-extension.tsx" ], "exclude": [ "dist", "build",