mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 02:36:10 +01:00
This commit is contained in:
parent
399518c39f
commit
011b33c618
2 changed files with 13 additions and 0 deletions
|
|
@ -1720,12 +1720,18 @@ style="margin:4px 0;width: ${isMobile() ? "100%" : "360px"}" class="b3-text-fiel
|
|||
} else {
|
||||
linkElement.removeAttribute("data-href");
|
||||
}
|
||||
if (!inputElements[1].value && (inputElements[0].value || inputElements[2].value)) {
|
||||
linkElement.textContent = "*";
|
||||
}
|
||||
const currentRange = getSelection().rangeCount === 0 ? undefined : getSelection().getRangeAt(0);
|
||||
if (currentRange && !protyle.element.contains(currentRange.startContainer)) {
|
||||
protyle.toolbar.range.selectNodeContents(linkElement);
|
||||
protyle.toolbar.range.collapse(false);
|
||||
focusByRange(protyle.toolbar.range);
|
||||
}
|
||||
if (!inputElements[1].value && !inputElements[0].value && !inputElements[2].value) {
|
||||
linkElement.remove();
|
||||
}
|
||||
if (html !== nodeElement.outerHTML) {
|
||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@ export class Link extends ToolbarItem {
|
|||
if (!dataHref && clipObject.textPlain.startsWith("assets/")) {
|
||||
dataHref = clipObject.textPlain;
|
||||
}
|
||||
// https://github.com/siyuan-note/siyuan/issues/14704 & https://github.com/siyuan-note/siyuan/issues/6798
|
||||
if (dataHref && !dataText) {
|
||||
dataText = decodeURIComponent(dataHref.replace("https://", "").replace("http://", ""));
|
||||
if (dataHref.length > Constants.SIZE_LINK_TEXT_MAX) {
|
||||
dataText = dataHref.substring(0, Constants.SIZE_LINK_TEXT_MAX) + "...";
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue