mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
a4f03191fa
commit
393c53941a
1 changed files with 5 additions and 1 deletions
|
|
@ -508,11 +508,15 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
}
|
||||
if (linkElement) {
|
||||
const selectText = range.toString();
|
||||
protyle.toolbar.setInlineMark(protyle, "a", "range", {
|
||||
const aElements = protyle.toolbar.setInlineMark(protyle, "a", "range", {
|
||||
type: "a",
|
||||
color: `${linkElement.getAttribute("href")}${Constants.ZWSP}${selectText || linkElement.textContent}`
|
||||
});
|
||||
if (!selectText) {
|
||||
if(aElements[0].lastChild) {
|
||||
// https://github.com/siyuan-note/siyuan/issues/15801
|
||||
range.setEnd(aElements[0].lastChild, aElements[0].lastChild.textContent.length);
|
||||
}
|
||||
range.collapse(false);
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue