mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-12 23:21:23 +08:00
This commit is contained in:
parent
466717aaac
commit
1cac92c0c8
@ -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 [
|
return [
|
||||||
{
|
{
|
||||||
icon: "iconGraph",
|
icon: "iconGraph",
|
||||||
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyBlockRef.custom : undefined,
|
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyBlockRef.custom : undefined,
|
||||||
label: window.siyuan.languages.copyBlockRef,
|
label: window.siyuan.languages.copyBlockRef,
|
||||||
click: () => {
|
click: () => {
|
||||||
if (name) {
|
|
||||||
writeText(`((${id} "${name}"))`);
|
|
||||||
} else {
|
|
||||||
fetchPost("/api/block/getRefText", {id}, (response) => {
|
fetchPost("/api/block/getRefText", {id}, (response) => {
|
||||||
writeText(`((${id} '${response.data}'))`);
|
writeText(`((${id} '${response.data}'))`);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
if (focusElement) {
|
if (focusElement) {
|
||||||
focusBlock(focusElement);
|
focusBlock(focusElement);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
|||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
type: "submenu",
|
type: "submenu",
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
submenu: (copySubMenu(id, "", false) as IMenu[]).concat([{
|
submenu: (copySubMenu(id, false) as IMenu[]).concat([{
|
||||||
label: window.siyuan.languages.duplicate,
|
label: window.siyuan.languages.duplicate,
|
||||||
click() {
|
click() {
|
||||||
fetchPost("/api/filetree/duplicateDoc", {
|
fetchPost("/api/filetree/duplicateDoc", {
|
||||||
|
@ -6,7 +6,7 @@ export const initSearchMenu = (id: string) => {
|
|||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
type: "submenu",
|
type: "submenu",
|
||||||
submenu: copySubMenu(id, "", false)
|
submenu: copySubMenu(id,false)
|
||||||
}).element);
|
}).element);
|
||||||
return window.siyuan.menus.menu;
|
return window.siyuan.menus.menu;
|
||||||
};
|
};
|
||||||
|
@ -178,7 +178,7 @@ export const initTabMenu = (tab: Tab) => {
|
|||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
type: "submenu",
|
type: "submenu",
|
||||||
submenu: copySubMenu(rootId, "", false)
|
submenu: copySubMenu(rootId, false)
|
||||||
}).element);
|
}).element);
|
||||||
}
|
}
|
||||||
if (tab.headElement.classList.contains("item--pin")) {
|
if (tab.headElement.classList.contains("item--pin")) {
|
||||||
|
@ -922,7 +922,7 @@ export class Gutter {
|
|||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
type: "submenu",
|
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,
|
label: window.siyuan.languages.copy,
|
||||||
accelerator: "⌘C",
|
accelerator: "⌘C",
|
||||||
click() {
|
click() {
|
||||||
|
@ -274,7 +274,7 @@ export class Title {
|
|||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
type: "submenu",
|
type: "submenu",
|
||||||
submenu: copySubMenu(protyle.block.rootID, "")
|
submenu: copySubMenu(protyle.block.rootID)
|
||||||
}).element);
|
}).element);
|
||||||
if (!window.siyuan.config.readonly) {
|
if (!window.siyuan.config.readonly) {
|
||||||
window.siyuan.menus.menu.append(movePathToMenu(protyle.notebookId, protyle.path));
|
window.siyuan.menus.menu.append(movePathToMenu(protyle.notebookId, protyle.path));
|
||||||
|
Loading…
Reference in New Issue
Block a user