so I create an MVC site that needs an HTML input field. I have a text area that loads from an ajax dialog. I understand that TinyMCE I need to remove the control, when I hide the dialog, this is normal.
However, I cannot load the editor at all. I am using version 4.1.9 (2015-03-10) with the jquery module. i.e. both tinymce.jquery.js and jquery.tinymce.min.js
After opening the dialog box, I call this:
$("textarea").tinymce({ // General options mode: "textareas", theme: "modern", // Theme options menubar: false, toolbar: "bold,italic,underline,|,bullist,numlist", statusbar: false, init_instance_callback: function (editor) { console.log("tinymce init: " + editor.id); } });
But I get an exception in javascript in the following method, it appears self.ariaTarget undefined leading to a line starting with elm.setAttribute because elm is null. I do not understand what I did wrong.
aria: function(name, value) { var self = this, elm = self.getEl(self.ariaTarget); if (typeof value === "undefined") { return self._aria[name]; } else { self._aria[name] = value; } if (self._rendered) { elm.setAttribute(name == 'role' ? name : 'aria-' + name, value); } return self; },
Thanks for the help. Mark
Edit:
I follow this jsfiddle http://jsfiddle.net/thomi_ch/m0aLmh3n/19/ and instead of loading tinymce into the document, it loads it from the URL when it is initialized (see below). I changed my code to use the same script_url as the example, and it works for rendering the editor (missing icons, etc., since css can not be found), but that means something is wrong with the version of my tinymce.jquery.js.
$('textarea').tinymce({ script_url : 'http://demo.nilooma.com/system/plugins/tinymce/4.1.6/tiny_mce/tinymce.gzip.php', toolbar: 'link', plugins: 'link', forced_root_block : '', init_instance_callback: function(editor) { console.log('tinymce init: '+editor.id); } });
I tried both tinymce.jquery.js and tinymce.js from versions 4.1.9 and 4.1.6, as jsfiddle uses, and all combinations give me the same error.
Is it possible that there is incompatibility with another library?