Skip to content

Integration with elRTE 1.x

troex edited this page Aug 12, 2011 · 17 revisions

Option 1 - Create/destroy elFinder on every icon click:

$('selector').elrte({
  fmOpen : function(callback) {
    $('<div />').dialogelfinder({
      url: 'php/connector.php',
      commandsOptions: {
        getfile: {
          oncomplete: 'destroy' // destroy elFinder after file selection
        }
      }
      getFileCallback: callback // pass callback to file manager
    });
  }
});

Option 2 - Create dialog only once and reuse it if needed again

var dialog;
$('selector').elrte({
  fmOpen: function(callback) {
    if (!dialog) {
      // create new elFinder
      dialog = $('<div />').dialogelfinder({
        url: 'connectors/php/connector.php',
        commandsOptions: {
          getfile: {
            oncomplete : 'close' // close/hide elFinder
          }
        }
        getFileCallback: callback // pass callback to file manager
      });
    } else {
      // reopen elFinder
      dialog.dialogelfinder('open')
    }
  }
});

Discission

http://elrte.org/redmine/boards/2/topics/3210?r=3232#message-3232

Clone this wiki locally