ClassicEditor HTML Markup Switch Button: How to Activate and Show HTML
"ClassicEditor HTML Markup Switch Button: How to Activate and Show HTML"\nTo activate the switch button to show HTML markup in the editor, you can add the following code:\n\njavascript\n// Assuming you have a switch button with id 'htmlSwitch'\nvar htmlSwitch = document.querySelector('#htmlSwitch');\n\nhtmlSwitch.addEventListener('change', function() {\n if (htmlSwitch.checked) {\n pdescription.editing.view.change('source');\n } else {\n pdescription.editing.view.change('editing');\n }\n});\n\n\nThis code adds an event listener to the switch button, and when it is checked, it changes the editor's view to source mode, which displays the HTML markup. When unchecked, it changes the editor's view back to editing mode.\n\nMake sure to place this code after the code you provided for initializing the editor.
原文地址: https://www.cveoy.top/t/topic/qnmt 著作权归作者所有。请勿转载和采集!