mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
This commit is contained in:
parent
2615f1a5d1
commit
45056634bd
1 changed files with 39 additions and 5 deletions
|
|
@ -57,6 +57,7 @@ import {upDownHint} from "../util/upDownHint";
|
||||||
import {hintRenderAssets} from "../protyle/hint/extend";
|
import {hintRenderAssets} from "../protyle/hint/extend";
|
||||||
import {Menu} from "../plugin/Menu";
|
import {Menu} from "../plugin/Menu";
|
||||||
import {getFirstBlock} from "../protyle/wysiwyg/getBlock";
|
import {getFirstBlock} from "../protyle/wysiwyg/getBlock";
|
||||||
|
import {popSearch} from "../mobile/menu/search";
|
||||||
|
|
||||||
const renderAssetList = (element: Element, k: string, position: IPosition, exts: string[] = []) => {
|
const renderAssetList = (element: Element, k: string, position: IPosition, exts: string[] = []) => {
|
||||||
fetchPost("/api/search/searchAsset", {
|
fetchPost("/api/search/searchAsset", {
|
||||||
|
|
@ -1451,16 +1452,35 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||||
/// #if !MOBILE
|
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.search,
|
label: window.siyuan.languages.search,
|
||||||
accelerator: window.siyuan.languages.click,
|
accelerator: window.siyuan.languages.click,
|
||||||
icon: "iconSearch",
|
icon: "iconSearch",
|
||||||
click() {
|
click() {
|
||||||
|
/// #if !MOBILE
|
||||||
openGlobalSearch(protyle.app, `#${tagElement.textContent}#`, false);
|
openGlobalSearch(protyle.app, `#${tagElement.textContent}#`, false);
|
||||||
|
/// #else
|
||||||
|
popSearch(protyle.app, {
|
||||||
|
hasReplace: false,
|
||||||
|
method: 0,
|
||||||
|
hPath: "",
|
||||||
|
idPath: [],
|
||||||
|
k: `#${tagElement.textContent}#`,
|
||||||
|
r: "",
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
/// #endif
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
/// #endif
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
label: window.siyuan.languages.rename,
|
||||||
|
icon: "iconEdit",
|
||||||
|
click() {
|
||||||
|
renameTag(tagElement.textContent.replace(Constants.ZWSP, ""));
|
||||||
|
}
|
||||||
|
}).element);
|
||||||
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `${window.siyuan.languages.turnInto} <b>${window.siyuan.languages.text}</b>`,
|
label: `${window.siyuan.languages.turnInto} <b>${window.siyuan.languages.text}</b>`,
|
||||||
icon: "iconRefresh",
|
icon: "iconRefresh",
|
||||||
|
|
@ -1471,10 +1491,24 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.rename,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconEdit",
|
icon: "iconCopy",
|
||||||
click() {
|
click() {
|
||||||
renameTag(tagElement.textContent.replace(Constants.ZWSP, ""));
|
writeText(protyle.lute.BlockDOM2StdMd(tagElement.outerHTML));
|
||||||
|
}
|
||||||
|
}).element);
|
||||||
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
label: window.siyuan.languages.cut,
|
||||||
|
icon: "iconCut",
|
||||||
|
click() {
|
||||||
|
writeText(protyle.lute.BlockDOM2StdMd(tagElement.outerHTML));
|
||||||
|
|
||||||
|
const oldHTML = nodeElement.outerHTML;
|
||||||
|
tagElement.insertAdjacentHTML("afterend", "<wbr>");
|
||||||
|
tagElement.remove();
|
||||||
|
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
|
updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
|
||||||
|
focusByWbr(nodeElement, protyle.toolbar.range);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue