我一直在尝试在 Quill 文本编辑器中自动格式化和突出显示代码。到目前为止,我的尝试都没有成功。
let pretty_Id = "pretty_Id_";
stringJsCode = `
<pre id="${pretty_Id}" class="ql-syntax prettyprint" spellcheck="false">
var myHTMLWidget = async (varArgs) => {
let myWidgetView = '<div class="revFlexContainer">HELLO WORLD</div>';
return myWidgetView;
};
module.exports.myHTMLWidget = myHTMLWidget;
</pre>
`;
/** Wait til pretty_Id is loaded into DOM **/
window.setIntervalFunction(pretty_Id, () => {
prettyPrint();
});
quillEditorInputArea.root.innerHTML = stringJsCode;
如何将代码加载为字符串并突出显示和自动格式化?
谢谢大家。