This commit is contained in:
parent
466717aaac
commit
1cac92c0c8
6 changed files with 9 additions and 13 deletions
|
@ -555,20 +555,16 @@ export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "b
|
|||
});
|
||||
};
|
||||
|
||||
export const copySubMenu = (id: string, name: string, accelerator = true, focusElement?: Element) => {
|
||||
export const copySubMenu = (id: string, accelerator = true, focusElement?: Element) => {
|
||||
return [
|
||||
{
|
||||
icon: "iconGraph",
|
||||
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyBlockRef.custom : undefined,
|
||||
label: window.siyuan.languages.copyBlockRef,
|
||||
click: () => {
|
||||
if (name) {
|
||||
writeText(`((${id} "${name}"))`);
|
||||
} else {
|
||||
fetchPost("/api/block/getRefText", {id}, (response) => {
|
||||
writeText(`((${id} '${response.data}'))`);
|
||||
});
|
||||
}
|
||||
fetchPost("/api/block/getRefText", {id}, (response) => {
|
||||
writeText(`((${id} '${response.data}'))`);
|
||||
});
|
||||
if (focusElement) {
|
||||
focusBlock(focusElement);
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
|||
label: window.siyuan.languages.copy,
|
||||
type: "submenu",
|
||||
icon: "iconCopy",
|
||||
submenu: (copySubMenu(id, "", false) as IMenu[]).concat([{
|
||||
submenu: (copySubMenu(id, false) as IMenu[]).concat([{
|
||||
label: window.siyuan.languages.duplicate,
|
||||
click() {
|
||||
fetchPost("/api/filetree/duplicateDoc", {
|
||||
|
|
|
@ -6,7 +6,7 @@ export const initSearchMenu = (id: string) => {
|
|||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.copy,
|
||||
type: "submenu",
|
||||
submenu: copySubMenu(id, "", false)
|
||||
submenu: copySubMenu(id,false)
|
||||
}).element);
|
||||
return window.siyuan.menus.menu;
|
||||
};
|
||||
|
|
|
@ -178,7 +178,7 @@ export const initTabMenu = (tab: Tab) => {
|
|||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
type: "submenu",
|
||||
submenu: copySubMenu(rootId, "", false)
|
||||
submenu: copySubMenu(rootId, false)
|
||||
}).element);
|
||||
}
|
||||
if (tab.headElement.classList.contains("item--pin")) {
|
||||
|
|
|
@ -922,7 +922,7 @@ export class Gutter {
|
|||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
type: "submenu",
|
||||
submenu: (copySubMenu(id, nodeElement.querySelector(".protyle-attr--name")?.textContent, true, nodeElement) as IMenu[]).concat([{
|
||||
submenu: (copySubMenu(id, true, nodeElement) as IMenu[]).concat([{
|
||||
label: window.siyuan.languages.copy,
|
||||
accelerator: "⌘C",
|
||||
click() {
|
||||
|
|
|
@ -274,7 +274,7 @@ export class Title {
|
|||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
type: "submenu",
|
||||
submenu: copySubMenu(protyle.block.rootID, "")
|
||||
submenu: copySubMenu(protyle.block.rootID)
|
||||
}).element);
|
||||
if (!window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(movePathToMenu(protyle.notebookId, protyle.path));
|
||||
|
|
Loading…
Add table
Reference in a new issue