mirror of https://github.com/fantasticit/think.git
tiptap: keep scroll top
This commit is contained in:
parent
dd9d4c6da3
commit
27599dca10
|
@ -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]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue