mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
cccd44c00c
commit
1cabe6f88c
1 changed files with 10 additions and 1 deletions
|
|
@ -486,8 +486,17 @@ export const resizeTabs = () => {
|
||||||
}
|
}
|
||||||
// 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments
|
// 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments
|
||||||
if (!item.element.classList.contains("fn__none") && item.editor.protyle.toolbar.range) {
|
if (!item.element.classList.contains("fn__none") && item.editor.protyle.toolbar.range) {
|
||||||
|
let rangeRect = item.editor.protyle.toolbar.range.getBoundingClientRect();
|
||||||
|
if (rangeRect.height === 0) {
|
||||||
|
const blockElement = hasClosestBlock(item.editor.protyle.toolbar.range.startContainer)
|
||||||
|
if (blockElement) {
|
||||||
|
rangeRect = blockElement.getBoundingClientRect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rangeRect.height === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const protyleRect = item.editor.protyle.element.getBoundingClientRect();
|
const protyleRect = item.editor.protyle.element.getBoundingClientRect();
|
||||||
const rangeRect = item.editor.protyle.toolbar.range.getBoundingClientRect();
|
|
||||||
if (protyleRect.top + 30 > rangeRect.top || protyleRect.bottom < rangeRect.bottom) {
|
if (protyleRect.top + 30 > rangeRect.top || protyleRect.bottom < rangeRect.bottom) {
|
||||||
item.editor.protyle.toolbar.range.startContainer.parentElement.scrollIntoView(protyleRect.top > rangeRect.top);
|
item.editor.protyle.toolbar.range.startContainer.parentElement.scrollIntoView(protyleRect.top > rangeRect.top);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue