mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +01:00
This commit is contained in:
parent
b5b46afabd
commit
f742e664c7
4 changed files with 30 additions and 40 deletions
|
|
@ -9,13 +9,15 @@ export const saveScroll = (protyle: IProtyle, getObject = false) => {
|
|||
const attr: IScrollAttr = {
|
||||
startId: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),
|
||||
endId: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),
|
||||
scrollTop: protyle.contentElement.scrollTop
|
||||
scrollTop: protyle.contentElement.scrollTop || parseInt(protyle.contentElement.getAttribute("data-scrolltop")) || 0,
|
||||
}
|
||||
let range: Range
|
||||
if (getSelection().rangeCount > 0) {
|
||||
range = getSelection().getRangeAt(0)
|
||||
}
|
||||
|
||||
if (!range || !protyle.wysiwyg.element.contains(range.startContainer)) {
|
||||
range = protyle.toolbar.range
|
||||
}
|
||||
if (range && protyle.wysiwyg.element.contains(range.startContainer)) {
|
||||
const blockElement = hasClosestBlock(range.startContainer);
|
||||
if (blockElement) {
|
||||
|
|
@ -23,9 +25,9 @@ export const saveScroll = (protyle: IProtyle, getObject = false) => {
|
|||
attr.focusId = blockElement.getAttribute("data-node-id");
|
||||
attr.focusStart = position.start
|
||||
attr.focusEnd = position.end
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (protyle.block.showAll) {
|
||||
attr.zoomInId = protyle.block.id
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue