fix: strip down pasted code blocks

This commit is contained in:
thecodrr
2021-07-24 11:28:40 +05:00
parent 1bfb0b09da
commit e7d1d55a57

View File

@@ -209,7 +209,18 @@ function TinyMCE(props) {
browser_spellcheck: true,
inline: true,
fixed_toolbar_container: "#editorToolbar",
autoresize_bottom_margin: 100,
paste_postprocess: function (_, args) {
const { node } = args;
if (node.childNodes) {
for (let childNode of node.childNodes) {
if (childNode.tagName === "PRE") {
childNode.className = "hljs";
const code = childNode.textContent || childNode.innerText;
childNode.innerHTML = code;
}
}
}
},
}}
onBeforeExecCommand={async (command) => {
if (