mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
d76b05536a
commit
0b8adb8ab3
1 changed files with 30 additions and 7 deletions
|
|
@ -577,11 +577,24 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
click() {
|
click() {
|
||||||
const quote = element.getAttribute("data-subtype") === "s" ? '"' : "'";
|
writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML));
|
||||||
writeText(`((${refBlockId} ${quote}${element.textContent}${quote}))`);
|
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
if (!protyle.disabled) {
|
if (!protyle.disabled) {
|
||||||
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
label: window.siyuan.languages.cut,
|
||||||
|
icon: "iconCut",
|
||||||
|
click() {
|
||||||
|
writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML));
|
||||||
|
|
||||||
|
element.insertAdjacentHTML("afterend", "<wbr>");
|
||||||
|
element.remove();
|
||||||
|
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
|
updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
|
||||||
|
focusByWbr(nodeElement, protyle.toolbar.range);
|
||||||
|
oldHTML = nodeElement.outerHTML;
|
||||||
|
}
|
||||||
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.remove,
|
label: window.siyuan.languages.remove,
|
||||||
icon: "iconTrashcan",
|
icon: "iconTrashcan",
|
||||||
|
|
@ -1303,14 +1316,24 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
click() {
|
click() {
|
||||||
let title = linkElement.dataset.title || "";
|
writeText(protyle.lute.BlockDOM2StdMd(linkElement.outerHTML));
|
||||||
if (title) {
|
|
||||||
title = ` "${title}"`;
|
|
||||||
}
|
|
||||||
writeText(`[${linkElement.textContent.replace(Constants.ZWSP, "")}](${linkElement.dataset.href}${title})`);
|
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
if (!protyle.disabled) {
|
if (!protyle.disabled) {
|
||||||
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
icon: "iconCut",
|
||||||
|
label: window.siyuan.languages.cut,
|
||||||
|
click() {
|
||||||
|
writeText(protyle.lute.BlockDOM2StdMd(linkElement.outerHTML));
|
||||||
|
|
||||||
|
linkElement.insertAdjacentHTML("afterend", "<wbr>");
|
||||||
|
linkElement.remove();
|
||||||
|
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
|
focusByWbr(nodeElement, protyle.toolbar.range);
|
||||||
|
html = nodeElement.outerHTML;
|
||||||
|
}
|
||||||
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
icon: "iconTrashcan",
|
icon: "iconTrashcan",
|
||||||
label: window.siyuan.languages.remove,
|
label: window.siyuan.languages.remove,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue