This commit is contained in:
parent
d7407b74a5
commit
b153b56544
1 changed files with 21 additions and 0 deletions
|
@ -1816,6 +1816,27 @@ export class WYSIWYG {
|
|||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (!blockElement) {
|
||||
return;
|
||||
}
|
||||
// 链接,备注,样式,引用,pdf标注粘贴 https://github.com/siyuan-note/siyuan/issues/11572
|
||||
const range = getSelection().getRangeAt(0);
|
||||
const inlineElement = range.startContainer.parentElement;
|
||||
if (range.toString() === "" && inlineElement.tagName === "SPAN") {
|
||||
const currentTypes = (inlineElement.getAttribute("data-type") || "").split(" ");
|
||||
if (currentTypes.includes("inline-memo") || currentTypes.includes("text") ||
|
||||
currentTypes.includes("block-ref") || currentTypes.includes("file-annotation-ref") ||
|
||||
currentTypes.includes("a")) {
|
||||
const offset = getSelectionOffset(inlineElement, blockElement, range);
|
||||
if (offset.start === 0) {
|
||||
range.setStartBefore(inlineElement);
|
||||
range.collapse(true);
|
||||
} else if (offset.start === inlineElement.textContent.length) {
|
||||
range.setEndAfter(inlineElement);
|
||||
range.collapse(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
paste(protyle, event);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue