-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Using custom editor to edit files within elfinder
troex edited this page Nov 23, 2011
·
25 revisions
edit command supports any (I hope) WYSIWYG.
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);
}
},
{...} // probably other editors for other mime types
]
}
}
}mimes - enable current editor only on next mime types
load - calls after edit dialog shown
close - before dialog close
save - before send textarea content to backend
This is just example to get the idea how it works (I'm not TinyMCE guru so maybe somebody can fix the code). Others WYSIWYGs examples are welcome.