Vanessa 2025-12-18 12:25:00 +08:00
parent ed44e92bbd
commit 35874e5075
3 changed files with 21 additions and 2 deletions

View file

@ -30,6 +30,7 @@ import {closeWindow} from "../window/closeWin";
import {correctHotkey} from "./globalEvent/commonHotkey";
import {recordBeforeResizeTop} from "../protyle/util/resize";
import {processSYLink} from "../editor/openLink";
import {getAllEditor} from "../layout/getAll";
export const onGetConfig = (isStart: boolean, app: App) => {
correctHotkey(app);
@ -88,7 +89,15 @@ export const onGetConfig = (isStart: boolean, app: App) => {
resizeTabs();
resizeTopBar();
firstResize = true;
}, 200);
if (getSelection().rangeCount > 0) {
const range = getSelection().getRangeAt(0);
getAllEditor().forEach(item => {
if (item.protyle.wysiwyg.element.contains(range.startContainer)) {
item.protyle.toolbar.render(item.protyle, range);
}
});
}
}, Constants.TIMEOUT_RESIZE);
});
};

View file

@ -293,6 +293,7 @@ export abstract class Constants {
// timeout
public static readonly TIMEOUT_OPENDIALOG = 50;
public static readonly TIMEOUT_DBLCLICK = 190;
public static readonly TIMEOUT_RESIZE = 200;
public static readonly TIMEOUT_INPUT = 256;
public static readonly TIMEOUT_LOAD = 300;
public static readonly TIMEOUT_TRANSITION = 300;

View file

@ -13,6 +13,7 @@ import {App} from "../index";
import {afterLoadPlugin} from "../plugin/loader";
import {Tab} from "../layout/Tab";
import {initWindowEvent} from "../boot/globalEvent/event";
import {getAllEditor} from "../layout/getAll";
export const init = (app: App) => {
webFrame.setZoomFactor(window.siyuan.storage[Constants.LOCAL_ZOOM]);
@ -61,7 +62,15 @@ export const init = (app: App) => {
resizeTimeout = window.setTimeout(() => {
adjustLayout(window.siyuan.layout.centerLayout);
resizeTabs();
}, 200);
if (getSelection().rangeCount > 0) {
const range = getSelection().getRangeAt(0);
getAllEditor().forEach(item => {
if (item.protyle.wysiwyg.element.contains(range.startContainer)) {
item.protyle.toolbar.render(item.protyle, range);
}
});
}
}, Constants.TIMEOUT_RESIZE);
});
};