mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-13 07:56:14 +01:00
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")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue