mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
This commit is contained in:
parent
245e7b145e
commit
db16d8f76c
3 changed files with 62 additions and 53 deletions
|
|
@ -40,6 +40,7 @@ export abstract class Constants {
|
||||||
public static readonly SIYUAN_AUTO_LAUNCH: string = "siyuan-auto-launch";
|
public static readonly SIYUAN_AUTO_LAUNCH: string = "siyuan-auto-launch";
|
||||||
|
|
||||||
// size
|
// size
|
||||||
|
public static readonly SIZE_LINK_TEXT_MAX: number = 24;
|
||||||
public static readonly SIZE_TOOLBAR_HEIGHT: number = isMobile() ? 0 : 32;
|
public static readonly SIZE_TOOLBAR_HEIGHT: number = isMobile() ? 0 : 32;
|
||||||
public static readonly SIZE_GET_MAX = 102400;
|
public static readonly SIZE_GET_MAX = 102400;
|
||||||
public static readonly SIZE_UNDO = 64;
|
public static readonly SIZE_UNDO = 64;
|
||||||
|
|
|
||||||
|
|
@ -437,8 +437,7 @@ export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "b
|
||||||
};
|
};
|
||||||
|
|
||||||
export const copySubMenu = (id: string, accelerator = true, focusElement?: Element) => {
|
export const copySubMenu = (id: string, accelerator = true, focusElement?: Element) => {
|
||||||
return [
|
return [{
|
||||||
{
|
|
||||||
icon: "iconRef",
|
icon: "iconRef",
|
||||||
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,
|
||||||
|
|
@ -470,6 +469,16 @@ export const copySubMenu = (id: string, accelerator = true, focusElement?: Eleme
|
||||||
focusBlock(focusElement);
|
focusBlock(focusElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
label: window.siyuan.languages.copyProtocol,
|
||||||
|
click: () => {
|
||||||
|
fetchPost("/api/block/getRefText", {id}, (response) => {
|
||||||
|
writeText(`[${response.data.substring(0, Constants.SIZE_LINK_TEXT_MAX)}](siyuan://blocks/${id})`);
|
||||||
|
});
|
||||||
|
if (focusElement) {
|
||||||
|
focusBlock(focusElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
label: window.siyuan.languages.copyHPath,
|
label: window.siyuan.languages.copyHPath,
|
||||||
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyHPath.custom : undefined,
|
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyHPath.custom : undefined,
|
||||||
|
|
@ -489,8 +498,7 @@ export const copySubMenu = (id: string, accelerator = true, focusElement?: Eleme
|
||||||
focusBlock(focusElement);
|
focusBlock(focusElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const exportMd = (id: string) => {
|
export const exportMd = (id: string) => {
|
||||||
|
|
|
||||||
|
|
@ -762,7 +762,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
if (!anchor && linkAddress) {
|
if (!anchor && linkAddress) {
|
||||||
anchor = linkAddress.replace("https://", "").replace("http://", "");
|
anchor = linkAddress.replace("https://", "").replace("http://", "");
|
||||||
if (anchor.length > 24) {
|
if (anchor.length > 24) {
|
||||||
anchor = anchor.substring(0, 24) + "...";
|
anchor = anchor.substring(0, Constants.SIZE_LINK_TEXT_MAX) + "...";
|
||||||
}
|
}
|
||||||
linkElement.innerHTML = Lute.EscapeHTMLStr(anchor);
|
linkElement.innerHTML = Lute.EscapeHTMLStr(anchor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue