This commit is contained in:
parent
ee2cafe24c
commit
a29e642e83
2 changed files with 11 additions and 11 deletions
|
@ -697,7 +697,7 @@ export const exportMd = (id: string) => {
|
|||
}).element;
|
||||
};
|
||||
|
||||
export const openMenu = (src: string, onlyMenu = false) => {
|
||||
export const openMenu = (src: string, onlyMenu: boolean, showAccelerator: boolean) => {
|
||||
const submenu = [];
|
||||
if (isLocalPath(src)) {
|
||||
if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname(src)) &&
|
||||
|
@ -707,7 +707,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
|||
/// #if !MOBILE
|
||||
submenu.push({
|
||||
label: window.siyuan.languages.insertRight,
|
||||
accelerator: "Click",
|
||||
accelerator: showAccelerator ? "Click" : "",
|
||||
click() {
|
||||
openAsset(src.trim(), parseInt(getSearch("page", src)), "right");
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
|||
/// #if !BROWSER
|
||||
submenu.push({
|
||||
label: window.siyuan.languages.useDefault,
|
||||
accelerator: "⇧Click",
|
||||
accelerator: showAccelerator ? "⇧Click" : "",
|
||||
click() {
|
||||
openBy(src, "app");
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
|||
/// #if !BROWSER
|
||||
submenu.push({
|
||||
label: window.siyuan.languages.useDefault,
|
||||
accelerator: "Click",
|
||||
accelerator: showAccelerator ? "Click" : "",
|
||||
click() {
|
||||
openBy(src, "app");
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
|||
/// #if !BROWSER
|
||||
submenu.push({
|
||||
label: window.siyuan.languages.showInFolder,
|
||||
accelerator: "⌘Click",
|
||||
accelerator: showAccelerator ? "⌘Click" : "",
|
||||
click: () => {
|
||||
openBy(src, "folder");
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
|||
/// #if !BROWSER
|
||||
submenu.push({
|
||||
label: window.siyuan.languages.useDefault,
|
||||
accelerator: "Click",
|
||||
accelerator: showAccelerator ? "Click" : "",
|
||||
click: () => {
|
||||
shell.openExternal(src).catch((e) => {
|
||||
showMessage(e);
|
||||
|
@ -758,7 +758,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
|||
/// #if BROWSER
|
||||
submenu.push({
|
||||
label: window.siyuan.languages.useBrowserView,
|
||||
accelerator: "Click",
|
||||
accelerator: showAccelerator ? "Click" : "",
|
||||
click: () => {
|
||||
openByMobile(src);
|
||||
}
|
||||
|
|
|
@ -641,7 +641,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);
|
||||
openMenu(imgSrc);
|
||||
openMenu(imgSrc, false, false);
|
||||
}
|
||||
window.siyuan.menus.menu.popup({x: position.clientX, y: position.clientY});
|
||||
window.siyuan.menus.menu.element.querySelector("input").focus();
|
||||
|
@ -772,7 +772,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
}
|
||||
}).element);
|
||||
if (linkAddress) {
|
||||
openMenu(linkAddress);
|
||||
openMenu(linkAddress, false, true);
|
||||
}
|
||||
if (linkAddress?.startsWith("siyuan://blocks/")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
|
@ -905,7 +905,7 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
subMenus.push({
|
||||
type: "separator"
|
||||
});
|
||||
return subMenus.concat(openMenu(iframeSrc, true) as IMenu[]);
|
||||
return subMenus.concat(openMenu(iframeSrc, true, false) as IMenu[]);
|
||||
}
|
||||
return subMenus;
|
||||
};
|
||||
|
@ -943,7 +943,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
|
|||
/// #endif
|
||||
const VideoSrc = videoElement.getAttribute("src");
|
||||
if (VideoSrc) {
|
||||
return subMenus.concat(openMenu(VideoSrc, true) as IMenu[]);
|
||||
return subMenus.concat(openMenu(VideoSrc, true, false) as IMenu[]);
|
||||
}
|
||||
return subMenus;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue