mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
c0240f20d6
commit
5c7f3ab0bd
2 changed files with 16 additions and 12 deletions
|
|
@ -16,6 +16,7 @@ import {isDynamicRef, isFileAnnotation} from "../../util/functions";
|
|||
import {insertHTML} from "./insertHTML";
|
||||
import {scrollCenter} from "../../util/highlightById";
|
||||
import {hideElements} from "../ui/hideElements";
|
||||
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
||||
|
||||
const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
|
||||
let needRender = true;
|
||||
|
|
@ -176,10 +177,18 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
const html = nodeElement.outerHTML;
|
||||
wbrElement.remove();
|
||||
range.deleteContents();
|
||||
const tempElement = document.createElement("code");
|
||||
tempElement.textContent = code;
|
||||
range.insertNode(document.createElement("wbr"));
|
||||
const tempElement = document.createElement("span");
|
||||
tempElement.setAttribute("data-type", "code")
|
||||
tempElement.textContent = Constants.ZWSP + code;
|
||||
range.insertNode(tempElement);
|
||||
if (!hasPreviousSibling(tempElement)) {
|
||||
tempElement.insertAdjacentHTML("beforebegin", Constants.ZWSP);
|
||||
}
|
||||
if (hasNextSibling(tempElement)) {
|
||||
tempElement.insertAdjacentHTML("afterend", "<wbr>");
|
||||
} else {
|
||||
tempElement.insertAdjacentHTML("afterend", Constants.ZWSP + "<wbr>");
|
||||
}
|
||||
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
|
||||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue