mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-15 11:38:06 +01:00
This commit is contained in:
parent
d2cf402c6a
commit
2d11266b31
8 changed files with 23 additions and 31 deletions
|
|
@ -3,6 +3,7 @@ import {getSelectionOffset} from "../util/selection";
|
|||
import {fetchPost} from "../../util/fetch";
|
||||
import {onGet} from "../util/onGet";
|
||||
import {Constants} from "../../constants";
|
||||
import {setStorageVal} from "../util/compatibility";
|
||||
|
||||
export const saveScroll = (protyle: IProtyle, getObject = false) => {
|
||||
if (!protyle.wysiwyg.element.firstElementChild || window.siyuan.config.readonly) {
|
||||
|
|
@ -38,10 +39,8 @@ export const saveScroll = (protyle: IProtyle, getObject = false) => {
|
|||
if (getObject) {
|
||||
return attr;
|
||||
}
|
||||
const jsonAttr = JSON.stringify(attr);
|
||||
fetchPost("/api/attr/setBlockAttrs", {id: protyle.block.rootID, attrs: {scroll: jsonAttr}}, () => {
|
||||
protyle.wysiwyg.element.setAttribute("scroll", jsonAttr);
|
||||
});
|
||||
window.siyuan.storage[Constants.LOCAL_FILEPOSITION][protyle.block.rootID] = JSON.stringify(attr);
|
||||
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION][protyle.block.rootID]);
|
||||
};
|
||||
|
||||
export const getDocByScroll = (options: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue