Skip to content

Commit 030209c

Browse files
committed
supported tiny major >= 3
1 parent c0b8bdd commit 030209c

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

system/modules/multicolumnwizard/html/js/multicolumnwizard_be_src.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,16 @@ var MultiColumnWizard = new Class(
378378
var tinyMCEEditors = new Array();
379379
var counter = 0;
380380

381+
var editorId = 'editorId';
382+
if (tinymce.majorVersion > 3) {
383+
editorId = 'id';
384+
}
385+
381386
// get a list with tinymces
382387
tinymce.editors.each(function(item, index){
383-
if(item.editorId.match(myRegex) != null)
384-
{
385-
tinyMCEEditors[counter] = item.editorId;
388+
if(item[editorId].match(myRegex) != null)
389+
{
390+
tinyMCEEditors[counter] = item[editorId];
386391
counter++;
387392
}
388393
});
@@ -391,7 +396,7 @@ var MultiColumnWizard = new Class(
391396
tinyMCEEditors.each(function(item, index){
392397
try {
393398
var editor = tinymce.get(item);
394-
$(editor.editorId).set('text', editor.getContent());
399+
$(editor[editorId]).set('text', editor.getContent());
395400
editor.remove();
396401
} catch (e) {
397402
console.log(e)
@@ -431,10 +436,15 @@ var MultiColumnWizard = new Class(
431436
}
432437

433438
var varTinys = parent.getElements('.tinymce textarea');
434-
435-
varTinys.each(function(item, index){
436-
437-
tinymce.execCommand('mceAddControl', false, item.get('id'));
439+
440+
var addEditorCommand = 'mceAddControl';
441+
if (tinymce.majorVersion > 3) {
442+
addEditorCommand = 'mceAddEditor';
443+
}
444+
445+
varTinys.each(function(item, index){
446+
447+
tinymce.execCommand(addEditorCommand, false, item.get('id'));
438448
tinymce.get(item.get('id')).show();
439449
$(item.get('id')).erase('required');
440450
$(tinymce.get(item.get('id')).editorContainer).getElements('iframe')[0].set('title','MultiColumnWizard - TinyMCE');

0 commit comments

Comments
 (0)