mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
This commit is contained in:
parent
badaf6ffb8
commit
33b9a6d331
18 changed files with 78 additions and 41 deletions
|
|
@ -251,9 +251,9 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
}
|
||||
let searchKey = "";
|
||||
if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
|
||||
searchKey = window.siyuan.config.keymap.general.replace.custom;
|
||||
searchKey = Constants.DIALOG_REPLACE;
|
||||
} else if (matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
|
||||
searchKey = window.siyuan.config.keymap.general.search.custom;
|
||||
searchKey = Constants.DIALOG_SEARCH;
|
||||
}
|
||||
if (!isFileFocus && searchKey) {
|
||||
if (range && protyle.element.contains(range.startContainer)) {
|
||||
|
|
@ -629,9 +629,9 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {
|
|||
|
||||
let searchKey = "";
|
||||
if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
|
||||
searchKey = window.siyuan.config.keymap.general.replace.custom;
|
||||
searchKey = Constants.DIALOG_REPLACE;
|
||||
} else if (matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
|
||||
searchKey = window.siyuan.config.keymap.general.search.custom;
|
||||
searchKey = Constants.DIALOG_SEARCH;
|
||||
}
|
||||
if (searchKey) {
|
||||
window.siyuan.menus.menu.remove();
|
||||
|
|
@ -1045,13 +1045,13 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
|
|||
["0", "1", "2", "3", "4", "j", "k", "l", ";", "s", " ", "p", "enter"].includes(event.key.toLowerCase())) {
|
||||
let cardElement: Element;
|
||||
window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.riffCard.custom) {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_OPENCARD) {
|
||||
cardElement = item.element;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (!cardElement) {
|
||||
cardElement = document.querySelector(`.layout__wnd--active div[data-key="${window.siyuan.config.keymap.general.riffCard.custom}"]:not(.fn__none)`);
|
||||
cardElement = document.querySelector(`.layout__wnd--active div[data-key="${Constants.DIALOG_OPENCARD}"]:not(.fn__none)`);
|
||||
}
|
||||
if (cardElement) {
|
||||
event.preventDefault();
|
||||
|
|
@ -1173,7 +1173,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
|
|||
<div class="switch-doc__path"></div>
|
||||
</div>`,
|
||||
});
|
||||
switchDialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.goToEditTabNext.custom);
|
||||
switchDialog.element.setAttribute("data-key", Constants.DIALOG_SWITCHTAB);
|
||||
// 需移走光标,否则编辑器会继续监听并执行按键操作
|
||||
switchDialog.element.querySelector("input").focus();
|
||||
if (isMac()) {
|
||||
|
|
@ -1190,7 +1190,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
|
|||
if (isNotCtrl(event) && !event.shiftKey && !event.altKey &&
|
||||
(event.key.startsWith("Arrow") || event.key === "Enter")) {
|
||||
const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_RECENTDOCS) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
@ -1214,7 +1214,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
|
|||
|
||||
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
||||
const viewCardsDialog = window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === "viewCards") {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_VIEWCARDS) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
@ -1654,11 +1654,11 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
|
|||
|
||||
let searchKey = "";
|
||||
if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
|
||||
searchKey = window.siyuan.config.keymap.general.replace.custom;
|
||||
searchKey = Constants.DIALOG_REPLACE;
|
||||
} else if (!hasClosestByClassName(target, "pdf__outer") && matchHotKey(window.siyuan.config.keymap.general.search.custom, event)) {
|
||||
searchKey = window.siyuan.config.keymap.general.search.custom;
|
||||
searchKey = Constants.DIALOG_SEARCH;
|
||||
} else if (matchHotKey(window.siyuan.config.keymap.general.globalSearch.custom, event)) {
|
||||
searchKey = window.siyuan.config.keymap.general.globalSearch.custom;
|
||||
searchKey = Constants.DIALOG_GLOBALSEARCH;
|
||||
}
|
||||
if (searchKey) {
|
||||
if (getSelection().rangeCount > 0) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export const windowKeyUp = (app: App, event: KeyboardEvent) => {
|
|||
window.siyuan.shiftIsPressed = false;
|
||||
window.siyuan.altIsPressed = false;
|
||||
const switchDialog = window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.goToEditTabNext.custom) {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_SWITCHTAB) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, "b3-list-item__graphic
|
|||
|
||||
export const openRecentDocs = () => {
|
||||
const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_RECENTDOCS) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
@ -113,7 +113,7 @@ export const openRecentDocs = () => {
|
|||
}
|
||||
getHTML(response.data, dialog.element, searchElement.value);
|
||||
});
|
||||
dialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.recentDocs.custom);
|
||||
dialog.element.setAttribute("data-key", Constants.DIALOG_RECENTDOCS);
|
||||
dialog.element.addEventListener("click", (event) => {
|
||||
const liElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");
|
||||
if (liElement) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const genCardItem = (item: ICardPackage) => {
|
|||
|
||||
export const makeCard = (app: App, ids: string[]) => {
|
||||
window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === "makeCard") {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_MAKECARD) {
|
||||
hideElements(["dialog"]);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ export const makeCard = (app: App, ids: string[]) => {
|
|||
<ul class="b3-list b3-list--background fn__flex-1">${html}</ul>
|
||||
</div>`,
|
||||
});
|
||||
dialog.element.setAttribute("data-key", "makeCard");
|
||||
dialog.element.setAttribute("data-key", Constants.DIALOG_MAKECARD);
|
||||
dialog.element.addEventListener("click", (event) => {
|
||||
let target = event.target as HTMLElement;
|
||||
while (target && !target.isSameNode(dialog.element)) {
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ export const bindCardEvent = (options: {
|
|||
});
|
||||
});
|
||||
}
|
||||
options.element.setAttribute("data-key", window.siyuan.config.keymap.general.riffCard.custom);
|
||||
options.element.setAttribute("data-key", Constants.DIALOG_OPENCARD);
|
||||
const countElement = options.element.querySelector('[data-type="count"] span');
|
||||
countElement.innerHTML = (index + 1).toString();
|
||||
const actionElements = options.element.querySelectorAll(".card__action");
|
||||
|
|
@ -456,7 +456,7 @@ export const openCardByData = (app: App, cardsData: {
|
|||
unreviewedOldCardCount: number
|
||||
}, cardType: TCardType, id?: string, title?: string) => {
|
||||
const exit = window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.riffCard.custom) {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_OPENCARD) {
|
||||
item.destroy();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -464,11 +464,13 @@ export const openCardByData = (app: App, cardsData: {
|
|||
if (exit) {
|
||||
return;
|
||||
}
|
||||
|
||||
const dialogPosition = window.siyuan.storage[Constants.LOCAL_DIALOGPOSITION][Constants.DIALOG_OPENCARD];
|
||||
const dialog = new Dialog({
|
||||
content: genCardHTML({id, cardType, cardsData, isTab: false}),
|
||||
width: isMobile() ? "100vw" : "80vw",
|
||||
height: isMobile() ? "100vh" : "70vh",
|
||||
width: dialogPosition ? dialogPosition.width + "px" : (isMobile() ? "100vw" : "80vw"),
|
||||
height: dialogPosition ? dialogPosition.height + "px" : (isMobile() ? "100vh" : "70vh"),
|
||||
left: dialogPosition?.left,
|
||||
top: dialogPosition?.top,
|
||||
destroyCallback() {
|
||||
if (editor) {
|
||||
editor.destroy();
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|||
if (response.data.pageCount > 1) {
|
||||
nextElement.removeAttribute("disabled");
|
||||
}
|
||||
dialog.element.setAttribute("data-key", "viewCards");
|
||||
dialog.element.setAttribute("data-key", Constants.DIALOG_VIEWCARDS);
|
||||
dialog.element.addEventListener("click", (event) => {
|
||||
if (typeof event.detail === "string") {
|
||||
let currentElement = listElement.querySelector(".b3-list-item--focus");
|
||||
|
|
|
|||
|
|
@ -101,8 +101,20 @@ export abstract class Constants {
|
|||
public static readonly LOCAL_PLUGINTOPUNPIN = "local-plugintopunpin";
|
||||
public static readonly LOCAL_FLASHCARD = "local-flashcard";
|
||||
public static readonly LOCAL_FILEPOSITION = "local-fileposition";
|
||||
public static readonly LOCAL_DIALOGPOSITION = "local-dialogposition";
|
||||
public static readonly LOCAL_SESSION_FIRSTLOAD = "local-session-firstload";
|
||||
|
||||
// dialog
|
||||
public static readonly DIALOG_OPENCARD = "dialog-opencard";
|
||||
public static readonly DIALOG_MAKECARD = "dialog-makecard";
|
||||
public static readonly DIALOG_VIEWCARDS = "dialog-viewcards";
|
||||
public static readonly DIALOG_DIALYNOTE = "dialog-dialynote";
|
||||
public static readonly DIALOG_RECENTDOCS = "dialog-recentdocs";
|
||||
public static readonly DIALOG_SWITCHTAB = "dialog-switchtab";
|
||||
public static readonly DIALOG_SEARCH = "dialog-search";
|
||||
public static readonly DIALOG_REPLACE = "dialog-replace";
|
||||
public static readonly DIALOG_GLOBALSEARCH = "dialog-globalsearch";
|
||||
|
||||
// timeout
|
||||
public static readonly TIMEOUT_DBLCLICK = 190;
|
||||
public static readonly TIMEOUT_INPUT = 256;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ export class Dialog {
|
|||
title?: string,
|
||||
transparent?: boolean,
|
||||
content: string,
|
||||
left?: number,
|
||||
top?: number,
|
||||
width?: string,
|
||||
height?: string,
|
||||
destroyCallback?: (options?: IObject) => void,
|
||||
|
|
@ -32,9 +34,9 @@ export class Dialog {
|
|||
this.destroyCallback = options.destroyCallback;
|
||||
this.element = document.createElement("div") as HTMLElement;
|
||||
|
||||
this.element.innerHTML = `<div class="b3-dialog" style="z-index: ${++window.siyuan.zIndex};">
|
||||
this.element.innerHTML = `<div class="b3-dialog" style="z-index: ${++window.siyuan.zIndex};${typeof options.left === "number" ? "display:block" : ""}">
|
||||
<div class="b3-dialog__scrim"${options.transparent ? 'style="background-color:transparent"' : ""}></div>
|
||||
<div class="b3-dialog__container" style="width:${options.width || "auto"};height:${options.height || "auto"}">
|
||||
<div class="b3-dialog__container" style="width:${options.width || "auto"};height:${options.height || "auto"};left:${options.left}px;top:${options.top}px">
|
||||
<svg ${(isMobile() && options.title) ? 'style="top:0;right:0;"' : ""} class="b3-dialog__close${(this.disableClose || options.hideCloseIcon) ? " fn__none" : ""}"><use xlink:href="#iconCloseRound"></use></svg>
|
||||
<div class="resize__move b3-dialog__header${options.title ? "" : " fn__none"}" onselectstart="return false;">${options.title || ""}</div>
|
||||
<div class="b3-dialog__body">${options.content}</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||
import {Constants} from "../constants";
|
||||
import {hideAllElements} from "../protyle/ui/hideElements";
|
||||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
|
||||
export const moveResize = (element: HTMLElement, afterCB?: (type: string) => void) => {
|
||||
element.addEventListener("mousedown", (event: MouseEvent & { target: HTMLElement }) => {
|
||||
|
|
@ -133,6 +134,19 @@ export const moveResize = (element: HTMLElement, afterCB?: (type: string) => voi
|
|||
documentSelf.onselectstart = null;
|
||||
documentSelf.onselect = null;
|
||||
hideAllElements(["gutter"])
|
||||
const dialogElement = hasClosestByClassName(element, "b3-dialog--open")
|
||||
if (dialogElement) {
|
||||
const dialogId = dialogElement.dataset.key;
|
||||
if (dialogId) {
|
||||
window.siyuan.storage[Constants.LOCAL_DIALOGPOSITION][dialogId] = {
|
||||
width: parseInt(element.style.width),
|
||||
height: parseInt(element.style.height),
|
||||
left: parseInt(element.style.left),
|
||||
top: parseInt(element.style.top),
|
||||
}
|
||||
setStorageVal(Constants.LOCAL_DIALOGPOSITION, window.siyuan.storage[Constants.LOCAL_DIALOGPOSITION]);
|
||||
}
|
||||
}
|
||||
if (hasMove && afterCB) {
|
||||
afterCB(type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import {openRecentDocs} from "../business/openRecentDocs";
|
|||
import {openHistory} from "../history/history";
|
||||
import {newFile} from "../util/newFile";
|
||||
import {mountHelp, newNotebook} from "../util/mount";
|
||||
import {Constants} from "../constants";
|
||||
|
||||
export const getActiveTab = (wndActive = true) => {
|
||||
const activeTabElement = document.querySelector(".layout__wnd--active .item--focus");
|
||||
|
|
@ -185,7 +186,7 @@ export const newCenterEmptyTab = (app: App) => {
|
|||
if (target.id === "editorEmptySearch") {
|
||||
openSearch({
|
||||
app,
|
||||
hotkey: window.siyuan.config.keymap.general.globalSearch.custom,
|
||||
hotkey: Constants.DIALOG_GLOBALSEARCH,
|
||||
});
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ export const initBar = (app: App) => {
|
|||
} else if (targetId === "barSearch") {
|
||||
openSearch({
|
||||
app,
|
||||
hotkey: window.siyuan.config.keymap.general.globalSearch.custom
|
||||
hotkey: Constants.DIALOG_GLOBALSEARCH
|
||||
});
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import {App} from "../index";
|
|||
import {afterLoadPlugin} from "../plugin/loader";
|
||||
import {setTitle} from "../dialog/processSystem";
|
||||
import {newCenterEmptyTab, resizeTabs} from "./tabUtil";
|
||||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
|
||||
export const setPanelFocus = (element: Element) => {
|
||||
if (element.getAttribute("data-type") === "wnd") {
|
||||
|
|
@ -169,6 +170,10 @@ const dockToJSON = (dock: Dock) => {
|
|||
|
||||
export const resetLayout = () => {
|
||||
fetchPost("/api/system/setUILayout", {layout: {}}, () => {
|
||||
window.siyuan.storage[Constants.LOCAL_FILEPOSITION] = {};
|
||||
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]);
|
||||
window.siyuan.storage[Constants.LOCAL_DIALOGPOSITION] = {};
|
||||
setStorageVal(Constants.LOCAL_DIALOGPOSITION, window.siyuan.storage[Constants.LOCAL_DIALOGPOSITION]);
|
||||
window.location.reload();
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
|
|||
/// #else
|
||||
openSearch({
|
||||
app,
|
||||
hotkey: window.siyuan.config.keymap.general.search.custom,
|
||||
hotkey: Constants.DIALOG_SEARCH,
|
||||
notebookId,
|
||||
});
|
||||
/// #endif
|
||||
|
|
@ -269,7 +269,7 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
|
|||
/// #else
|
||||
openSearch({
|
||||
app,
|
||||
hotkey: window.siyuan.config.keymap.general.replace.custom,
|
||||
hotkey: Constants.DIALOG_REPLACE,
|
||||
notebookId,
|
||||
});
|
||||
/// #endif
|
||||
|
|
@ -564,7 +564,7 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
|
|||
/// #else
|
||||
openSearch({
|
||||
app,
|
||||
hotkey: window.siyuan.config.keymap.general.search.custom,
|
||||
hotkey: Constants.DIALOG_SEARCH,
|
||||
notebookId,
|
||||
searchPath
|
||||
});
|
||||
|
|
@ -600,7 +600,7 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
|
|||
/// #else
|
||||
openSearch({
|
||||
app,
|
||||
hotkey: window.siyuan.config.keymap.general.replace.custom,
|
||||
hotkey: Constants.DIALOG_REPLACE,
|
||||
notebookId,
|
||||
searchPath
|
||||
});
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
|
|||
/// #else
|
||||
openSearch({
|
||||
app: protyle.app,
|
||||
hotkey: window.siyuan.config.keymap.general.search.custom,
|
||||
hotkey: Constants.DIALOG_SEARCH,
|
||||
notebookId: protyle.notebookId,
|
||||
searchPath
|
||||
});
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ export const getLocalStorage = (cb: () => void) => {
|
|||
defaultStorage[Constants.LOCAL_AI] = []; // {name: "", memo: ""}
|
||||
defaultStorage[Constants.LOCAL_PLUGINTOPUNPIN] = [];
|
||||
defaultStorage[Constants.LOCAL_FILEPOSITION] = {}; // {id: IScrollAttr}
|
||||
defaultStorage[Constants.LOCAL_DIALOGPOSITION] = {}; // {id: IPosition}
|
||||
defaultStorage[Constants.LOCAL_FLASHCARD] = {
|
||||
fullscreen: false
|
||||
};
|
||||
|
|
@ -246,7 +247,7 @@ export const getLocalStorage = (cb: () => void) => {
|
|||
[Constants.LOCAL_EXPORTIMG, Constants.LOCAL_SEARCHKEYS, Constants.LOCAL_PDFTHEME, Constants.LOCAL_BAZAAR,
|
||||
Constants.LOCAL_EXPORTWORD, Constants.LOCAL_EXPORTPDF, Constants.LOCAL_DOCINFO, Constants.LOCAL_FONTSTYLES,
|
||||
Constants.LOCAL_SEARCHDATA, Constants.LOCAL_ZOOM, Constants.LOCAL_LAYOUTS, Constants.LOCAL_AI,
|
||||
Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD,
|
||||
Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD, Constants.LOCAL_DIALOGPOSITION,
|
||||
Constants.LOCAL_FILEPOSITION].forEach((key) => {
|
||||
if (typeof response.data[key] === "string") {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ export const openSearch = async (options: {
|
|||
if (item.element.querySelector("#searchList")) {
|
||||
const lastKey = item.element.getAttribute("data-key");
|
||||
const replaceHeaderElement = item.element.querySelectorAll(".search__header")[1];
|
||||
if (lastKey !== options.hotkey && options.hotkey === window.siyuan.config.keymap.general.replace.custom && replaceHeaderElement.classList.contains("fn__none")) {
|
||||
if (lastKey !== options.hotkey && options.hotkey === Constants.DIALOG_REPLACE && replaceHeaderElement.classList.contains("fn__none")) {
|
||||
replaceHeaderElement.classList.remove("fn__none");
|
||||
item.element.setAttribute("data-key", options.hotkey);
|
||||
return true;
|
||||
}
|
||||
const searchPathElement = item.element.querySelector("#searchPathInput");
|
||||
if (lastKey !== options.hotkey && options.hotkey === window.siyuan.config.keymap.general.globalSearch.custom) {
|
||||
if (lastKey !== options.hotkey && options.hotkey === Constants.DIALOG_GLOBALSEARCH) {
|
||||
if (searchPathElement.textContent !== "") {
|
||||
item.destroy();
|
||||
return false;
|
||||
|
|
@ -33,7 +33,7 @@ export const openSearch = async (options: {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if (lastKey !== options.hotkey && options.hotkey === window.siyuan.config.keymap.general.search.custom) {
|
||||
if (lastKey !== options.hotkey && options.hotkey === Constants.DIALOG_SEARCH) {
|
||||
if (searchPathElement.textContent === "") {
|
||||
item.destroy();
|
||||
return false;
|
||||
|
|
@ -65,7 +65,7 @@ export const openSearch = async (options: {
|
|||
hPath = pathPosix().join(hPath, response.data);
|
||||
idPath[0] = pathPosix().join(idPath[0], options.searchPath);
|
||||
}
|
||||
} else if (window.siyuan.config.keymap.general.globalSearch.custom === options.hotkey) {
|
||||
} else if (Constants.DIALOG_GLOBALSEARCH === options.hotkey) {
|
||||
if (localData.removed) {
|
||||
hPath = "";
|
||||
idPath = [];
|
||||
|
|
@ -102,7 +102,7 @@ export const openSearch = async (options: {
|
|||
removed: localData.removed,
|
||||
k: options.key || localData.k,
|
||||
r: localData.r,
|
||||
hasReplace: options.hotkey === window.siyuan.config.keymap.general.replace.custom,
|
||||
hasReplace: options.hotkey === Constants.DIALOG_REPLACE,
|
||||
method: localData.method,
|
||||
hPath,
|
||||
idPath,
|
||||
|
|
|
|||
|
|
@ -1014,7 +1014,7 @@ export const getQueryTip = (method: number) => {
|
|||
|
||||
const updateConfig = (element: Element, item: ISearchOption, config: ISearchOption, edit: Protyle) => {
|
||||
const dialogElement = hasClosestByClassName(element, "b3-dialog--open");
|
||||
if (dialogElement && dialogElement.getAttribute("data-key") === window.siyuan.config.keymap.general.search.custom) {
|
||||
if (dialogElement && dialogElement.getAttribute("data-key") === Constants.DIALOG_SEARCH) {
|
||||
// https://github.com/siyuan-note/siyuan/issues/6828
|
||||
item.hPath = config.hPath;
|
||||
item.idPath = config.idPath.join(",").split(",");
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const fetchNewDailyNote = (app: App, notebook: string) => {
|
|||
|
||||
export const newDailyNote = (app: App) => {
|
||||
const exit = window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.dailyNote.custom) {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_DIALYNOTE) {
|
||||
item.destroy();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ export const newDailyNote = (app: App) => {
|
|||
</div>`,
|
||||
width: isMobile() ? "92vw" : "520px",
|
||||
});
|
||||
dialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.dailyNote.custom);
|
||||
dialog.element.setAttribute("data-key", Constants.DIALOG_DIALYNOTE);
|
||||
const btnsElement = dialog.element.querySelectorAll(".b3-button");
|
||||
const selectElement = dialog.element.querySelector(".b3-select") as HTMLSelectElement;
|
||||
selectElement.value = localNotebookId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue