feat: modularize block system (#718)

This commit is contained in:
Jeremy 2025-01-27 14:19:47 +05:30 committed by GitHub
parent 5e8cddc886
commit 38527ff92e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 684 additions and 604 deletions

View file

@ -24,11 +24,11 @@ export function headingRule(level: number) {
export const handleTransaction = ({
transaction,
editorRef,
saveContent,
onSaveContent,
}: {
transaction: Transaction;
editorRef: MutableRefObject<EditorView | null>;
saveContent: (updatedContent: string, debounce: boolean) => void;
onSaveContent: (updatedContent: string, debounce: boolean) => void;
}) => {
if (!editorRef || !editorRef.current) return;
@ -39,9 +39,9 @@ export const handleTransaction = ({
const updatedContent = buildContentFromDocument(newState.doc);
if (transaction.getMeta('no-debounce')) {
saveContent(updatedContent, false);
onSaveContent(updatedContent, false);
} else {
saveContent(updatedContent, true);
onSaveContent(updatedContent, true);
}
}
};