AbanteCart Development > AbanteCart v2.0

Correct Problem With More Than One Instance of 'texteditor' on Page.


There is an inherent problem in AbanteCart with having more than one tinymce editor loaded on a single page. I have an extension where I need to have multiple instances of tinymce loaded. There may be other developers with the same issue.

In the admin/view/template/form/text_editor.tpl file which loads the instance tinymce for each texteditor form field type, the first command in the javascript portion is to remove all existing instances of tinymce on the page. This is correct in the creation of the custom tinymce editor used in AbanteCart. However, when the second instance is added it also removes the first, third removes the first and second, etc. While the editor looks and works right for the HTML/Text portion, the Visual portion will only work on the last instance added.

The solution is to remove the specific instance being loaded. Instead of tinymce.remove(), replace with tinymce.remove('textarea#text_editor_<?php echo $id ?>').

Now all instances of tinymce will work correctly. Please make this change in the next release.

Thank you for suggestion

Hello, dhigz
Solution was implemented in https://github.com/abantecart/abantecart-src/issues/1321
Could you please try solution on your end https://github.com/abantecart/abantecart-src/commit/454c6c6ea7ca9e439f7deac04319b8caaf9be2f7?w=1

Thanks Basara,

I pretty much came up with the same solution of changing the
value = tinyMCE.activeEditor.getContent();
value = tinymce.get('text_editor_<?php echo $id ?>').getContent()

I also changed it in the else statement
} else {
            $('#'+newtab_id+ ' textarea')
            if(tinyMCE.activeEditor != null) {
               value = textarea.val();
               value = html2visual(value);
               tinyMCE.activeEditor.setContent( value );

Thanks for making the change.


[0] Message Index

Go to full version
Powered by SMFPacks Social Login Mod