mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
faa31614d1
commit
555b13112a
4 changed files with 62 additions and 122 deletions
|
|
@ -302,26 +302,6 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
copyPlainText(cloneContents.textContent);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.copy + " HTML",
|
||||
click() {
|
||||
focusByRange(getEditorRange(nodeElement));
|
||||
let html = "";
|
||||
getSelection().getRangeAt(0).cloneContents().childNodes.forEach(item => {
|
||||
if (item.nodeType === 3) {
|
||||
html += item.textContent;
|
||||
} else {
|
||||
html += (item as Element).outerHTML;
|
||||
}
|
||||
});
|
||||
if (protyle.disabled) {
|
||||
html = getEnableHTML(html);
|
||||
}
|
||||
const tempElement = document.createElement("template");
|
||||
tempElement.innerHTML = protyle.lute.BlockDOM2HTML(html);
|
||||
writeText(tempElement.content.firstElementChild.innerHTML);
|
||||
}
|
||||
}).element);
|
||||
if (protyle.disabled) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue