mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
This commit is contained in:
parent
303f653c33
commit
4ef70dbdc0
4 changed files with 9 additions and 4 deletions
|
|
@ -177,6 +177,6 @@ export const newFileBySelect = (fileName: string, protyle: IProtyle) => {
|
||||||
title: newName,
|
title: newName,
|
||||||
md: ""
|
md: ""
|
||||||
}, () => {
|
}, () => {
|
||||||
insertHTML(genEmptyBlock(false, false, `<span data-type="block-ref" data-id="${id}" data-subtype="d">${escapeHtml(newName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`), protyle);
|
insertHTML(`<span data-type="block-ref" data-id="${id}" data-subtype="d">${escapeHtml(newName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`, protyle);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
title: "Untitled",
|
title: "Untitled",
|
||||||
md: ""
|
md: ""
|
||||||
}, () => {
|
}, () => {
|
||||||
insertHTML(genEmptyBlock(false, false, `<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`), protyle);
|
insertHTML(`<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`, protyle);
|
||||||
/// #if MOBILE
|
/// #if MOBILE
|
||||||
openMobileFileById(newSubDocId, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);
|
openMobileFileById(newSubDocId, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);
|
||||||
/// #else
|
/// #else
|
||||||
|
|
|
||||||
|
|
@ -620,7 +620,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
selectedIds.forEach(item => {
|
selectedIds.forEach(item => {
|
||||||
html += `{{select * from blocks where id='${item}'}}\n`;
|
html += `{{select * from blocks where id='${item}'}}\n`;
|
||||||
});
|
});
|
||||||
insertHTML(protyle.lute.SpinBlockDOM(html), protyle);
|
insertHTML(protyle.lute.SpinBlockDOM(html), protyle, true);
|
||||||
blockRender(protyle, protyle.wysiwyg.element);
|
blockRender(protyle, protyle.wysiwyg.element);
|
||||||
} else if (targetElement) {
|
} else if (targetElement) {
|
||||||
const targetClass = targetElement.className.split(" ");
|
const targetClass = targetElement.className.split(" ");
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
} else if (textHTML.endsWith(Constants.ZWSP)) {
|
} else if (textHTML.endsWith(Constants.ZWSP)) {
|
||||||
// 编辑器内部粘贴
|
// 编辑器内部粘贴
|
||||||
tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1).replace('<meta charset="utf-8">', "");
|
tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1).replace('<meta charset="utf-8">', "");
|
||||||
|
let isBlock = false;
|
||||||
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
|
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
|
||||||
const newId = Lute.NewNodeID();
|
const newId = Lute.NewNodeID();
|
||||||
e.setAttribute("data-node-id", newId);
|
e.setAttribute("data-node-id", newId);
|
||||||
|
|
@ -229,13 +230,17 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
if (e.getAttribute("updated")) {
|
if (e.getAttribute("updated")) {
|
||||||
e.setAttribute("updated", newId.split("-")[0]);
|
e.setAttribute("updated", newId.split("-")[0]);
|
||||||
}
|
}
|
||||||
|
isBlock = true
|
||||||
});
|
});
|
||||||
|
if (nodeElement.classList.contains("table")) {
|
||||||
|
isBlock = false;
|
||||||
|
}
|
||||||
// 从历史中复制后粘贴
|
// 从历史中复制后粘贴
|
||||||
tempElement.querySelectorAll('[spellcheck="false"][contenteditable="false"]').forEach((e) => {
|
tempElement.querySelectorAll('[spellcheck="false"][contenteditable="false"]').forEach((e) => {
|
||||||
e.setAttribute("contenteditable", "true");
|
e.setAttribute("contenteditable", "true");
|
||||||
});
|
});
|
||||||
const tempInnerHTML = tempElement.innerHTML;
|
const tempInnerHTML = tempElement.innerHTML;
|
||||||
insertHTML(tempInnerHTML, protyle);
|
insertHTML(tempInnerHTML, protyle, isBlock);
|
||||||
filterClipboardHint(protyle, tempInnerHTML);
|
filterClipboardHint(protyle, tempInnerHTML);
|
||||||
} else {
|
} else {
|
||||||
tempElement.innerHTML = textHTML;
|
tempElement.innerHTML = textHTML;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue