mirror of
https://github.com/fantasticit/think.git
synced 2026-10-29 19:22:38 +08:00
tiptap: keep scroll top
This commit is contained in:
@@ -53,7 +53,14 @@ export const ExcalidrawSettingModal: React.FC<IProps> = ({ editor }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME: 绘图更新后会滚动 dom 到顶点,原因未知,在此 hack 修复下!
|
||||
*/
|
||||
const currentScrollTop = document.querySelector('main#js-tocs-container')?.scrollTop;
|
||||
editor.chain().focus().setExcalidraw({ data }).run();
|
||||
setTimeout(() => {
|
||||
document.querySelector('main#js-tocs-container').scrollTop = currentScrollTop;
|
||||
});
|
||||
toggleVisible(false);
|
||||
}, [Excalidraw, editor, data, toggleVisible]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user