Add to tinymce

Wednesday, March 17th, 2010

Because I will forget unless I save a copy here.
This is a very basic function for adding a string to tinymce (I use it to add images that are listed elsewhere on a page).

  1. // Adding content to the end of the tinymce editor
  2. function addToTiny(newContent){
  3.         var inst = tinyMCE;
  4.         inst.execCommand('mceFocus',false,'content');
  5.         inst.execCommand('mceInsertContent', true, newContent);
  6. }

Display clean javascript code for copying

// Adding content to the end of the tinymce editor
function addToTiny(newContent){
	var inst = tinyMCE;
	inst.execCommand('mceFocus',false,'content');
	inst.execCommand('mceInsertContent', true, newContent);
}