mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
Add data-id attribute to the buttons (#14182)
fix https://github.com/siyuan-note/siyuan/issues/12518
This commit is contained in:
parent
853cf71d31
commit
33f8def8ce
16 changed files with 224 additions and 31 deletions
|
|
@ -342,6 +342,7 @@ export const bindCardEvent = async (options: {
|
|||
}
|
||||
const menu = new Menu();
|
||||
menu.addItem({
|
||||
id: "setDueTime",
|
||||
icon: "iconClock",
|
||||
label: window.siyuan.languages.setDueTime,
|
||||
click() {
|
||||
|
|
@ -392,6 +393,7 @@ export const bindCardEvent = async (options: {
|
|||
});
|
||||
if (currentCard.state !== 0) {
|
||||
menu.addItem({
|
||||
id: "reset",
|
||||
icon: "iconRefresh",
|
||||
label: window.siyuan.languages.reset,
|
||||
click() {
|
||||
|
|
@ -426,6 +428,7 @@ export const bindCardEvent = async (options: {
|
|||
});
|
||||
}
|
||||
menu.addItem({
|
||||
id: "removeRiffCard",
|
||||
icon: "iconTrashcan",
|
||||
label: `${window.siyuan.languages.remove} <b>${window.siyuan.languages.riffCard}</b>`,
|
||||
click() {
|
||||
|
|
@ -448,6 +451,7 @@ export const bindCardEvent = async (options: {
|
|||
});
|
||||
menu.addSeparator();
|
||||
menu.addItem({
|
||||
id: "forgetCountAndRevisionCountAndCardStatusAndLastReviewTime",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div class="fn__flex">
|
||||
|
|
@ -484,6 +488,7 @@ export const bindCardEvent = async (options: {
|
|||
if (sticktabElement) {
|
||||
const stickMenu = new Menu();
|
||||
stickMenu.addItem({
|
||||
id: "insertRight",
|
||||
icon: "iconLayoutRight",
|
||||
label: window.siyuan.languages.insertRight,
|
||||
click() {
|
||||
|
|
@ -508,6 +513,7 @@ export const bindCardEvent = async (options: {
|
|||
});
|
||||
/// #if !BROWSER
|
||||
stickMenu.addItem({
|
||||
id: "openByNewWindow",
|
||||
icon: "iconOpenWindow",
|
||||
label: window.siyuan.languages.openByNewWindow,
|
||||
click() {
|
||||
|
|
@ -557,6 +563,7 @@ export const bindCardEvent = async (options: {
|
|||
fetchPost("/api/riff/getRiffDecks", {}, (response) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "all",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.all,
|
||||
click() {
|
||||
|
|
@ -566,6 +573,7 @@ export const bindCardEvent = async (options: {
|
|||
},
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "fileTree",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.fileTree,
|
||||
click() {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,10 @@ export class Menu {
|
|||
}
|
||||
}
|
||||
|
||||
public addSeparator(index?: number) {
|
||||
public addSeparator(index?: number, id?: string) {
|
||||
if (id) {
|
||||
return this.addItem({id: "separator_" + id, type: "separator", index});
|
||||
}
|
||||
return this.addItem({type: "separator", index});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
|
|||
const id = element.getAttribute("data-node-id");
|
||||
if (!id && !window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "rename",
|
||||
icon: "iconEdit",
|
||||
label: window.siyuan.languages.rename,
|
||||
click: () => {
|
||||
|
|
@ -57,6 +58,7 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
|
|||
}
|
||||
if (id) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
type: "submenu",
|
||||
icon: "iconCopy",
|
||||
|
|
@ -66,6 +68,7 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
|
|||
|
||||
if (!window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "remove",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click: () => {
|
||||
|
|
|
|||
|
|
@ -284,6 +284,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I
|
|||
window.siyuan.menus.menu.remove();
|
||||
if (response.data.length === 0) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "emptyContent",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.emptyContent,
|
||||
type: "readonly",
|
||||
|
|
@ -711,6 +712,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
const submenu = [];
|
||||
/// #if MOBILE
|
||||
submenu.push({
|
||||
id: isInAndroid() || isInHarmony() ? "useDefault" : "useBrowserView",
|
||||
label: isInAndroid() || isInHarmony() ? window.siyuan.languages.useDefault : window.siyuan.languages.useBrowserView,
|
||||
accelerator: showAccelerator ? window.siyuan.languages.click : "",
|
||||
click: () => {
|
||||
|
|
@ -724,6 +726,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
(src.endsWith(".pdf") && !src.startsWith("file://")))
|
||||
) {
|
||||
submenu.push({
|
||||
id: "insertRight",
|
||||
icon: "iconLayoutRight",
|
||||
label: window.siyuan.languages.insertRight,
|
||||
accelerator: showAccelerator ? window.siyuan.languages.click : "",
|
||||
|
|
@ -732,6 +735,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
}
|
||||
});
|
||||
submenu.push({
|
||||
id: "openBy",
|
||||
label: window.siyuan.languages.openBy,
|
||||
icon: "iconOpen",
|
||||
accelerator: showAccelerator ? "⌥" + window.siyuan.languages.click : "",
|
||||
|
|
@ -741,6 +745,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
});
|
||||
/// #if !BROWSER
|
||||
submenu.push({
|
||||
id: "openByNewWindow",
|
||||
label: window.siyuan.languages.openByNewWindow,
|
||||
icon: "iconOpenWindow",
|
||||
click() {
|
||||
|
|
@ -748,6 +753,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
}
|
||||
});
|
||||
submenu.push({
|
||||
id: "showInFolder",
|
||||
icon: "iconFolder",
|
||||
label: window.siyuan.languages.showInFolder,
|
||||
accelerator: showAccelerator ? "⌘" + window.siyuan.languages.click : "",
|
||||
|
|
@ -756,6 +762,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
}
|
||||
});
|
||||
submenu.push({
|
||||
id: "useDefault",
|
||||
label: window.siyuan.languages.useDefault,
|
||||
accelerator: showAccelerator ? "⇧" + window.siyuan.languages.click : "",
|
||||
click() {
|
||||
|
|
@ -766,6 +773,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
} else {
|
||||
/// #if !BROWSER
|
||||
submenu.push({
|
||||
id: "useDefault",
|
||||
label: window.siyuan.languages.useDefault,
|
||||
accelerator: showAccelerator ? window.siyuan.languages.click : "",
|
||||
click() {
|
||||
|
|
@ -773,6 +781,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
}
|
||||
});
|
||||
submenu.push({
|
||||
id: "showInFolder",
|
||||
icon: "iconFolder",
|
||||
label: window.siyuan.languages.showInFolder,
|
||||
accelerator: showAccelerator ? "⌘" + window.siyuan.languages.click : "",
|
||||
|
|
@ -782,6 +791,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
});
|
||||
/// #else
|
||||
submenu.push({
|
||||
id: isInAndroid() || isInHarmony() ? "useDefault" : "useBrowserView",
|
||||
label: isInAndroid() || isInHarmony() ? window.siyuan.languages.useDefault : window.siyuan.languages.useBrowserView,
|
||||
accelerator: showAccelerator ? window.siyuan.languages.click : "",
|
||||
click: () => {
|
||||
|
|
@ -798,6 +808,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
}
|
||||
/// #if !BROWSER
|
||||
submenu.push({
|
||||
id: "useDefault",
|
||||
label: window.siyuan.languages.useDefault,
|
||||
accelerator: showAccelerator ? window.siyuan.languages.click : "",
|
||||
click: () => {
|
||||
|
|
@ -808,6 +819,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
});
|
||||
/// #else
|
||||
submenu.push({
|
||||
id: isInAndroid() || isInHarmony() ? "useDefault" : "useBrowserView",
|
||||
label: isInAndroid() || isInHarmony() ? window.siyuan.languages.useDefault : window.siyuan.languages.useBrowserView,
|
||||
accelerator: showAccelerator ? window.siyuan.languages.click : "",
|
||||
click: () => {
|
||||
|
|
@ -821,6 +833,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
|||
return submenu;
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "openBy",
|
||||
label: window.siyuan.languages.openBy,
|
||||
icon: "iconOpen",
|
||||
submenu
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement
|
|||
window.siyuan.menus.menu.remove();
|
||||
let anchorElement: HTMLInputElement;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "idAndAnchor",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div>ID</div>
|
||||
|
|
@ -265,9 +266,11 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement
|
|||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "turnInto",
|
||||
label: window.siyuan.languages.turnInto,
|
||||
icon: "iconRefresh",
|
||||
submenu: [{
|
||||
id: "text",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.text,
|
||||
click() {
|
||||
|
|
@ -277,6 +280,7 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement
|
|||
oldHTML = nodeElement.outerHTML;
|
||||
}
|
||||
}, {
|
||||
id: "text*",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.text + " *",
|
||||
click() {
|
||||
|
|
@ -289,6 +293,7 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement
|
|||
}]
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "remove",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click() {
|
||||
|
|
@ -349,6 +354,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
window.siyuan.menus.menu.remove();
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "anchor",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<input style="margin: 4px 0" class="b3-text-field fn__block" placeholder="${window.siyuan.languages.anchor}">`,
|
||||
|
|
@ -379,11 +385,13 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "separator_1",
|
||||
type: "separator"
|
||||
}).element);
|
||||
}
|
||||
/// #if !MOBILE
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "openBy",
|
||||
label: window.siyuan.languages.openBy,
|
||||
icon: "iconOpen",
|
||||
accelerator: window.siyuan.config.keymap.editor.general.openBy.custom + "/" + window.siyuan.languages.click,
|
||||
|
|
@ -402,6 +410,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "refTab",
|
||||
label: window.siyuan.languages.refTab,
|
||||
icon: "iconEyeoff",
|
||||
accelerator: window.siyuan.config.keymap.editor.general.refTab.custom + "/" + updateHotkeyTip("⌘" + window.siyuan.languages.click),
|
||||
|
|
@ -418,6 +427,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "insertRight",
|
||||
label: window.siyuan.languages.insertRight,
|
||||
icon: "iconLayoutRight",
|
||||
accelerator: window.siyuan.config.keymap.editor.general.insertRight.custom + "/" + updateHotkeyTip("⌥" + window.siyuan.languages.click),
|
||||
|
|
@ -437,6 +447,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "insertBottom",
|
||||
label: window.siyuan.languages.insertBottom,
|
||||
icon: "iconLayoutBottom",
|
||||
accelerator: window.siyuan.config.keymap.editor.general.insertBottom.custom + (window.siyuan.config.keymap.editor.general.insertBottom.custom ? "/" : "") + updateHotkeyTip("⇧" + window.siyuan.languages.click),
|
||||
|
|
@ -457,6 +468,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}).element);
|
||||
/// #if !BROWSER
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "openByNewWindow",
|
||||
label: window.siyuan.languages.openByNewWindow,
|
||||
icon: "iconOpenWindow",
|
||||
click() {
|
||||
|
|
@ -464,8 +476,9 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
/// #endif
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_2", type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "backlinks",
|
||||
icon: "iconLink",
|
||||
label: window.siyuan.languages.backlinks,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.backlinks.custom,
|
||||
|
|
@ -477,6 +490,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "graphView",
|
||||
icon: "iconGraph",
|
||||
label: window.siyuan.languages.graphView,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.graphView.custom,
|
||||
|
|
@ -487,12 +501,13 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
});
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_3", type: "separator"}).element);
|
||||
/// #endif
|
||||
if (!protyle.disabled) {
|
||||
let submenu: IMenu[] = [];
|
||||
if (element.getAttribute("data-subtype") === "s") {
|
||||
submenu.push({
|
||||
id: "turnToDynamic",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.turnToDynamic,
|
||||
click() {
|
||||
|
|
@ -508,6 +523,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
});
|
||||
} else {
|
||||
submenu.push({
|
||||
id: "turnToStatic",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.turnToStatic,
|
||||
click() {
|
||||
|
|
@ -520,6 +536,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
});
|
||||
}
|
||||
submenu = submenu.concat([{
|
||||
id: "text",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.text,
|
||||
click() {
|
||||
|
|
@ -529,6 +546,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
oldHTML = nodeElement.outerHTML;
|
||||
}
|
||||
}, {
|
||||
id: "*",
|
||||
iconHTML: "",
|
||||
label: "*",
|
||||
click() {
|
||||
|
|
@ -540,6 +558,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
oldHTML = nodeElement.outerHTML;
|
||||
}
|
||||
}, {
|
||||
id: "text*",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.text + " *",
|
||||
click() {
|
||||
|
|
@ -552,6 +571,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
oldHTML = nodeElement.outerHTML;
|
||||
}
|
||||
}, {
|
||||
id: "link",
|
||||
label: window.siyuan.languages.link,
|
||||
iconHTML: "",
|
||||
click() {
|
||||
|
|
@ -564,6 +584,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}]);
|
||||
if (element.parentElement.textContent.trim() === element.textContent.trim() && element.parentElement.tagName === "DIV") {
|
||||
submenu.push({
|
||||
id: "blockEmbed",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.blockEmbed,
|
||||
click() {
|
||||
|
|
@ -576,6 +597,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
});
|
||||
}
|
||||
submenu.push({
|
||||
id: "defBlock",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.defBlock,
|
||||
click() {
|
||||
|
|
@ -587,6 +609,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
});
|
||||
submenu.push({
|
||||
id: "defBlockChildren",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.defBlockChildren,
|
||||
click() {
|
||||
|
|
@ -598,12 +621,14 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
});
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "iconRefresh",
|
||||
label: window.siyuan.languages.turnInto,
|
||||
icon: "iconRefresh",
|
||||
submenu
|
||||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -612,6 +637,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}).element);
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
label: window.siyuan.languages.cut,
|
||||
icon: "iconCut",
|
||||
click() {
|
||||
|
|
@ -626,6 +652,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "remove",
|
||||
label: window.siyuan.languages.remove,
|
||||
icon: "iconTrashcan",
|
||||
click() {
|
||||
|
|
@ -686,6 +713,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
const id = nodeElement.getAttribute("data-node-id");
|
||||
if (range.toString() !== "" || (range.cloneContents().childNodes[0] as HTMLElement)?.classList?.contains("emoji")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
icon: "iconCopy",
|
||||
accelerator: "⌘C",
|
||||
label: window.siyuan.languages.copy,
|
||||
|
|
@ -696,6 +724,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copyPlainText",
|
||||
label: window.siyuan.languages.copyPlainText,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.copyPlainText.custom,
|
||||
click() {
|
||||
|
|
@ -707,6 +736,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
return;
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
icon: "iconCut",
|
||||
accelerator: "⌘X",
|
||||
label: window.siyuan.languages.cut,
|
||||
|
|
@ -716,6 +746,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "delete",
|
||||
icon: "iconTrashcan",
|
||||
accelerator: "⌫",
|
||||
label: window.siyuan.languages.delete,
|
||||
|
|
@ -735,6 +766,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
const inlineTypes = protyle.toolbar.getCurrentType(range);
|
||||
if (inlineTypes.includes("code") || inlineTypes.includes("kbd")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -742,6 +774,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copyPlainText",
|
||||
label: window.siyuan.languages.copyPlainText,
|
||||
click() {
|
||||
copyPlainText(inlineElement.textContent);
|
||||
|
|
@ -750,6 +783,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
if (!protyle.disabled) {
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
icon: "iconCut",
|
||||
label: window.siyuan.languages.cut,
|
||||
click() {
|
||||
|
|
@ -763,6 +797,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "remove",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click() {
|
||||
|
|
@ -782,6 +817,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "paste",
|
||||
label: window.siyuan.languages.paste,
|
||||
icon: "iconPaste",
|
||||
accelerator: "⌘V",
|
||||
|
|
@ -799,6 +835,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "pasteAsPlainText",
|
||||
label: window.siyuan.languages.pasteAsPlainText,
|
||||
accelerator: "⇧⌘V",
|
||||
click() {
|
||||
|
|
@ -807,6 +844,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "pasteEscaped",
|
||||
label: window.siyuan.languages.pasteEscaped,
|
||||
click() {
|
||||
pasteEscaped(protyle, nodeElement);
|
||||
|
|
@ -814,6 +852,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "selectAll",
|
||||
label: window.siyuan.languages.selectAll,
|
||||
icon: "iconSelect",
|
||||
accelerator: "⌘A",
|
||||
|
|
@ -827,6 +866,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
const tableMenus = tableMenu(protyle, nodeElement, cellElement as HTMLTableCellElement, range);
|
||||
if (tableMenus.insertMenus.length > 0) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "separator_1",
|
||||
type: "separator",
|
||||
}).element);
|
||||
tableMenus.insertMenus.forEach((menuItem) => {
|
||||
|
|
@ -835,6 +875,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
}
|
||||
if (tableMenus.removeMenus.length > 0) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "separator_2",
|
||||
type: "separator",
|
||||
}).element);
|
||||
tableMenus.removeMenus.forEach((menuItem) => {
|
||||
|
|
@ -842,9 +883,11 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
});
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "separator_3",
|
||||
type: "separator",
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "more",
|
||||
type: "submenu",
|
||||
icon: "iconMore",
|
||||
label: window.siyuan.languages.more,
|
||||
|
|
@ -1021,6 +1064,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
const html = nodeElement.outerHTML;
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "imageUrlAndTitleAndTooltipText",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div class="fn__flex">
|
||||
|
|
@ -1086,9 +1130,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
});
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_1", type: "separator"}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
accelerator: "⌘C",
|
||||
icon: "iconCopy",
|
||||
|
|
@ -1101,6 +1146,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}).element);
|
||||
if (protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copyImageURL",
|
||||
label: window.siyuan.languages.copy + " " + window.siyuan.languages.imageURL,
|
||||
icon: "iconLink",
|
||||
click() {
|
||||
|
|
@ -1109,6 +1155,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copyAsPNG",
|
||||
label: window.siyuan.languages.copyAsPNG,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.copyBlockRef.custom,
|
||||
icon: "iconImage",
|
||||
|
|
@ -1118,6 +1165,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}).element);
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
icon: "iconCut",
|
||||
accelerator: "⌘X",
|
||||
label: window.siyuan.languages.cut,
|
||||
|
|
@ -1133,6 +1181,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "delete",
|
||||
icon: "iconTrashcan",
|
||||
accelerator: "⌫",
|
||||
label: window.siyuan.languages.delete,
|
||||
|
|
@ -1143,10 +1192,11 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_2", type: "separator"}).element);
|
||||
const imagePath = imgElement.getAttribute("data-src");
|
||||
if (imagePath.startsWith("assets/")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "rename",
|
||||
label: window.siyuan.languages.rename,
|
||||
icon: "iconEdit",
|
||||
click() {
|
||||
|
|
@ -1155,8 +1205,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "ocr",
|
||||
label: "OCR",
|
||||
submenu: [{
|
||||
id: "ocrResult",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<textarea spellcheck="false" data-type="ocr" style="margin: 4px 0" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.ocrResult}"></textarea>`,
|
||||
|
|
@ -1173,6 +1225,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}, {
|
||||
type: "separator"
|
||||
}, {
|
||||
id: "reOCR",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.reOCR,
|
||||
click() {
|
||||
|
|
@ -1184,6 +1237,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}],
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "alignCenter",
|
||||
icon: "iconAlignCenter",
|
||||
label: window.siyuan.languages.alignCenter,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.alignCenter.custom,
|
||||
|
|
@ -1192,6 +1246,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "alignLeft",
|
||||
icon: "iconAlignLeft",
|
||||
label: window.siyuan.languages.alignLeft,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.alignLeft.custom,
|
||||
|
|
@ -1201,8 +1256,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}).element);
|
||||
let rangeElement: HTMLInputElement;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "width",
|
||||
label: window.siyuan.languages.width,
|
||||
submenu: [{
|
||||
id: "widthInput",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div class="fn__flex-center">
|
||||
|
|
@ -1235,8 +1292,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
genImageWidthMenu("67%", imgElement, protyle, id, nodeElement, html),
|
||||
genImageWidthMenu("75%", imgElement, protyle, id, nodeElement, html),
|
||||
genImageWidthMenu("100%", imgElement, protyle, id, nodeElement, html), {
|
||||
id: "separator_1",
|
||||
type: "separator",
|
||||
}, {
|
||||
id: "widthDrag",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div style="margin: 4px 0;" aria-label="${imgElement.parentElement.style.width ? imgElement.parentElement.style.width.replace("vw", "%").replace("calc(", "").replace(" - 8px)", "") : window.siyuan.languages.default}" class="b3-tooltips b3-tooltips__n${isMobile() ? "" : " fn__size200"}">
|
||||
|
|
@ -1258,6 +1317,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
});
|
||||
}
|
||||
}, {
|
||||
id: "separator_2",
|
||||
type: "separator",
|
||||
},
|
||||
genImageWidthMenu(window.siyuan.languages.default, imgElement, protyle, id, nodeElement, html),
|
||||
|
|
@ -1265,8 +1325,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}).element);
|
||||
let rangeHeightElement: HTMLInputElement;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "height",
|
||||
label: window.siyuan.languages.height,
|
||||
submenu: [{
|
||||
id: "heightInput",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div class="fn__flex-center">
|
||||
|
|
@ -1299,8 +1361,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
genImageHeightMenu("67%", imgElement, protyle, id, nodeElement, html),
|
||||
genImageHeightMenu("75%", imgElement, protyle, id, nodeElement, html),
|
||||
genImageHeightMenu("100%", imgElement, protyle, id, nodeElement, html), {
|
||||
id: "separator_1",
|
||||
type: "separator",
|
||||
}, {
|
||||
id: "heightDrag",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div style="margin: 4px 0;" aria-label="${imgElement.style.height ? imgElement.style.height.replace("vh", "%") : window.siyuan.languages.default}" class="b3-tooltips b3-tooltips__n${isMobile() ? "" : " fn__size200"}">
|
||||
|
|
@ -1322,6 +1386,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
});
|
||||
}
|
||||
}, {
|
||||
id: "separator_2",
|
||||
type: "separator",
|
||||
},
|
||||
genImageHeightMenu(window.siyuan.languages.default, imgElement, protyle, id, nodeElement, html),
|
||||
|
|
@ -1330,7 +1395,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}
|
||||
const imgSrc = imgElement.getAttribute("src");
|
||||
if (imgSrc) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_3", type: "separator"}).element);
|
||||
openMenu(protyle.app, imgSrc, false, false);
|
||||
}
|
||||
const dataSrc = imgElement.getAttribute("data-src");
|
||||
|
|
@ -1388,6 +1453,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
let inputElements: NodeListOf<HTMLTextAreaElement>;
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "linkAndAnchorAndTitle",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div class="fn__flex">
|
||||
|
|
@ -1499,9 +1565,10 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
});
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_1", type: "separator"}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -1513,6 +1580,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}).element);
|
||||
if (protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copyAHref",
|
||||
label: window.siyuan.languages.copy + " " + window.siyuan.languages.replaceTypes.aHref,
|
||||
icon: "iconLink",
|
||||
click() {
|
||||
|
|
@ -1522,6 +1590,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
icon: "iconCut",
|
||||
label: window.siyuan.languages.cut,
|
||||
click() {
|
||||
|
|
@ -1532,6 +1601,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "remove",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click() {
|
||||
|
|
@ -1545,6 +1615,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}).element);
|
||||
if (linkAddress?.startsWith("assets/")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "rename",
|
||||
label: window.siyuan.languages.rename,
|
||||
icon: "iconEdit",
|
||||
click() {
|
||||
|
|
@ -1554,6 +1625,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}
|
||||
if (linkAddress?.startsWith("siyuan://blocks/")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "turnIntoRef",
|
||||
label: `${window.siyuan.languages.turnInto} <b>${window.siyuan.languages.ref}</b>`,
|
||||
icon: "iconRef",
|
||||
click() {
|
||||
|
|
@ -1577,6 +1649,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "turnIntoText",
|
||||
label: `${window.siyuan.languages.turnInto} <b>${window.siyuan.languages.text}</b>`,
|
||||
icon: "iconRefresh",
|
||||
click() {
|
||||
|
|
@ -1591,7 +1664,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}
|
||||
|
||||
if (linkAddress) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_2", type: "separator"}).element);
|
||||
openMenu(protyle.app, linkAddress, false, true);
|
||||
if (linkAddress?.startsWith("assets/")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem(exportAsset(linkAddress)).element);
|
||||
|
|
@ -1659,6 +1732,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
|||
const id = nodeElement.getAttribute("data-node-id");
|
||||
let html = nodeElement.outerHTML;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "tag",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<input class="b3-text-field fn__size200" style="margin: 4px 0" placeholder="${window.siyuan.languages.tag}">`,
|
||||
|
|
@ -1701,9 +1775,10 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
|||
});
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({id: "separator_1", type: "separator"}).element);
|
||||
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "search",
|
||||
label: window.siyuan.languages.search,
|
||||
accelerator: window.siyuan.languages.click,
|
||||
icon: "iconSearch",
|
||||
|
|
@ -1724,14 +1799,16 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "rename",
|
||||
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({id: "separator_2", type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "turnIntoText",
|
||||
label: `${window.siyuan.languages.turnInto} <b>${window.siyuan.languages.text}</b>`,
|
||||
icon: "iconRefresh",
|
||||
click() {
|
||||
|
|
@ -1741,6 +1818,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -1751,6 +1829,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
label: window.siyuan.languages.cut,
|
||||
icon: "iconCut",
|
||||
click() {
|
||||
|
|
@ -1761,6 +1840,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "remove",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click() {
|
||||
|
|
@ -1805,6 +1885,7 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
|
|||
const id = nodeElement.getAttribute("data-node-id");
|
||||
const html = nodeElement.outerHTML;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -1816,6 +1897,7 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
|
|||
}).element);
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
icon: "iconCut",
|
||||
label: window.siyuan.languages.cut,
|
||||
click() {
|
||||
|
|
@ -1826,6 +1908,7 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "remove",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click() {
|
||||
|
|
@ -1847,6 +1930,7 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
|
|||
|
||||
const genImageWidthMenu = (label: string, imgElement: HTMLElement, protyle: IProtyle, id: string, nodeElement: HTMLElement, html: string) => {
|
||||
return {
|
||||
id: label === window.siyuan.languages.default ? "default" : "width_" + label,
|
||||
iconHTML: "",
|
||||
label,
|
||||
click() {
|
||||
|
|
@ -1862,6 +1946,7 @@ const genImageWidthMenu = (label: string, imgElement: HTMLElement, protyle: IPro
|
|||
|
||||
const genImageHeightMenu = (label: string, imgElement: HTMLElement, protyle: IProtyle, id: string, nodeElement: HTMLElement, html: string) => {
|
||||
return {
|
||||
id: label === window.siyuan.languages.default ? "default" : "width_" + label,
|
||||
iconHTML: "",
|
||||
label,
|
||||
click() {
|
||||
|
|
@ -1998,6 +2083,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
const colIndex = getColIndex(cellElement);
|
||||
if (cellElement.rowSpan > 1 || cellElement.colSpan > 1) {
|
||||
otherMenus.push({
|
||||
id: "cancelMerged",
|
||||
label: window.siyuan.languages.cancelMerged,
|
||||
click: () => {
|
||||
const oldHTML = nodeElement.outerHTML;
|
||||
|
|
@ -2048,6 +2134,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
const thMatchElement = nodeElement.querySelectorAll("col")[colIndex];
|
||||
if (thMatchElement.style.width || thMatchElement.style.minWidth) {
|
||||
otherMenus.push({
|
||||
id: "useDefaultWidth",
|
||||
label: window.siyuan.languages.useDefaultWidth,
|
||||
click: () => {
|
||||
const html = nodeElement.outerHTML;
|
||||
|
|
@ -2059,6 +2146,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
const isPinHead = nodeElement.getAttribute("custom-pinthead");
|
||||
otherMenus.push({
|
||||
id: isPinHead ? "unpinTableHead" : "pinTableHead",
|
||||
icon: isPinHead ? "iconUnpin" : "iconPin",
|
||||
label: isPinHead ? window.siyuan.languages.unpinTableHead : window.siyuan.languages.pinTableHead,
|
||||
click: () => {
|
||||
|
|
@ -2071,8 +2159,9 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
|
||||
}
|
||||
});
|
||||
otherMenus.push({type: "separator"});
|
||||
otherMenus.push({id: "separator_1", type: "separator"});
|
||||
otherMenus.push({
|
||||
id: "alignLeft",
|
||||
icon: "iconAlignLeft",
|
||||
accelerator: window.siyuan.config.keymap.editor.general.alignLeft.custom,
|
||||
label: window.siyuan.languages.alignLeft,
|
||||
|
|
@ -2081,6 +2170,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
});
|
||||
otherMenus.push({
|
||||
id: "alignCenter",
|
||||
icon: "iconAlignCenter",
|
||||
label: window.siyuan.languages.alignCenter,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.alignCenter.custom,
|
||||
|
|
@ -2089,6 +2179,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
});
|
||||
otherMenus.push({
|
||||
id: "alignRight",
|
||||
icon: "iconAlignRight",
|
||||
label: window.siyuan.languages.alignRight,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.alignRight.custom,
|
||||
|
|
@ -2097,6 +2188,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
});
|
||||
otherMenus.push({
|
||||
id: "useDefaultAlign",
|
||||
icon: "",
|
||||
label: window.siyuan.languages.useDefaultAlign,
|
||||
click: () => {
|
||||
|
|
@ -2182,6 +2274,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
});
|
||||
const insertMenus = [];
|
||||
insertMenus.push({
|
||||
id: "insertRowAbove",
|
||||
icon: "iconBefore",
|
||||
label: window.siyuan.languages.insertRowAbove,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.insertRowAbove.custom,
|
||||
|
|
@ -2191,6 +2284,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
});
|
||||
if (!nextHasNone || (nextHasNone && !nextHasRowSpan && nextHasColSpan)) {
|
||||
insertMenus.push({
|
||||
id: "insertRowBelow",
|
||||
icon: "iconAfter",
|
||||
label: window.siyuan.languages.insertRowBelow,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.insertRowBelow.custom,
|
||||
|
|
@ -2201,6 +2295,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
if (colIsPure || previousColIsPure) {
|
||||
insertMenus.push({
|
||||
id: "insertColumnLeft",
|
||||
icon: "iconInsertLeft",
|
||||
label: window.siyuan.languages.insertColumnLeft,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.insertColumnLeft.custom,
|
||||
|
|
@ -2211,6 +2306,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
if (colIsPure || nextColIsPure) {
|
||||
insertMenus.push({
|
||||
id: "insertColumnRight",
|
||||
icon: "iconInsertRight",
|
||||
label: window.siyuan.languages.insertColumnRight,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.insertColumnRight.custom,
|
||||
|
|
@ -2229,6 +2325,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
(colIsPure && nextColIsPure)
|
||||
) {
|
||||
other2Menus.push({
|
||||
id: "separator_2",
|
||||
type: "separator"
|
||||
});
|
||||
}
|
||||
|
|
@ -2236,6 +2333,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
if ((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&
|
||||
(!previousHasNone || (previousHasNone && !previousHasRowSpan && previousHasColSpan))) {
|
||||
other2Menus.push({
|
||||
id: "moveToUp",
|
||||
icon: "iconUp",
|
||||
label: window.siyuan.languages.moveToUp,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.moveToUp.custom,
|
||||
|
|
@ -2247,6 +2345,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
if ((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&
|
||||
(!nextHasNone || (nextHasNone && !nextHasRowSpan && nextHasColSpan))) {
|
||||
other2Menus.push({
|
||||
id: "moveToDown",
|
||||
icon: "iconDown",
|
||||
label: window.siyuan.languages.moveToDown,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.moveToDown.custom,
|
||||
|
|
@ -2257,6 +2356,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
if (colIsPure && previousColIsPure) {
|
||||
other2Menus.push({
|
||||
id: "moveToLeft",
|
||||
icon: "iconLeft",
|
||||
label: window.siyuan.languages.moveToLeft,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.moveToLeft.custom,
|
||||
|
|
@ -2267,6 +2367,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
if (colIsPure && nextColIsPure) {
|
||||
other2Menus.push({
|
||||
id: "moveToRight",
|
||||
icon: "iconRight",
|
||||
label: window.siyuan.languages.moveToRight,
|
||||
accelerator: window.siyuan.config.keymap.editor.table.moveToRight.custom,
|
||||
|
|
@ -2286,6 +2387,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
if (cellElement.parentElement.parentElement.tagName !== "THEAD" &&
|
||||
((!hasNone && !hasRowSpan) || (hasNone && !hasRowSpan && hasColSpan))) {
|
||||
removeMenus.push({
|
||||
id: "deleteRow",
|
||||
icon: "iconDeleteRow",
|
||||
label: window.siyuan.languages["delete-row"],
|
||||
accelerator: window.siyuan.config.keymap.editor.table["delete-row"].custom,
|
||||
|
|
@ -2296,6 +2398,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
if (colIsPure) {
|
||||
removeMenus.push({
|
||||
id: "deleteColumn",
|
||||
icon: "iconDeleteColumn",
|
||||
label: window.siyuan.languages["delete-column"],
|
||||
accelerator: window.siyuan.config.keymap.editor.table["delete-column"].custom,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {copySubMenu} from "./commonMenuItem";
|
|||
export const initSearchMenu = (id: string) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
type: "submenu",
|
||||
submenu: copySubMenu([id])
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export const textMenu = (target: Element) => {
|
|||
return;
|
||||
}
|
||||
menu.addItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -20,6 +21,7 @@ export const textMenu = (target: Element) => {
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "selectAll",
|
||||
label: window.siyuan.languages.selectAll,
|
||||
icon: "iconSelect",
|
||||
click() {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import {checkFold} from "../util/noRelyPCFunction";
|
|||
|
||||
export const exportAsset = (src: string) => {
|
||||
return {
|
||||
id: "export",
|
||||
label: window.siyuan.languages.export,
|
||||
icon: "iconUpload",
|
||||
async click() {
|
||||
|
|
|
|||
|
|
@ -34,13 +34,16 @@ export class Menu {
|
|||
return this.menu.addItem(option);
|
||||
}
|
||||
|
||||
addSeparator(index?: number, ignore = false) {
|
||||
addSeparator(index?: number, ignore = false, id?: string) {
|
||||
if (ignore) {
|
||||
return;
|
||||
}
|
||||
if (this.isOpen) {
|
||||
return;
|
||||
}
|
||||
if (id) {
|
||||
return this.menu.addSeparator(index, id);
|
||||
}
|
||||
return this.menu.addSeparator(index);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2160,7 +2160,7 @@ export class Gutter {
|
|||
});
|
||||
const width = firstElement.style.width.endsWith("%") ? parseInt(firstElement.style.width) : 0;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "widthDrag",
|
||||
id: "width",
|
||||
label: window.siyuan.languages.width,
|
||||
submenu: styles.concat([{
|
||||
id: "widthDrag",
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ export class Title {
|
|||
const range = getEditorRange(this.editElement);
|
||||
if (range.toString() !== "") {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
icon: "iconCopy",
|
||||
accelerator: "⌘C",
|
||||
label: window.siyuan.languages.copy,
|
||||
|
|
@ -204,6 +205,7 @@ export class Title {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "cut",
|
||||
icon: "iconCut",
|
||||
accelerator: "⌘X",
|
||||
label: window.siyuan.languages.cut,
|
||||
|
|
@ -216,6 +218,7 @@ export class Title {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "delete",
|
||||
icon: "iconTrashcan",
|
||||
accelerator: "⌫",
|
||||
label: window.siyuan.languages.delete,
|
||||
|
|
@ -230,6 +233,7 @@ export class Title {
|
|||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "paste",
|
||||
label: window.siyuan.languages.paste,
|
||||
icon: "iconPaste",
|
||||
accelerator: "⌘V",
|
||||
|
|
@ -249,6 +253,7 @@ export class Title {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "pasteAsPlainText",
|
||||
label: window.siyuan.languages.pasteAsPlainText,
|
||||
accelerator: "⇧⌘V",
|
||||
click: async () => {
|
||||
|
|
@ -265,6 +270,7 @@ export class Title {
|
|||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "selectAll",
|
||||
label: window.siyuan.languages.selectAll,
|
||||
icon: "iconSelect",
|
||||
accelerator: "⌘A",
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
const openSubmenus = openEditorTab(protyle.app, [blockId], undefined, undefined, true);
|
||||
openSubmenus.push({id: "separator_3", type: "separator"});
|
||||
openSubmenus.push({
|
||||
id: "attr",
|
||||
icon: "iconAttr",
|
||||
label: window.siyuan.languages.attr,
|
||||
click: () => {
|
||||
|
|
@ -310,6 +311,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
}
|
||||
});
|
||||
const copyMenu: IMenu[] = [{
|
||||
id: "copyKeyContent",
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.copyKeyContent,
|
||||
click() {
|
||||
|
|
@ -474,6 +476,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
}
|
||||
|
||||
menu.addItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
type: "submenu",
|
||||
|
|
@ -481,6 +484,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
});
|
||||
if (!protyle.disabled) {
|
||||
menu.addItem({
|
||||
id: "addToDatabase",
|
||||
label: window.siyuan.languages.addToDatabase,
|
||||
icon: "iconDatabase",
|
||||
click() {
|
||||
|
|
@ -518,9 +522,10 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
|
|||
});
|
||||
if (rowElements.length === 1) {
|
||||
if (keyCellElement.getAttribute("data-detached") !== "true") {
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "1");
|
||||
}
|
||||
menu.addItem({
|
||||
id: "insertRowBefore",
|
||||
icon: "iconBefore",
|
||||
label: `<div class="fn__flex" style="align-items: center;">
|
||||
${window.siyuan.languages.insertRowBefore.replace("${x}", `<span class="fn__space"></span><input style="width:64px" type="number" step="1" min="1" value="1" placeholder="${window.siyuan.languages.enterKey}" class="b3-text-field"><span class="fn__space"></span>`)}
|
||||
|
|
@ -543,6 +548,7 @@ ${window.siyuan.languages.insertRowBefore.replace("${x}", `<span class="fn__spac
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "insertRowAfter",
|
||||
icon: "iconAfter",
|
||||
label: `<div class="fn__flex" style="align-items: center;">
|
||||
${window.siyuan.languages.insertRowAfter.replace("${x}", `<span class="fn__space"></span><input style="width:64px" type="number" step="1" min="1" placeholder="${window.siyuan.languages.enterKey}" class="b3-text-field" value="1"><span class="fn__space"></span>`)}
|
||||
|
|
@ -564,9 +570,10 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", `<span class="fn__space
|
|||
});
|
||||
}
|
||||
});
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "2");
|
||||
if (keyCellElement.getAttribute("data-detached") !== "true") {
|
||||
menu.addItem({
|
||||
id: "unbindBlock",
|
||||
label: window.siyuan.languages.unbindBlock,
|
||||
icon: "iconLinkOff",
|
||||
click() {
|
||||
|
|
@ -578,6 +585,7 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", `<span class="fn__space
|
|||
}
|
||||
}
|
||||
menu.addItem({
|
||||
id: "delete",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.delete,
|
||||
click() {
|
||||
|
|
@ -600,6 +608,7 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", `<span class="fn__space
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "fields",
|
||||
icon: "iconAttr",
|
||||
label: window.siyuan.languages.fields,
|
||||
type: "submenu",
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ export const editAssetItem = (options: {
|
|||
}
|
||||
if (type === "file") {
|
||||
menu.addItem({
|
||||
id: "linkAndTitle",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div class="fn__flex">
|
||||
|
|
@ -243,8 +244,9 @@ export const editAssetItem = (options: {
|
|||
});
|
||||
}
|
||||
});
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "1");
|
||||
menu.addItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -253,6 +255,7 @@ export const editAssetItem = (options: {
|
|||
});
|
||||
} else {
|
||||
menu.addItem({
|
||||
id: "link",
|
||||
iconHTML: "",
|
||||
type: "readonly",
|
||||
label: `<div class="fn__flex">
|
||||
|
|
@ -277,8 +280,9 @@ export const editAssetItem = (options: {
|
|||
});
|
||||
}
|
||||
});
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "1");
|
||||
menu.addItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
|
|
@ -286,6 +290,7 @@ export const editAssetItem = (options: {
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "copyAsPNG",
|
||||
label: window.siyuan.languages.copyAsPNG,
|
||||
icon: "iconImage",
|
||||
click() {
|
||||
|
|
@ -294,6 +299,7 @@ export const editAssetItem = (options: {
|
|||
});
|
||||
}
|
||||
menu.addItem({
|
||||
id: "delete",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.delete,
|
||||
click() {
|
||||
|
|
@ -307,6 +313,7 @@ export const editAssetItem = (options: {
|
|||
});
|
||||
if (linkAddress?.startsWith("assets/")) {
|
||||
menu.addItem({
|
||||
id: "rename",
|
||||
label: window.siyuan.languages.rename,
|
||||
icon: "iconEdit",
|
||||
click() {
|
||||
|
|
@ -317,10 +324,11 @@ export const editAssetItem = (options: {
|
|||
}
|
||||
const openSubMenu = openMenu(options.protyle ? options.protyle.app : window.siyuan.ws.app, linkAddress, true, false);
|
||||
if (type !== "file" || openSubMenu.length > 0) {
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "2");
|
||||
}
|
||||
if (type !== "file") {
|
||||
menu.addItem({
|
||||
id: "cardPreview",
|
||||
icon: "iconPreview",
|
||||
label: window.siyuan.languages.cardPreview,
|
||||
click() {
|
||||
|
|
@ -330,6 +338,7 @@ export const editAssetItem = (options: {
|
|||
}
|
||||
if (openSubMenu.length > 0) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "openBy",
|
||||
label: window.siyuan.languages.openBy,
|
||||
icon: "iconOpen",
|
||||
submenu: openSubMenu
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export const getEditHTML = (options: {
|
|||
</span>
|
||||
<span class="b3-menu__label ft__center">${window.siyuan.languages.edit}</span>
|
||||
</button>
|
||||
<button class="b3-menu__separator"></button>
|
||||
<button class="b3-menu__separator" data-id="separator_1"></button>
|
||||
<button class="b3-menu__item" data-type="nobg">
|
||||
<div class="fn__block">
|
||||
<div class="fn__flex">
|
||||
|
|
@ -111,7 +111,7 @@ export const getEditHTML = (options: {
|
|||
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
|
||||
</button>`;
|
||||
if (["mSelect", "select"].includes(colData.type)) {
|
||||
html += `<button class="b3-menu__separator"></button>
|
||||
html += `<button class="b3-menu__separator" data-id="separator_2"></button>
|
||||
<button class="b3-menu__item" data-type="nobg">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconAdd"></use></svg>
|
||||
<input data-type="addOption" class="b3-text-field fn__block" type="text" placeholder="${window.siyuan.languages.enterKey} ${window.siyuan.languages.addAttr}" style="margin: 4px 0">
|
||||
|
|
@ -132,20 +132,20 @@ export const getEditHTML = (options: {
|
|||
</button>`;
|
||||
});
|
||||
} else if (colData.type === "number") {
|
||||
html += `<button class="b3-menu__separator"></button>
|
||||
html += `<button class="b3-menu__separator" data-id="separator_2"></button>
|
||||
<button class="b3-menu__item" data-type="numberFormat" data-format="${colData.numberFormat}">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconFormat"></use></svg>
|
||||
<span class="b3-menu__label">${window.siyuan.languages.format}</span>
|
||||
<span class="b3-menu__accelerator">${getLabelByNumberFormat(colData.numberFormat)}</span>
|
||||
</button>`;
|
||||
} else if (colData.type === "template") {
|
||||
html += `<button class="b3-menu__separator"></button>
|
||||
html += `<button class="b3-menu__separator" data-id="separator_2"></button>
|
||||
<button class="b3-menu__item" data-type="nobg">
|
||||
<textarea spellcheck="false" rows="${Math.min(colData.template.split("\n").length, 8)}" placeholder="${window.siyuan.languages.template}" data-type="updateTemplate" style="margin: 4px 0" rows="1" class="fn__block b3-text-field">${colData.template}</textarea>
|
||||
</button>`;
|
||||
} else if (colData.type === "relation") {
|
||||
const isSelf = colData.relation?.avID === options.data.id;
|
||||
html += `<button class="b3-menu__separator"></button>
|
||||
html += `<button class="b3-menu__separator" data-id="separator_2"></button>
|
||||
<button class="b3-menu__item" data-type="goSearchAV" data-av-id="${colData.relation?.avID || ""}" data-old-value='${JSON.stringify(colData.relation || {})}'>
|
||||
<span class="b3-menu__label">${window.siyuan.languages.relatedTo}</span>
|
||||
<span class="b3-menu__accelerator">${isSelf ? window.siyuan.languages.thisDatabase : ""}</span>
|
||||
|
|
@ -164,9 +164,9 @@ export const getEditHTML = (options: {
|
|||
<button style="margin: 4px 0 8px;" class="b3-button fn__block" data-type="updateRelation">${window.siyuan.languages.confirm}</button>
|
||||
</div>`;
|
||||
} else if (colData.type === "rollup") {
|
||||
html += '<button class="b3-menu__separator"></button>' + getRollupHTML({colData});
|
||||
html += '<button class="b3-menu__separator" data-id="separator_2"></button>' + getRollupHTML({colData});
|
||||
} else if (colData.type === "date") {
|
||||
html += `<button class="b3-menu__separator"></button>
|
||||
html += `<button class="b3-menu__separator" data-id="separator_2"></button>
|
||||
<label class="b3-menu__item">
|
||||
<span class="fn__flex-center">${window.siyuan.languages.fillCreated}</span>
|
||||
<span class="fn__space fn__flex-1"></span>
|
||||
|
|
@ -174,7 +174,7 @@ export const getEditHTML = (options: {
|
|||
</label>`;
|
||||
}
|
||||
if (colData.type !== "block") {
|
||||
html += `<button class="b3-menu__separator"></button>
|
||||
html += `<button class="b3-menu__separator" data-id="separator_3"></button>
|
||||
<button class="b3-menu__item" data-type="${colData.hidden ? "showCol" : "hideCol"}">
|
||||
<svg class="b3-menu__icon" style=""><use xlink:href="#icon${colData.hidden ? "Eye" : "Eyeoff"}"></use></svg>
|
||||
<span class="b3-menu__label">${colData.hidden ? window.siyuan.languages.showCol : window.siyuan.languages.hideCol}</span>
|
||||
|
|
@ -190,8 +190,8 @@ export const getEditHTML = (options: {
|
|||
}
|
||||
return `<div class="b3-menu__items">
|
||||
${html}
|
||||
<button class="b3-menu__separator"></button>
|
||||
<label class="b3-menu__item">
|
||||
<button class="b3-menu__separator" data-id="separator_4"></button>
|
||||
<label class="b3-menu__item" data-type="wrap">
|
||||
<span class="fn__flex-center">${window.siyuan.languages.wrap}</span>
|
||||
<span class="fn__space fn__flex-1"></span>
|
||||
<input data-type="wrap" type="checkbox" class="b3-switch b3-switch--menu" ${colData.wrap ? " checked" : ""}>
|
||||
|
|
@ -742,6 +742,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "edit",
|
||||
icon: "iconEdit",
|
||||
label: window.siyuan.languages.edit,
|
||||
click() {
|
||||
|
|
@ -760,11 +761,12 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
});
|
||||
}
|
||||
});
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "1");
|
||||
|
||||
// 行号 类型不参与 排序和筛选
|
||||
if (type !== "lineNumber") {
|
||||
menu.addItem({
|
||||
id: "asc",
|
||||
icon: "iconUp",
|
||||
label: window.siyuan.languages.asc,
|
||||
click() {
|
||||
|
|
@ -789,6 +791,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "desc",
|
||||
icon: "iconDown",
|
||||
label: window.siyuan.languages.desc,
|
||||
click() {
|
||||
|
|
@ -814,6 +817,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
});
|
||||
if (type !== "mAsset") {
|
||||
menu.addItem({
|
||||
id: "filter",
|
||||
icon: "iconFilter",
|
||||
label: window.siyuan.languages.filter,
|
||||
click() {
|
||||
|
|
@ -847,9 +851,10 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
}
|
||||
});
|
||||
}
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "2");
|
||||
}
|
||||
menu.addItem({
|
||||
id: "insertColumnLeft",
|
||||
icon: "iconInsertLeft",
|
||||
label: window.siyuan.languages.insertColumnLeft,
|
||||
click() {
|
||||
|
|
@ -866,6 +871,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "insertColumnRight",
|
||||
icon: "iconInsertRight",
|
||||
label: window.siyuan.languages.insertColumnRight,
|
||||
click() {
|
||||
|
|
@ -883,6 +889,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
});
|
||||
if (type !== "block") {
|
||||
menu.addItem({
|
||||
id: "hide",
|
||||
icon: "iconEyeoff",
|
||||
label: window.siyuan.languages.hide,
|
||||
click() {
|
||||
|
|
@ -904,6 +911,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
}
|
||||
const isPin = cellElement.dataset.pin === "true";
|
||||
menu.addItem({
|
||||
id: isPin ? "unfreezeCol" : "freezeCol",
|
||||
icon: isPin ? "iconUnpin" : "iconPin",
|
||||
label: isPin ? window.siyuan.languages.unfreezeCol : window.siyuan.languages.freezeCol,
|
||||
click() {
|
||||
|
|
@ -926,6 +934,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
if (type !== "block") {
|
||||
if (type !== "relation") {
|
||||
menu.addItem({
|
||||
id: "duplicate",
|
||||
icon: "iconCopy",
|
||||
label: window.siyuan.languages.duplicate,
|
||||
click() {
|
||||
|
|
@ -944,6 +953,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
});
|
||||
}
|
||||
menu.addItem({
|
||||
id: "delete",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.delete,
|
||||
async click() {
|
||||
|
|
@ -1024,9 +1034,10 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
});
|
||||
}
|
||||
});
|
||||
menu.addSeparator();
|
||||
menu.addSeparator(undefined, undefined, "3");
|
||||
}
|
||||
menu.addItem({
|
||||
id: "wrap",
|
||||
label: `<label class="fn__flex"><span class="fn__flex-center">${window.siyuan.languages.wrap}</span><span class="fn__space fn__flex-1"></span>
|
||||
<input type="checkbox" class="b3-switch b3-switch--menu"${cellElement.dataset.wrap === "true" ? " checked" : ""}></label>`,
|
||||
bind(element) {
|
||||
|
|
@ -1170,6 +1181,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
const blockId = blockElement.getAttribute("data-node-id");
|
||||
menu.addItem({
|
||||
id: "text",
|
||||
icon: "iconAlignLeft",
|
||||
label: window.siyuan.languages.text,
|
||||
click() {
|
||||
|
|
@ -1207,6 +1219,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "number",
|
||||
icon: "iconNumber",
|
||||
label: window.siyuan.languages.number,
|
||||
click() {
|
||||
|
|
@ -1244,6 +1257,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "select",
|
||||
icon: "iconListItem",
|
||||
label: window.siyuan.languages.select,
|
||||
click() {
|
||||
|
|
@ -1281,6 +1295,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "multiSelect",
|
||||
icon: "iconList",
|
||||
label: window.siyuan.languages.multiSelect,
|
||||
click() {
|
||||
|
|
@ -1318,6 +1333,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "date",
|
||||
icon: "iconCalendar",
|
||||
label: window.siyuan.languages.date,
|
||||
click() {
|
||||
|
|
@ -1355,6 +1371,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "assets",
|
||||
icon: "iconImage",
|
||||
label: window.siyuan.languages.assets,
|
||||
click() {
|
||||
|
|
@ -1392,6 +1409,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "checkbox",
|
||||
icon: "iconCheck",
|
||||
label: window.siyuan.languages.checkbox,
|
||||
click() {
|
||||
|
|
@ -1429,6 +1447,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "link",
|
||||
icon: "iconLink",
|
||||
label: window.siyuan.languages.link,
|
||||
click() {
|
||||
|
|
@ -1466,6 +1485,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "email",
|
||||
icon: "iconEmail",
|
||||
label: window.siyuan.languages.email,
|
||||
click() {
|
||||
|
|
@ -1503,6 +1523,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "phone",
|
||||
icon: "iconPhone",
|
||||
label: window.siyuan.languages.phone,
|
||||
click() {
|
||||
|
|
@ -1540,6 +1561,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "template",
|
||||
icon: "iconMath",
|
||||
label: window.siyuan.languages.template,
|
||||
click() {
|
||||
|
|
@ -1577,6 +1599,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "relation",
|
||||
icon: "iconOpen",
|
||||
label: window.siyuan.languages.relation,
|
||||
click() {
|
||||
|
|
@ -1614,6 +1637,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "rollup",
|
||||
icon: "iconSearch",
|
||||
label: window.siyuan.languages.rollup,
|
||||
click() {
|
||||
|
|
@ -1652,6 +1676,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
});
|
||||
// 在创建时间前插入 lineNumber
|
||||
menu.addItem({
|
||||
id: "lineNumber",
|
||||
icon: "iconOrderedList",
|
||||
label: window.siyuan.languages.lineNumber,
|
||||
click() {
|
||||
|
|
@ -1689,6 +1714,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "createdTime",
|
||||
icon: "iconClock",
|
||||
label: window.siyuan.languages.createdTime,
|
||||
click() {
|
||||
|
|
@ -1726,6 +1752,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "updatedTime",
|
||||
icon: "iconClock",
|
||||
label: window.siyuan.languages.updatedTime,
|
||||
click() {
|
||||
|
|
|
|||
|
|
@ -264,6 +264,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "delete",
|
||||
label: window.siyuan.languages.delete,
|
||||
icon: "iconTrashcan",
|
||||
click() {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle
|
|||
return;
|
||||
}
|
||||
menu.addItem({
|
||||
id: "rename",
|
||||
icon: "iconEdit",
|
||||
label: window.siyuan.languages.rename,
|
||||
click() {
|
||||
|
|
@ -32,6 +33,7 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle
|
|||
}
|
||||
});
|
||||
menu.addItem({
|
||||
id: "config",
|
||||
icon: "iconSettings",
|
||||
label: window.siyuan.languages.config,
|
||||
click() {
|
||||
|
|
@ -45,6 +47,7 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle
|
|||
});
|
||||
menu.addSeparator();
|
||||
menu.addItem({
|
||||
id: "duplicate",
|
||||
icon: "iconCopy",
|
||||
label: window.siyuan.languages.duplicate,
|
||||
click() {
|
||||
|
|
@ -67,6 +70,7 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEle
|
|||
});
|
||||
if (options.blockElement.querySelectorAll(".layout-tab-bar .item").length > 1) {
|
||||
menu.addItem({
|
||||
id: "delete",
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.delete,
|
||||
click() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue