mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
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;
|
}).element;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openMenu = (src: string, onlyMenu = false) => {
|
export const openMenu = (src: string, onlyMenu: boolean, showAccelerator: boolean) => {
|
||||||
const submenu = [];
|
const submenu = [];
|
||||||
if (isLocalPath(src)) {
|
if (isLocalPath(src)) {
|
||||||
if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname(src)) &&
|
if (Constants.SIYUAN_ASSETS_EXTS.includes(pathPosix().extname(src)) &&
|
||||||
|
|
@ -707,7 +707,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
submenu.push({
|
submenu.push({
|
||||||
label: window.siyuan.languages.insertRight,
|
label: window.siyuan.languages.insertRight,
|
||||||
accelerator: "Click",
|
accelerator: showAccelerator ? "Click" : "",
|
||||||
click() {
|
click() {
|
||||||
openAsset(src.trim(), parseInt(getSearch("page", src)), "right");
|
openAsset(src.trim(), parseInt(getSearch("page", src)), "right");
|
||||||
}
|
}
|
||||||
|
|
@ -716,7 +716,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
submenu.push({
|
submenu.push({
|
||||||
label: window.siyuan.languages.useDefault,
|
label: window.siyuan.languages.useDefault,
|
||||||
accelerator: "⇧Click",
|
accelerator: showAccelerator ? "⇧Click" : "",
|
||||||
click() {
|
click() {
|
||||||
openBy(src, "app");
|
openBy(src, "app");
|
||||||
}
|
}
|
||||||
|
|
@ -726,7 +726,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
submenu.push({
|
submenu.push({
|
||||||
label: window.siyuan.languages.useDefault,
|
label: window.siyuan.languages.useDefault,
|
||||||
accelerator: "Click",
|
accelerator: showAccelerator ? "Click" : "",
|
||||||
click() {
|
click() {
|
||||||
openBy(src, "app");
|
openBy(src, "app");
|
||||||
}
|
}
|
||||||
|
|
@ -736,7 +736,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
submenu.push({
|
submenu.push({
|
||||||
label: window.siyuan.languages.showInFolder,
|
label: window.siyuan.languages.showInFolder,
|
||||||
accelerator: "⌘Click",
|
accelerator: showAccelerator ? "⌘Click" : "",
|
||||||
click: () => {
|
click: () => {
|
||||||
openBy(src, "folder");
|
openBy(src, "folder");
|
||||||
}
|
}
|
||||||
|
|
@ -746,7 +746,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
submenu.push({
|
submenu.push({
|
||||||
label: window.siyuan.languages.useDefault,
|
label: window.siyuan.languages.useDefault,
|
||||||
accelerator: "Click",
|
accelerator: showAccelerator ? "Click" : "",
|
||||||
click: () => {
|
click: () => {
|
||||||
shell.openExternal(src).catch((e) => {
|
shell.openExternal(src).catch((e) => {
|
||||||
showMessage(e);
|
showMessage(e);
|
||||||
|
|
@ -758,7 +758,7 @@ export const openMenu = (src: string, onlyMenu = false) => {
|
||||||
/// #if BROWSER
|
/// #if BROWSER
|
||||||
submenu.push({
|
submenu.push({
|
||||||
label: window.siyuan.languages.useBrowserView,
|
label: window.siyuan.languages.useBrowserView,
|
||||||
accelerator: "Click",
|
accelerator: showAccelerator ? "Click" : "",
|
||||||
click: () => {
|
click: () => {
|
||||||
openByMobile(src);
|
openByMobile(src);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -641,7 +641,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
const imgSrc = imgElement.getAttribute("src");
|
const imgSrc = imgElement.getAttribute("src");
|
||||||
if (imgSrc) {
|
if (imgSrc) {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
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.popup({x: position.clientX, y: position.clientY});
|
||||||
window.siyuan.menus.menu.element.querySelector("input").focus();
|
window.siyuan.menus.menu.element.querySelector("input").focus();
|
||||||
|
|
@ -772,7 +772,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
if (linkAddress) {
|
if (linkAddress) {
|
||||||
openMenu(linkAddress);
|
openMenu(linkAddress, false, true);
|
||||||
}
|
}
|
||||||
if (linkAddress?.startsWith("siyuan://blocks/")) {
|
if (linkAddress?.startsWith("siyuan://blocks/")) {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
|
@ -905,7 +905,7 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => {
|
||||||
subMenus.push({
|
subMenus.push({
|
||||||
type: "separator"
|
type: "separator"
|
||||||
});
|
});
|
||||||
return subMenus.concat(openMenu(iframeSrc, true) as IMenu[]);
|
return subMenus.concat(openMenu(iframeSrc, true, false) as IMenu[]);
|
||||||
}
|
}
|
||||||
return subMenus;
|
return subMenus;
|
||||||
};
|
};
|
||||||
|
|
@ -943,7 +943,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
|
||||||
/// #endif
|
/// #endif
|
||||||
const VideoSrc = videoElement.getAttribute("src");
|
const VideoSrc = videoElement.getAttribute("src");
|
||||||
if (VideoSrc) {
|
if (VideoSrc) {
|
||||||
return subMenus.concat(openMenu(VideoSrc, true) as IMenu[]);
|
return subMenus.concat(openMenu(VideoSrc, true, false) as IMenu[]);
|
||||||
}
|
}
|
||||||
return subMenus;
|
return subMenus;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue