mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 没有选中文本粘贴链接不应选中整个链接
This commit is contained in:
parent
2aeaecf78c
commit
4244c18779
2 changed files with 6 additions and 2 deletions
|
|
@ -193,7 +193,7 @@ export class Toolbar {
|
|||
startElement = startElement.parentElement;
|
||||
} else if (startElement.childElementCount > 0 && startElement.childNodes[range.startOffset]?.nodeType !== 3) {
|
||||
startElement = startElement.childNodes[range.startOffset] as HTMLElement;
|
||||
if (startElement.tagName === "WBR") {
|
||||
if (startElement?.tagName === "WBR") {
|
||||
startElement = startElement.parentElement;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -544,10 +544,14 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
}
|
||||
}
|
||||
if (linkElement) {
|
||||
const selectText = range.toString();
|
||||
protyle.toolbar.setInlineMark(protyle, "a", "range", {
|
||||
type: "a",
|
||||
color: `${linkElement.getAttribute("href")}${Constants.ZWSP}${range.toString()}`
|
||||
color: `${linkElement.getAttribute("href")}${Constants.ZWSP}${selectText || linkElement.textContent}`
|
||||
});
|
||||
if (!selectText) {
|
||||
range.collapse(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/lute/html2BlockDOM", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue