Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

TinyMCE editor in UI page (Jakarta)

Tommy Jensen
Giga Guru

Yet another question about TinyMCE editor.

 

I have added a UI Action to HR Case form that will display a dialog.

This dialog contains the TinyMCE editor.

First time I click on the UI action the Dialog opens and the ditor is initiated fine.

If I close the dialog then then click on the UI action again then the dialog opens but the TinyMCE editor is NOT rendered and there are no errors.
Then if I CTRL-F5 refresh the hr case form and click on the UI page the dialog opens with the editor back n place.

UI action to open the dialog looks like this:

function dialog() {
	var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;
	var gDialog = new GlideModal('sn_hr_core_dialog');
	gDialog.setSize(1800,600);
	gDialog.setPreference('sysparm_sysID', sysId);
	gDialog.setPreference('sysparm_table', g_form.getTableName());
	gDialog.setPreference('sysparm_subject_person', g_form.getValue('subject_person'));	
	gDialog.setTitle('Dialog');
	gDialog.render();	
}

and the first few lines of the dialog itself looks like this

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
   tinymce.init({
   mode : "specific_textareas",
   editor_selector : "mceEditor",
   width: '100%',
   height: '300px',
   menubar: "tools",
   toolbar: "$[gs.getProperty('glide.ui.html.editor.v4.toolbar.line1')]",
   content_css : "* {font: 10px arial, sans-serif;} b {font-weight:bold;} th {font-weight:bold;} strong {font-weight:bold;}",
   });
</script>

and finally adding the editor on the page:

 

<textarea cols="60" rows="10" id="textfield" name="textfield" class="mceEditor"></textarea>
1 ACCEPTED SOLUTION

Tommy Jensen
Giga Guru

Solution was to add a remove just before the init.

 

tinymce.remove('#email_body');

View solution in original post

2 REPLIES 2

Tommy Jensen
Giga Guru

Solution was to add a remove just before the init.

 

tinymce.remove('#email_body');

Tommy Jensen
Giga Guru

This is really weird. Yesterday the html editor worked fine.

 

today I am getting an error:

Uncaught ReferenceError: tinymce is not defined

 

Does anybody know how to initialise tinymce and or if a script include is missing?