[WEB-1689] fix: command enter submits the form (#4986)

* fix: command enter submits the form

* fix: build errors
This commit is contained in:
Aaryan Khandelwal 2024-07-01 17:00:53 +05:30 committed by GitHub
parent 936c21d65e
commit e78263e01f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 46 additions and 41 deletions

View file

@ -1,6 +1,6 @@
import { Extension } from "@tiptap/core";
export const EnterKeyExtension = (onEnterKeyPress?: () => void) =>
export const EnterKeyExtension = (onEnterKeyPress?: (descriptionHTML: string) => void) =>
Extension.create({
name: "enterKey",
@ -8,9 +8,7 @@ export const EnterKeyExtension = (onEnterKeyPress?: () => void) =>
return {
Enter: () => {
if (!this.editor.storage.mentionsOpen) {
if (onEnterKeyPress) {
onEnterKeyPress();
}
onEnterKeyPress?.(this.editor.getHTML());
return true;
}
return false;

View file

@ -38,7 +38,7 @@ export interface IEditorProps {
suggestions?: () => Promise<IMentionSuggestion[]>;
};
onChange?: (json: object, html: string) => void;
onEnterKeyPress?: (e?: any) => void;
onEnterKeyPress?: (descriptionHTML: string) => void;
placeholder?: string | ((isFocused: boolean, value: string) => string);
tabIndex?: number;
value?: string | null;