mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-10 01:04:21 +01:00
This commit is contained in:
parent
b567e245af
commit
2a713b087f
2 changed files with 17 additions and 13 deletions
|
|
@ -15,6 +15,7 @@ import {disabledProtyle} from "../protyle/util/onGet";
|
|||
import {fetchPost} from "../util/fetch";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {App} from "../index";
|
||||
import {isMobile} from "../util/functions";
|
||||
|
||||
export class BlockPanel {
|
||||
public element: HTMLElement;
|
||||
|
|
@ -185,6 +186,13 @@ export class BlockPanel {
|
|||
if (afterCB) {
|
||||
afterCB();
|
||||
}
|
||||
// https://ld246.com/article/1653639418266
|
||||
if (editor.protyle.element.nextElementSibling || editor.protyle.element.previousElementSibling) {
|
||||
editor.protyle.element.style.minHeight = Math.min(30 + editor.protyle.wysiwyg.element.clientHeight, window.innerHeight / 3) + "px";
|
||||
}
|
||||
// 由于 afterCB 中高度的设定,需在之后再进行设定
|
||||
// 49 = 16(上图标)+16(下图标)+8(padding)+9(底部距离)
|
||||
editor.protyle.scroll.element.parentElement.setAttribute("style", `--b3-dynamicscroll-width:${Math.min(editor.protyle.contentElement.clientHeight - 49, 200)}px;${isMobile() ? "" : "right:10px"}`);
|
||||
}
|
||||
});
|
||||
this.editors.push(editor);
|
||||
|
|
@ -268,7 +276,9 @@ export class BlockPanel {
|
|||
}
|
||||
}
|
||||
// 单击嵌入块悬浮窗的位置最好是覆盖嵌入块
|
||||
setPosition(this.element, targetRect.left, Math.max(top - 84, Constants.SIZE_TOOLBAR_HEIGHT), 0, 8);
|
||||
// 防止图片撑高后悬浮窗显示不下,只能设置高度
|
||||
this.element.style.height = Math.min(window.innerHeight - Constants.SIZE_TOOLBAR_HEIGHT, targetRect.height + 42) + "px";
|
||||
setPosition(this.element, targetRect.left, Math.max(top - 42, Constants.SIZE_TOOLBAR_HEIGHT), -42, 0);
|
||||
} else if (this.targetElement) {
|
||||
if (this.targetElement.classList.contains("pdf__rect")) {
|
||||
targetRect = this.targetElement.firstElementChild.getBoundingClientRect();
|
||||
|
|
@ -285,10 +295,12 @@ export class BlockPanel {
|
|||
setPosition(this.element, this.x, this.y);
|
||||
}
|
||||
const elementRect = this.element.getBoundingClientRect();
|
||||
if (this.targetElement && elementRect.top < targetRect.top) {
|
||||
this.element.style.maxHeight = Math.floor(targetRect.top - elementRect.top - 8) + "px";
|
||||
} else {
|
||||
this.element.style.maxHeight = Math.floor(window.innerHeight - elementRect.top - 8) + "px";
|
||||
if (this.targetElement && !this.targetElement.classList.contains("protyle-wysiwyg__embed")) {
|
||||
if (elementRect.top < targetRect.top) {
|
||||
this.element.style.maxHeight = Math.floor(targetRect.top - elementRect.top - 8) + "px";
|
||||
} else {
|
||||
this.element.style.maxHeight = Math.floor(window.innerHeight - elementRect.top - 8) + "px";
|
||||
}
|
||||
}
|
||||
this.element.classList.add("block__popover--open");
|
||||
} : undefined);
|
||||
|
|
|
|||
|
|
@ -249,14 +249,6 @@ const setHTML = (options: {
|
|||
});
|
||||
protyle.options.defId = undefined;
|
||||
}
|
||||
// https://ld246.com/article/1653639418266
|
||||
if (protyle.element.classList.contains("block__edit")) {
|
||||
if (protyle.element.nextElementSibling || protyle.element.previousElementSibling) {
|
||||
protyle.element.style.minHeight = Math.min(30 + protyle.wysiwyg.element.clientHeight, window.innerHeight / 3) + "px";
|
||||
}
|
||||
// 49 = 16(上图标)+16(下图标)+8(padding)+9(底部距离)
|
||||
protyle.scroll.element.parentElement.setAttribute("style", `--b3-dynamicscroll-width:${Math.min(protyle.contentElement.clientHeight - 49, 200)}px;${isMobile() ? "" : "right:10px"}`);
|
||||
}
|
||||
// 屏幕太高的页签 https://github.com/siyuan-note/siyuan/issues/5018
|
||||
if (!protyle.scroll.element.classList.contains("fn__none") &&
|
||||
protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "2" &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue