mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🚨
This commit is contained in:
parent
872197aed1
commit
b1c3f64b80
3 changed files with 10 additions and 10 deletions
|
|
@ -38,7 +38,7 @@ import {fontEvent} from "../toolbar/Font";
|
||||||
import {listIndent, listOutdent} from "./list";
|
import {listIndent, listOutdent} from "./list";
|
||||||
import {newFileContentBySelect, rename, replaceFileName} from "../../editor/rename";
|
import {newFileContentBySelect, rename, replaceFileName} from "../../editor/rename";
|
||||||
import {insertEmptyBlock, jumpToParentNext} from "../../block/util";
|
import {insertEmptyBlock, jumpToParentNext} from "../../block/util";
|
||||||
import {getDisplayName, isLocalPath, pathPosix} from "../../util/pathName";
|
import {isLocalPath, pathPosix} from "../../util/pathName";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
import {openBy, openFileById} from "../../editor/util";
|
import {openBy, openFileById} from "../../editor/util";
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
@ -1058,7 +1058,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
markdown: ""
|
markdown: ""
|
||||||
}, response => {
|
}, response => {
|
||||||
insertHTML(`<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`, protyle);
|
insertHTML(`<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`, protyle);
|
||||||
hideElements(["toolbar"], protyle)
|
hideElements(["toolbar"], protyle);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1082,7 +1082,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
markdown: ""
|
markdown: ""
|
||||||
}, response => {
|
}, response => {
|
||||||
insertHTML(`<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`, protyle);
|
insertHTML(`<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(newFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`, protyle);
|
||||||
hideElements(["toolbar"], protyle)
|
hideElements(["toolbar"], protyle);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@ import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||||
|
|
||||||
const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
|
const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
|
||||||
const searchKeys = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}");
|
const searchKeys = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}");
|
||||||
let list: string[] = searchKeys[type] || []
|
let list: string[] = searchKeys[type] || [];
|
||||||
list.splice(0, 0, value);
|
list.splice(0, 0, value);
|
||||||
list = Array.from(new Set(list));
|
list = Array.from(new Set(list));
|
||||||
if (list.length > window.siyuan.config.search.limit) {
|
if (list.length > window.siyuan.config.search.limit) {
|
||||||
list.splice(window.siyuan.config.search.limit, list.length - window.siyuan.config.search.limit);
|
list.splice(window.siyuan.config.search.limit, list.length - window.siyuan.config.search.limit);
|
||||||
}
|
}
|
||||||
searchKeys[type] = list
|
searchKeys[type] = list;
|
||||||
localStorage.setItem(Constants.LOCAL_SEARCHEKEYS, JSON.stringify(searchKeys));
|
localStorage.setItem(Constants.LOCAL_SEARCHEKEYS, JSON.stringify(searchKeys));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -352,7 +352,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
break;
|
break;
|
||||||
} else if (target.id === "searchHistoryBtn") {
|
} else if (target.id === "searchHistoryBtn") {
|
||||||
const list = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS)||"{}")
|
const list = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS)||"{}");
|
||||||
if (!list.keys || list.keys.length === 0) {
|
if (!list.keys || list.keys.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -372,7 +372,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
} else if (target.id === "replaceHistoryBtn") {
|
} else if (target.id === "replaceHistoryBtn") {
|
||||||
const list = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS)||"{}")
|
const list = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS)||"{}");
|
||||||
if (!list.replaceKeys || list.replaceKeys.length === 0) {
|
if (!list.replaceKeys || list.replaceKeys.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -477,7 +477,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
inputTimeout = inputEvent(element, config, inputTimeout, edit, event);
|
inputTimeout = inputEvent(element, config, inputTimeout, edit, event);
|
||||||
});
|
});
|
||||||
searchInputElement.addEventListener("blur", () => {
|
searchInputElement.addEventListener("blur", () => {
|
||||||
saveKeyList("keys", searchInputElement.value)
|
saveKeyList("keys", searchInputElement.value);
|
||||||
});
|
});
|
||||||
searchInputElement.addEventListener("keydown", (event: KeyboardEvent) => {
|
searchInputElement.addEventListener("keydown", (event: KeyboardEvent) => {
|
||||||
let currentList: HTMLElement = searchPanelElement.querySelector(".b3-list-item--focus");
|
let currentList: HTMLElement = searchPanelElement.querySelector(".b3-list-item--focus");
|
||||||
|
|
@ -985,7 +985,7 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, isAll:
|
||||||
if (!loadElement.classList.contains("fn__none")) {
|
if (!loadElement.classList.contains("fn__none")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
saveKeyList("replaceKeys", replaceInputElement.value)
|
saveKeyList("replaceKeys", replaceInputElement.value);
|
||||||
let currentList: HTMLElement = searchPanelElement.querySelector(".b3-list-item--focus");
|
let currentList: HTMLElement = searchPanelElement.querySelector(".b3-list-item--focus");
|
||||||
if (!currentList) {
|
if (!currentList) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1320,7 +1320,7 @@ const panelTreeKeydown = (event: KeyboardEvent) => {
|
||||||
tree = (model as Backlink).mTree;
|
tree = (model as Backlink).mTree;
|
||||||
}
|
}
|
||||||
if (!tree) {
|
if (!tree) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
tree.click(activeItemElement);
|
tree.click(activeItemElement);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue