mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-27 09:24:06 +01:00
This commit is contained in:
parent
e964abb2a9
commit
8cf5695119
1 changed files with 10 additions and 1 deletions
|
|
@ -740,7 +740,16 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
label: `<div class="fn__hr--small"></div><input class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.anchor}"><div class="fn__hr--small"></div>`,
|
||||
bind(element) {
|
||||
const inputElement = element.querySelector("input");
|
||||
inputElement.value = linkElement.textContent.replace(Constants.ZWSP, "");
|
||||
// https://github.com/siyuan-note/siyuan/issues/6798
|
||||
let anchor = linkElement.textContent.replace(Constants.ZWSP, "");
|
||||
if (!anchor && linkAddress) {
|
||||
anchor = linkAddress.replace("https://", "").replace("http://", "");
|
||||
if (anchor.length > 16) {
|
||||
anchor = anchor.substring(0, 16) + "...";
|
||||
}
|
||||
linkElement.innerHTML = Lute.EscapeHTMLStr(anchor);
|
||||
}
|
||||
inputElement.value = anchor;
|
||||
inputElement.addEventListener("change", () => {
|
||||
if (!inputElement.value) {
|
||||
linkElement.remove();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue