Skip to content

Commit

Permalink
fix: 更新高亮刷新逻辑,将refreshHighlight属性类型调整为number或boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Jan 30, 2025
1 parent 3a2790f commit 52e9da9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/MarkdownEditor/editor/plugins/useHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export const SetNodeToDecorations = observer(() => {
stack = [];
if (typeof window === 'undefined') return;
if (typeof window.matchMedia === 'undefined') return;
runInAction(() => (store.refreshHighlight = Date.now()));
runInAction(() => (store.refreshHighlight = !!Date.now()));
});
}
}, []);
Expand Down
11 changes: 1 addition & 10 deletions src/MarkdownEditor/editor/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class EditorStore {
openInsertLink$ = new Subject<Selection>();
openLinkPanel = false;
tableCellNode: null | NodeEntry<TableCellNode> = null;
refreshHighlight = Date.now();
refreshHighlight: number | boolean = Date.now();
domRect: DOMRect | null = null;
domRange: HTMLElement | null = null;
container: null | HTMLDivElement = null;
Expand Down Expand Up @@ -274,15 +274,6 @@ export class EditorStore {
return left;
}

doRefreshHighlight() {
setTimeout(
action(() => {
this.refreshHighlight = Date.now();
}),
60,
);
}

setState(value: (state: EditorStore) => void) {
if (value instanceof Function) {
value(this);
Expand Down

1 comment on commit 52e9da9

@vercel
Copy link

@vercel vercel bot commented on 52e9da9 Jan 30, 2025

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.