forked from github/plane
onSubmit on enterkey captured
This commit is contained in:
parent
2c804c8d6c
commit
b479718ece
@ -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;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
@ -0,0 +1,5 @@
|
|||||||
|
import { EnterKeyExtension } from "./enter-key-extension";
|
||||||
|
|
||||||
|
export const LiteTextEditorExtensions = () => [
|
||||||
|
EnterKeyExtension
|
||||||
|
];
|
@ -2,6 +2,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { EditorContainer, EditorContentWrapper, getEditorClassNames, useEditor } from '@plane/editor-core';
|
import { EditorContainer, EditorContentWrapper, getEditorClassNames, useEditor } from '@plane/editor-core';
|
||||||
import { FixedMenu } from './menus/fixed-menu';
|
import { FixedMenu } from './menus/fixed-menu';
|
||||||
|
import { LiteTextEditorExtensions } from './extensions';
|
||||||
|
|
||||||
export type UploadImage = (file: File) => Promise<string>;
|
export type UploadImage = (file: File) => Promise<string>;
|
||||||
export type DeleteImage = (assetUrlWithWorkspaceId: string) => Promise<any>;
|
export type DeleteImage = (assetUrlWithWorkspaceId: string) => Promise<any>;
|
||||||
@ -67,6 +68,7 @@ const LiteTextEditor = ({
|
|||||||
uploadFile,
|
uploadFile,
|
||||||
deleteFile,
|
deleteFile,
|
||||||
forwardedRef,
|
forwardedRef,
|
||||||
|
extensions: LiteTextEditorExtensions(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const editorClassNames = getEditorClassNames({ noBorder, borderOnFocus, customClassName });
|
const editorClassNames = getEditorClassNames({ noBorder, borderOnFocus, customClassName });
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"src/**/*",
|
"src/**/*",
|
||||||
"index.d.ts"
|
"index.d.ts"
|
||||||
],
|
, "../lite-text-editor/src/ui/extensions/enter-key-extension.tsx" ],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"dist",
|
"dist",
|
||||||
"build",
|
"build",
|
||||||
|
Loading…
Reference in New Issue
Block a user