mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
59a966884b
commit
119f259a9b
1 changed files with 5 additions and 5 deletions
|
|
@ -166,7 +166,11 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
});
|
});
|
||||||
const code = processPasteCode(textHTML, textPlain);
|
const code = processPasteCode(textHTML, textPlain);
|
||||||
const range = getEditorRange(protyle.wysiwyg.element);
|
const range = getEditorRange(protyle.wysiwyg.element);
|
||||||
if (siyuanHTML) {
|
if (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {
|
||||||
|
// 粘贴在代码位置
|
||||||
|
insertHTML(textPlain, protyle);
|
||||||
|
return;
|
||||||
|
} else if (siyuanHTML) {
|
||||||
// 编辑器内部粘贴
|
// 编辑器内部粘贴
|
||||||
const tempElement = document.createElement("div");
|
const tempElement = document.createElement("div");
|
||||||
tempElement.innerHTML = siyuanHTML;
|
tempElement.innerHTML = siyuanHTML;
|
||||||
|
|
@ -188,10 +192,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
const tempInnerHTML = tempElement.innerHTML;
|
const tempInnerHTML = tempElement.innerHTML;
|
||||||
insertHTML(tempInnerHTML, protyle, isBlock);
|
insertHTML(tempInnerHTML, protyle, isBlock);
|
||||||
filterClipboardHint(protyle, tempInnerHTML);
|
filterClipboardHint(protyle, tempInnerHTML);
|
||||||
} else if (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {
|
|
||||||
// 粘贴在代码位置
|
|
||||||
insertHTML(textPlain, protyle);
|
|
||||||
return;
|
|
||||||
} else if (code) {
|
} else if (code) {
|
||||||
if (!code.startsWith('<div data-type="NodeCodeBlock" class="code-block" data-node-id="')) {
|
if (!code.startsWith('<div data-type="NodeCodeBlock" class="code-block" data-node-id="')) {
|
||||||
const wbrElement = document.createElement("wbr");
|
const wbrElement = document.createElement("wbr");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue