mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
This commit is contained in:
parent
ffbd4984cb
commit
e376a56114
2 changed files with 7 additions and 1 deletions
|
|
@ -27,6 +27,7 @@ export class Link extends ToolbarItem {
|
|||
|
||||
let dataHref = "";
|
||||
let dataText = range.toString().trim().replace(Constants.ZWSP, "");
|
||||
let showMenu = false;
|
||||
try {
|
||||
// 选中链接时需忽略剪切板内容 https://ld246.com/article/1643035329737
|
||||
dataHref = protyle.lute.GetLinkDest(dataText);
|
||||
|
|
@ -65,15 +66,19 @@ export class Link extends ToolbarItem {
|
|||
if (dataHref.length > Constants.SIZE_LINK_TEXT_MAX) {
|
||||
dataText = dataHref.substring(0, Constants.SIZE_LINK_TEXT_MAX) + "...";
|
||||
}
|
||||
showMenu = true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
protyle.toolbar.setInlineMark(protyle, "a", "range", {
|
||||
const linkElements = protyle.toolbar.setInlineMark(protyle, "a", "range", {
|
||||
type: "a",
|
||||
color: dataHref + (dataText ? Constants.ZWSP + dataText : "")
|
||||
});
|
||||
if (showMenu) {
|
||||
linkMenu(protyle, linkElements[0] as HTMLElement, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -807,6 +807,7 @@ export class Toolbar {
|
|||
}
|
||||
}
|
||||
}
|
||||
return newNodes;
|
||||
}
|
||||
|
||||
public showRender(protyle: IProtyle, renderElement: Element, updateElements?: Element[], oldHTML?: string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue