Question

I have couple of textarea. I am trying to remove tinymce for some textarea except one textarea.

I am using following code snippet to remove tinymce.

    window.addEvent('load', function(){
      $$('textarea[id^="fields-"],textarea[id^="classified_photo_"]').each(function(item){
          tinyMCE.execCommand('mceFocus', false, item.get('id'));
          tinyMCE.execCommand("mceRemoveControl", false, item.get('id'));
          tinyMCE.triggerSave();
      })
    });

After using this the code snippet I found that it is removing tinymce but adding some html tag may be from tinymce.enter image description here

Any help will be greatly appreciable.

Was it helpful?

Solution 2

I was using social engine and I don't wanted to change my core helpers after seeing the code I find the following solution which make some selected textarea as tinymce editor and the remaining textarea remains same,

$form = new Engine_Form();

$form->addElement('Tinymce', 'birthdate', array('editorOptions' => array('theme_advanced_buttons1' => array('undo', 'redo', 'cleanup', 'removeformat', 'pasteword', '|', 'code',
  'media', 'image', 'link', 'fullscreen', 'preview'), 'editor_selector' => 'mceEditor')))->setAttrib('class', 'mceEditor');
$form->birthdate->setAttrib('class', 'mceEditor');

Here editorOptions array key sets tinymce configs.

OTHER TIPS

The html source elements(in your case textareas) will become valid again, after you shut down a tinymce instance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top