Vanessa 2024-12-20 10:36:20 +08:00
parent f2971a273d
commit 84083865b7
3 changed files with 11 additions and 8 deletions

View file

@ -14,7 +14,7 @@ import {isPaidUser} from "../util/needSubscribe";
import {showMessage} from "../dialog/message";
import {saveAssetKeyList} from "./toggleHistory";
export const openSearchAsset = (element: Element, isStick: boolean) => {
export const openSearchAsset = (element: HTMLElement, isStick: boolean) => {
/// #if !MOBILE
window.siyuan.menus.menu.remove();
element.previousElementSibling.classList.add("fn__none");
@ -133,7 +133,7 @@ export const openSearchAsset = (element: Element, isStick: boolean) => {
nextElement.classList.remove("fn__flex-1");
nextElement.style[direction === "lr" ? "width" : "height"] = nextSize + "px";
element.style.userSelect = "none";
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
moveEvent.preventDefault();
moveEvent.stopPropagation();
@ -146,6 +146,7 @@ export const openSearchAsset = (element: Element, isStick: boolean) => {
};
documentSelf.onmouseup = () => {
element.style.userSelect = "none";
documentSelf.onmousemove = null;
documentSelf.onmouseup = null;
documentSelf.ondragstart = null;

View file

@ -10,7 +10,7 @@ import {Protyle} from "../protyle";
import {resize} from "../protyle/util/resize";
import {Menu} from "../plugin/Menu";
export const openSearchUnRef = (element: Element, editor: Protyle) => {
export const openSearchUnRef = (element: HTMLElement, editor: Protyle) => {
window.siyuan.menus.menu.remove();
element.previousElementSibling.previousElementSibling.classList.add("fn__none");
element.classList.remove("fn__none");
@ -46,7 +46,7 @@ export const openSearchUnRef = (element: Element, editor: Protyle) => {
nextElement.classList.remove("fn__flex-1");
nextElement.style[direction === "lr" ? "width" : "height"] = nextSize + "px";
element.style.userSelect = "none";
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
moveEvent.preventDefault();
moveEvent.stopPropagation();
@ -59,6 +59,7 @@ export const openSearchUnRef = (element: Element, editor: Protyle) => {
};
documentSelf.onmouseup = () => {
element.style.userSelect = "";
documentSelf.onmousemove = null;
documentSelf.onmouseup = null;
documentSelf.ondragstart = null;

View file

@ -85,7 +85,7 @@ export const openGlobalSearch = (app: App, text: string, replace: boolean, searc
};
// closeCB 不存在为页签搜索
export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, element: Element, closeCB?: () => void) => {
export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, element: HTMLElement, closeCB?: () => void) => {
let methodText = window.siyuan.languages.keyword;
if (config.method === 1) {
methodText = window.siyuan.languages.querySyntax;
@ -312,7 +312,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
nextElement.classList.remove("fn__flex-1");
nextElement.style[direction === "lr" ? "width" : "height"] = nextSize + "px";
element.style.userSelect = "none";
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
moveEvent.preventDefault();
moveEvent.stopPropagation();
@ -325,6 +325,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
};
documentSelf.onmouseup = () => {
element.style.userSelect = "";
documentSelf.onmousemove = null;
documentSelf.onmouseup = null;
documentSelf.ondragstart = null;
@ -339,8 +340,8 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
});
const localSearch = window.siyuan.storage[Constants.LOCAL_SEARCHASSET] as ISearchAssetOption;
const assetsElement = element.querySelector("#searchAssets");
const unRefPanelElement = element.querySelector("#searchUnRefPanel");
const assetsElement = element.querySelector("#searchAssets") as HTMLElement;
const unRefPanelElement = element.querySelector("#searchUnRefPanel") as HTMLElement;
element.addEventListener("click", (event: MouseEvent) => {
let target = event.target as HTMLElement;
const searchPathInputElement = element.querySelector("#searchPathInput");