mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
🚨
This commit is contained in:
parent
80dc5d1082
commit
7beee6c57c
6 changed files with 14 additions and 16 deletions
|
|
@ -34,7 +34,7 @@ export const unicode2Emoji = (unicode: string, assic = false, className = "", ne
|
|||
}
|
||||
});
|
||||
if (needSpan) {
|
||||
emoji = `<span class="${className}">${emoji}</span>`
|
||||
emoji = `<span class="${className}">${emoji}</span>`;
|
||||
}
|
||||
} catch (e) {
|
||||
// 自定义表情搜索报错 https://github.com/siyuan-note/siyuan/issues/5883
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@ export const hintMoveBlock = (pathString: string, sourceElements: Element[], pro
|
|||
if (pathString === "/") {
|
||||
return;
|
||||
}
|
||||
const parentID = getDisplayName(pathString, true, true)
|
||||
const parentID = getDisplayName(pathString, true, true);
|
||||
if (protyle.block.rootID === parentID) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export class Search extends Model {
|
|||
});
|
||||
this.element = options.tab.panelElement as HTMLElement;
|
||||
this.config = options.config;
|
||||
this.edit = genSearch(this.config, this.element)
|
||||
this.edit = genSearch(this.config, this.element);
|
||||
}
|
||||
|
||||
public updateSearch(text: string, replace: boolean) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import {escapeHtml} from "../util/escape";
|
||||
import {getIconByType} from "../editor/getIcon";
|
||||
import {getDisplayName, getNotebookName, pathPosix} from "../util/pathName";
|
||||
import {getNotebookName, pathPosix} from "../util/pathName";
|
||||
import {Constants} from "../constants";
|
||||
import {Protyle} from "../protyle";
|
||||
import {Dialog} from "../dialog";
|
||||
import {fetchSyncPost} from "../util/fetch";
|
||||
import {focusByRange} from "../protyle/util/selection";
|
||||
|
|
@ -108,6 +106,6 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
|
|||
types: localData.types
|
||||
}, dialog.element.querySelector(".b3-dialog__container").lastElementChild, () => {
|
||||
dialog.destroy();
|
||||
})
|
||||
});
|
||||
dialog.element.firstElementChild.setAttribute("style", "z-index:199"); // https://github.com/siyuan-note/siyuan/issues/3515
|
||||
};
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
<div id="searchList" class="search__list b3-list b3-list--background search__list"></div>
|
||||
<div id="searchPreview" class="fn__flex-1 search__preview"></div>
|
||||
</div>
|
||||
<div class="fn__loading fn__loading--top"><img width="120px" src="/stage/loading-pure.svg"></div>`
|
||||
<div class="fn__loading fn__loading--top"><img width="120px" src="/stage/loading-pure.svg"></div>`;
|
||||
const searchPanelElement = element.querySelector("#searchList");
|
||||
const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;
|
||||
const replaceInputElement = element.querySelector("#replaceInput") as HTMLInputElement;
|
||||
|
|
@ -162,7 +162,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
searchInputElement.select();
|
||||
|
||||
element.addEventListener("click", (event: MouseEvent) => {
|
||||
let target = event.target as HTMLElement
|
||||
let target = event.target as HTMLElement;
|
||||
while (target && !target.isSameNode(element)) {
|
||||
if (target.classList.contains("search__rmpath")) {
|
||||
config.idPath = "";
|
||||
|
|
@ -227,7 +227,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
event.preventDefault();
|
||||
break;
|
||||
} else if (target.id === "searchRefresh") {
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit, false)
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit, false);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
|
@ -486,7 +486,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
});
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit, false);
|
||||
return edit;
|
||||
}
|
||||
};
|
||||
|
||||
const addConfigMenu = (config: ISearchOption, lang: string, key: "mathBlock" | "table" | "blockquote" | "superBlock" | "paragraph" | "document" | "heading" | "list" | "listItem" | "codeBlock" | "htmlBlock",
|
||||
edit: Protyle, element: Element) => {
|
||||
|
|
@ -505,7 +505,7 @@ const addConfigMenu = (config: ISearchOption, lang: string, key: "mathBlock" | "
|
|||
});
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
};
|
||||
|
||||
const getKey = (element: HTMLElement) => {
|
||||
const keys: string[] = [];
|
||||
|
|
@ -647,7 +647,7 @@ const inputEvent = (element: Element, config: ISearchOption, inputTimeout: numbe
|
|||
});
|
||||
}
|
||||
if (saveConfig) {
|
||||
config.k = inputValue
|
||||
config.k = inputValue;
|
||||
if (!element.parentElement.getAttribute("data-id")) {
|
||||
localStorage.setItem(Constants.LOCAL_SEARCHEDATA, JSON.stringify(config));
|
||||
}
|
||||
|
|
@ -673,7 +673,7 @@ ${unicode2Emoji(getNotebookIcon(item.box) || Constants.SIYUAN_IMAGE_NOTE, false,
|
|||
${unicode2Emoji(childItem.ial.icon, false, "b3-list-item__graphic", true)}
|
||||
<span class="b3-list-item__text">${childItem.content}</span>
|
||||
</div>`;
|
||||
})
|
||||
});
|
||||
resultHTML += "</div>";
|
||||
} else {
|
||||
const title = escapeHtml(getNotebookName(item.box)) + getDisplayName(item.hPath, false);
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ export const globalShortcut = () => {
|
|||
}
|
||||
const originalElement = switchDialog.element.querySelector('[data-original="true"]');
|
||||
if (originalElement) {
|
||||
originalElement.removeAttribute("data-original")
|
||||
originalElement.removeAttribute("data-original");
|
||||
}
|
||||
} else if (event.key === "Control") {
|
||||
let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
|
||||
|
|
@ -391,7 +391,7 @@ export const globalShortcut = () => {
|
|||
}).forEach(item => {
|
||||
let icon = `<svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg>`;
|
||||
let rootId = "";
|
||||
const initData = item.headElement.getAttribute("data-initdata")
|
||||
const initData = item.headElement.getAttribute("data-initdata");
|
||||
if (item.model instanceof Editor) {
|
||||
rootId = ` data-node-id="${item.model.editor.protyle.block.rootID}"`;
|
||||
icon = unicode2Emoji(item.docIcon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__graphic", true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue