Elfinder: Maximize editor window upon start

Created on 9 Jan 2018  路  7Comments  路  Source: Studio-42/elFinder

Is it possible to maximize a editor window upon start? Eg, when i right-click on a HTML file > choose cKEditor, it should be possible to open this window in maximized state. currently, i could only find a way wo open a window at width xy and must click on the maximize button (the elfinder max button, not the max button from ckeditor).

I would love to see, if i could open it directly maximized.

feature howto

Most helpful comment

About PHP errors, this is my mistake. Currently it has already been fixed. Please re-acquire the nightly build.

All 7 comments

@Offerel I added trigger point of the dialog opened. You can try nightly build with next snipet.

var fm = $('#elfinder').elfinder(opts).elfinder('instance');
fm.bind('dialogopened', function(e) {
    var dialog = e.data.dialog;
    if (dialog.hasClass('elfinder-dialog-edit')) {
        dialog.find('.elfinder-titlebar-button.elfinder-titlebar-full').trigger('mousedown');
    }
});

Many thx. But where should i add this snippet? I assume in elfinder.html, somwhere under commandsOptions?

Oh, sorry. In recent elfinder.html you can set it in the bootCallback option.

// bootCalback calls at before elFinder boot up 
,bootCallback : function(fm, extraObj) {
    /* any bind functions etc. */
    fm.bind('init', function() {
        // any your code
    });
    // for example set document.title dynamically.
    var title = document.title;
    fm.bind('open', function() {
        var path = '',
            cwd  = fm.cwd();
        if (cwd) {
            path = fm.path(cwd.hash) || null;
        }
        document.title = path? path + ':' + title : title;
    }).bind('destroy', function() {
        document.title = title;
    });
    // maximize editor dialog
    fm.bind('dialogopened', function(e) {
        var dialog = e.data.dialog;
        if (dialog.hasClass('elfinder-dialog-edit')) {
            dialog.find('.elfinder-titlebar-button.elfinder-titlebar-full').trigger('mousedown');
        }
    });
}

I have now the nightly-build and the above code in elfinder.html. But when i open the Editor, it does not open maximized, instead it opens as before in normal window mode.

Additionally there seems to be php error, when i open a subfolder called "Notes". In this folder there are my notes in form of mostly html files, some markdown, pdf and pictures and some hidden .-files:

#4 /mnt/www/elfinder/php/elFinderVolumeDriver.class.php(4477): elFinderVolumeDriver->cacheDir('/media/stick/we...')
#5 /mnt/www/ in /mnt/www/elfinder/php/elFinderVolumeDriver.class.php on line 4298
[10-Jan-2018 08:06:05 Europe/Berlin] PHP Fatal error:  Uncaught Error: Using $this when not in object context in /mnt/www/elfinder/php/elFinderVolumeDriver.class.php:4298
Stack trace:
#0 /mnt/www/elfinder/php/elFinderVolumeDriver.class.php(4260): elFinderVolumeDriver::mimetypeInternalDetect('/mnt/www/...')
#1 /mnt/www/elfinder/php/elFinderVolumeLocalFileSystem.class.php(711): elFinderVolumeDriver->mimetype('/mnt/www/...')
#2 /mnt/www/elfinder/php/elFinderVolumeDriver.class.php(3429): elFinderVolumeLocalFileSystem->_scandir('/mnt/www/...')
#3 /mnt/www/elfinder/php/elFinderVolumeDriver.class.php(4199): elFinderVolumeDriver->scandirCE('/mnt/www/...')
#4 /mnt/www/elfinder/php/elFinderVolumeDriver.class.php(4477): elFinderVolumeDriver->cacheDir('/mnt/www/...')
#5 /media/stick/www in /mnt/www/elfinder/php/elFinderVolumeDriver.class.php on line 4298

i get the error only for this special subfolder. Since this is only a subfolder, with the same permissions as the parent folder, i didn't have any idea, where this error comes from.

Update. Not opening maximized was a caching issue. I have now tried this with a new browser instance. there it opens maximized. Sorry for that. But the php error exists there also.

The php error seems to come from hidden .-files. If i create a file with touch /path/to/subfolder/.testfile i get the same error for this folder.

About PHP errors, this is my mistake. Currently it has already been fixed. Please re-acquire the nightly build.

Many thx. Now it works.

Was this page helpful?
0 / 5 - 0 ratings