onSubmit on enterkey captured

This commit is contained in:
Palanikannan1437 2023-10-02 20:10:05 +05:30
parent 2c804c8d6c
commit b479718ece
4 changed files with 22 additions and 1 deletions

View File

@ -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;
},
}
},
});

View File

@ -0,0 +1,5 @@
import { EnterKeyExtension } from "./enter-key-extension";
export const LiteTextEditorExtensions = () => [
EnterKeyExtension
];

View File

@ -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<string>;
export type DeleteImage = (assetUrlWithWorkspaceId: string) => Promise<any>;
@ -67,6 +68,7 @@ const LiteTextEditor = ({
uploadFile,
deleteFile,
forwardedRef,
extensions: LiteTextEditorExtensions(),
});
const editorClassNames = getEditorClassNames({ noBorder, borderOnFocus, customClassName });

View File

@ -3,7 +3,7 @@
"include": [
"src/**/*",
"index.d.ts"
],
, "../lite-text-editor/src/ui/extensions/enter-key-extension.tsx" ],
"exclude": [
"dist",
"build",