Vanessa 2025-08-12 10:43:32 +08:00
parent ec15f672c3
commit 1edd35029e
2 changed files with 17 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import {globalCommand} from "./global";
import {getDisplayName, getNotebookName, getTopPaths, movePathTo, moveToPath, pathPosix} from "../../../util/pathName";
import {hintMoveBlock} from "../../../protyle/hint/extend";
import {fetchSyncPost} from "../../../util/fetch";
import {focusByRange} from "../../../protyle/util/selection";
export const commandPanel = (app: App) => {
const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined;
@ -41,7 +42,12 @@ export const commandPanel = (app: App) => {
<kbd>${window.siyuan.languages.enterKey}/${window.siyuan.languages.click}</kbd> ${window.siyuan.languages.confirm}
<kbd>Esc</kbd> ${window.siyuan.languages.close}
</div>
</div>`
</div>`,
destroyCallback() {
if (range) {
focusByRange(range);
}
},
});
dialog.element.setAttribute("data-key", Constants.DIALOG_COMMANDPANEL);
const listElement = dialog.element.querySelector("#commands");

View file

@ -20,6 +20,7 @@ import {publish} from "./publish";
import {App} from "../index";
import {isHuawei, isInHarmony} from "../protyle/util/compatibility";
import {Constants} from "../constants";
import {focusByRange} from "../protyle/util/selection";
/// #endif
export const genItemPanel = (type: string, containerElement: Element, app: App) => {
@ -107,6 +108,10 @@ export const openSetting = (app: App) => {
if (exitDialog) {
return exitDialog;
}
let range: Range;
if (getSelection().rangeCount > 0) {
range = getSelection().getRangeAt(0);
}
const dialog = new Dialog({
content: `<div class="fn__flex-1 fn__flex config__panel" style="overflow: hidden;position: relative">
<ul class="b3-tab-bar b3-list b3-list--background">
@ -152,6 +157,11 @@ export const openSetting = (app: App) => {
</div>`,
width: "90vw",
height: "90vh",
destroyCallback() {
if (range) {
focusByRange(range);
}
},
});
dialog.element.setAttribute("data-key", Constants.DIALOG_SETTING);