feat(editor): add hot key and update function

This commit is contained in:
2024-01-04 10:44:00 +07:00
parent f4cbcee8b4
commit fcde669685
6 changed files with 90 additions and 13 deletions

View File

@@ -28,6 +28,8 @@ export const insertImage = (editor: ReactEditor | BaseEditor, url: string) => {
url,
children: [text],
},
];
const extraText = [
{
type: "paragraph",
children: [text],
@@ -35,6 +37,7 @@ export const insertImage = (editor: ReactEditor | BaseEditor, url: string) => {
];
Transforms.insertNodes(editor, image);
Transforms.insertNodes(editor, extraText);
};
export const insertMention = (
@@ -63,6 +66,8 @@ export const insertNostrEvent = (
eventId: `nostr:${eventId}`,
children: [text],
},
];
const extraText = [
{
type: "paragraph",
children: [text],
@@ -70,4 +75,5 @@ export const insertNostrEvent = (
];
Transforms.insertNodes(editor, event);
Transforms.insertNodes(editor, extraText);
};