Skip to content

Commit

Permalink
移除tryCatchCallback中的editor参数,简化错误处理逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Dec 20, 2024
1 parent a7b088f commit 56c0bc3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/MarkdownEditor/editor/plugins/catchError.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Editor } from 'slate';
const tryCatchCallback =
(editorFunc: any, editor: Editor) =>
(editorFunc: any) =>
(...editorFuncArgs: any) => {
try {
return editorFunc(...editorFuncArgs);
} catch (error) {
console.error(error);
editor.undo();
// editor.undo();
}
};
export const withErrorReporting = (editor: any): Editor => {
Object.entries(editor).forEach(([key, value]) => {
if (typeof value === 'function') {
editor[key] = tryCatchCallback(value, editor);
editor[key] = tryCatchCallback(value);
}
});

Expand Down

1 comment on commit 56c0bc3

@vercel
Copy link

@vercel vercel bot commented on 56c0bc3 Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.