Skip to content

Using custom editor to edit files within elfinder

troex edited this page Nov 23, 2011 · 25 revisions

Now "edit" command supports any (I hope) wysiwygs.

Here is simple example for tinymce.

// init 
tinyMCE.init({});

// elfinder options
var opts = {
  commandsOptions : {
    edit : {
      editors : [
        {
          mimes : ['text/html'],  // add here other mimes if required
          load : function(textarea) {
            tinyMCE.execCommand("mceAddControl", true, textarea.id);
          },
          close : function(textarea, instance) {
            tinyMCE.execCommand('mceRemoveControl', false, textarea.id);
          },
          save : function(textarea, editor) {
            textarea.value = tinyMCE.get(textarea.id).selection.getContent({format : 'html'});
            tinyMCE.execCommand('mceRemoveControl', false, textarea.id);
          }
        }
      ]
    }
  }
}

Im not tinymce guru so maybe somebody fix code and write it in our wiki. Others wysiwygs examples are welcome

Clone this wiki locally