Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
Last active February 13, 2020 13:27
Show Gist options
  • Save jayjanssen/6b83c2c06e89c679367d8224be23cb53 to your computer and use it in GitHub Desktop.
Save jayjanssen/6b83c2c06e89c679367d8224be23cb53 to your computer and use it in GitHub Desktop.
ServiceNow Modify TinyMCE Settings -- Client Script, onLoad, Tested on Madrid
function onLoad() {
tinymce.on('AddEditor', function(e) {
e.editor.settings.block_formats = 'Paragraph=p;Preformatted=pre;Quote=blockquote;Heading 1=h1;Heading 2=h2;Heading 3=h3;None=removeformat';
e.editor.settings.forced_root_block = false;
});
}
@jayjanssen
Copy link
Author

This client script intercepts editors as they are added but prior to initialization so you can tweak settings. Other methods I've found either just don't work or have race conditions so they work inconsistently across browsers (i.e., addAfterPageLoadedEvent hook).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment