diff --git a/include/thirdparty/elFinder/js/elfinder.full.js b/include/thirdparty/elFinder/js/elfinder.full.js index eac5205..b525a61 100644 --- a/include/thirdparty/elFinder/js/elfinder.full.js +++ b/include/thirdparty/elFinder/js/elfinder.full.js @@ -1,9 +1,9 @@ /*! * elFinder - file manager for web - * Version 2.1.62 (2023-06-14) + * Version 2.1.66 (2025-08-28) * http://elfinder.org * - * Copyright 2009-2023, Studio 42 + * Copyright 2009-2025, Studio 42 * Licensed under a 3-clauses BSD license */ (function(root, factory) { @@ -2333,6 +2333,8 @@ var elFinder = function(elm, opts, bootCallback) { isBinary = (opts.options || {}).dataType === 'binary', // current cmd is "open" isOpen = (!opts.asNotOpen && cmd === 'open'), + // the tree option is enabled (for "open" command) + isTree = (data.tree === 1), // call default fail callback (display error dialog) ? deffail = !(isBinary || opts.preventDefault || opts.preventFail), // call default success callback ? @@ -2554,7 +2556,7 @@ var elFinder = function(elm, opts, bootCallback) { }, actionTarget; - if (isOpen) { + if (isOpen && !isTree) { pushLeafRoots('files'); } else if (cmd === 'tree') { pushLeafRoots('tree'); @@ -3123,9 +3125,11 @@ var elFinder = function(elm, opts, bootCallback) { return c; }, comp = compare(), + odataRoots, dfrd = $.Deferred().always(function() { !reqFail && self.trigger('sync'); }), + tree = (! onlydir && this.ui.tree) ? 1 : 0, opts = [this.request({ - data : {cmd : 'open', reload : 1, target : cwd, tree : (! onlydir && this.ui.tree) ? 1 : 0, compare : comp}, + data : {cmd : 'open', reload : 1, target : cwd, tree : tree, compare : comp}, preventDefault : true })], exParents = function() { @@ -3217,7 +3221,14 @@ var elFinder = function(elm, opts, bootCallback) { if (!self.validResponse('tree', pdata)) { return dfrd.reject((pdata.norError || 'errResponse')); } - + + // When tree = 1, the server will return all volumes in response to the open command. + // Remove volumes from the tree command that do not exist anymore. + if (tree && pdata && pdata.tree) { + odataRoots = $.map($.grep(odata.files, function(f) {return f.isroot;}), function(f) {return f.hash;}); + pdata.tree = $.grep(pdata.tree, function(f) {return !f.isroot || odataRoots.indexOf(f.hash) >= 0;}); + } + var diff = self.diff(odata.files.concat(pdata && pdata.tree ? pdata.tree : []), onlydir); diff.added.push(odata.cwd); @@ -3259,7 +3270,7 @@ var elFinder = function(elm, opts, bootCallback) { this.shortcut = function(s) { var patterns, pattern, code, i, parts; - if (this.options.allowShortcuts && s.pattern && $.isFunction(s.callback)) { + if (this.options.allowShortcuts && s.pattern && typeof s.callback === 'function') { patterns = s.pattern.toUpperCase().split(/\s+/); for (i= 0; i < patterns.length; i++) { @@ -4869,8 +4880,18 @@ var elFinder = function(elm, opts, bootCallback) { obj, data; if (res && (self.convAbsUrl(self.options.url).indexOf(res.origin) === 0 || self.convAbsUrl(self.uploadURL).indexOf(res.origin) === 0)) { try { - obj = JSON.parse(res.data); - data = obj.data || null; + try { + if (typeof res.data !== 'string') { + return; + } + obj = JSON.parse(res.data); + if (obj.type !== "io.studio-42.github") { + return; + } + data = obj.data || null; + } catch (e2) { + return; + } if (data) { if (data.error) { if (obj.bind) { @@ -5279,10 +5300,10 @@ var elFinder = function(elm, opts, bootCallback) { $.each(self.commands, function(name, cmd) { var proto = Object.assign({}, cmd.prototype), extendsCmd, opts; - if ($.isFunction(cmd) && !self._commands[name] && (cmd.prototype.forceLoad || $.inArray(name, self.options.commands) !== -1)) { + if (typeof cmd === 'function' && !self._commands[name] && (cmd.prototype.forceLoad || $.inArray(name, self.options.commands) !== -1)) { extendsCmd = cmd.prototype.extendsCmd || ''; if (extendsCmd) { - if ($.isFunction(self.commands[extendsCmd])) { + if (typeof self.commands[extendsCmd] === 'function') { cmd.prototype = Object.assign({}, base, new self.commands[extendsCmd](), cmd.prototype); } else { return true; @@ -5301,7 +5322,7 @@ var elFinder = function(elm, opts, bootCallback) { if (self._commands[name].linkedCmds.length) { $.each(self._commands[name].linkedCmds, function(i, n) { var lcmd = self.commands[n]; - if ($.isFunction(lcmd) && !self._commands[n]) { + if (typeof lcmd === 'function' && !self._commands[n]) { lcmd.prototype = base; self._commands[n] = new lcmd(); self._commands[n].setup(n, self.options.commandsOptions[n]||{}); @@ -6022,6 +6043,18 @@ elFinder.prototype = { 'image/vnd.adobe.photoshop' : 'PSD', 'image/xbm' : 'XBITMAP', 'image/pxm' : 'PXM', + 'image/webp' : 'WEBP', + 'application/vnd.ms-fontobject' : 'EOT', + 'font/sfnt' : 'SFNT', + 'application/font-sfnt' : 'SFNT', + 'font/ttf' : 'TTF', + 'font/opentype' : 'OTF', + 'font/otf' : 'OTF', + 'application/x-font-opentype' : 'OTF', + 'font/woff' : 'WOFF', + 'application/font-woff' : 'WOFF', + 'font/woff2' : 'WOFF2', + 'application/font-woff2' : 'WOFF2', 'audio/mpeg' : 'AudioMPEG', 'audio/midi' : 'AudioMIDI', 'audio/ogg' : 'AudioOGG', @@ -8143,7 +8176,7 @@ elFinder.prototype = { } } - if (isRoot) { + if (isRoot && self.options.enableRootRename !== false) { if (rootNames = self.storage('rootNames')) { if (rootNames[file.hash]) { file._name = file.name; @@ -8642,7 +8675,7 @@ elFinder.prototype = { if (cnt > 0) { if (cancel && button.length) { - if ($.isFunction(cancel) || (typeof cancel === 'object' && cancel.promise)) { + if (typeof cancel === 'function' || (typeof cancel === 'object' && cancel.promise)) { notify._esc = function(e) { if (e.type == 'keydown' && e.keyCode != $.ui.keyCode.ESCAPE) { return; @@ -8799,7 +8832,7 @@ elFinder.prototype = { }; } - if (opts.optionsCallback && $.isFunction(opts.optionsCallback)) { + if (opts.optionsCallback && typeof opts.optionsCallback === 'function') { opts.optionsCallback(options); } @@ -9012,6 +9045,8 @@ elFinder.prototype = { kind = 'Video'; } else if (mime.indexOf('application') === 0) { kind = 'App'; + } else if (mime.indexOf('font') === 0) { + kind = 'Font'; } else { kind = mime; } @@ -9293,7 +9328,7 @@ elFinder.prototype = { * @return void */ registRawStringDecoder : function(rawStringDecoder) { - if ($.isFunction(rawStringDecoder)) { + if (typeof rawStringDecoder === 'function') { this.decodeRawString = this.options.rawStringDecoder = rawStringDecoder; } }, @@ -9785,7 +9820,7 @@ elFinder.prototype = { } }); if (!hasError) { - if ($.isFunction(callback)) { + if (typeof callback === 'function') { if (check) { if (typeof check.obj[check.name] === 'undefined') { cnt = check.timeout? (check.timeout / 10) : 1; @@ -9803,7 +9838,7 @@ elFinder.prototype = { } } } else { - if (opts.error && $.isFunction(opts.error)) { + if (opts.error && typeof opts.error === 'function') { opts.error({ loadResults: results }); } } @@ -10266,6 +10301,9 @@ elFinder.prototype = { if (themeObj.cssurls) { themeObj.cssurls = absUrl(themeObj.cssurls, m[1]); } + if (themeObj.image) { + themeObj.image = absUrl(themeObj.image, m[1]); + } dfd.resolve(themeObj); }).fail(function() { dfd.reject(); @@ -10748,7 +10786,7 @@ if (!window.cancelAnimationFrame) { * * @type String **/ -elFinder.prototype.version = '2.1.62'; +elFinder.prototype.version = '2.1.66'; @@ -11143,7 +11181,7 @@ $.fn.elfinder = function(o, o2) { if (elfinder) { opts = $.extend(true, elfinder.options, $.isPlainObject(o2)? o2 : {}); bootCallback = elfinder.bootCallback; - if (elfinder.reloadCallback && $.isFunction(elfinder.reloadCallback)) { + if (elfinder.reloadCallback && typeof elfinder.reloadCallback === 'function') { elfinder.reloadCallback(opts, bootCallback); } else { elfinder.destroy(); @@ -11233,29 +11271,29 @@ elFinder.prototype._options = { */ cdns : { // for editor etc. - ace : 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0', + ace : 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2', codemirror : 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7', - ckeditor : 'https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.21.0', - ckeditor5 : 'https://cdn.ckeditor.com/ckeditor5/38.0.1', - tinymce : 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/6.4.2', + ckeditor : 'https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.22.1', // last version of Open Source Project + ckeditor5 : 'https://cdn.ckeditor.com/ckeditor5/40.2.0', + tinymce : 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/6.8.2', simplemde : 'https://cdnjs.cloudflare.com/ajax/libs/simplemde/1.11.2', fabric : 'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/5.3.1', fabric16 : 'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.6.7', tui : 'https://uicdn.toast.com', // for quicklook etc. - hls : 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.4.4/hls.min.js', - dash : 'https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.7.0/dash.all.min.js', + hls : 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.4.14/hls.min.js', + dash : 'https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.7.3/dash.all.min.js', flv : 'https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.6.2/flv.min.js', - videojs : 'https://cdnjs.cloudflare.com/ajax/libs/video.js/8.3.0', + videojs : 'https://cdnjs.cloudflare.com/ajax/libs/video.js/8.8.0', prettify : 'https://cdn.jsdelivr.net/gh/google/code-prettify@e006587b4a893f0281e9dc9a53001c7ed584d4e7/loader/run_prettify.js', psd : 'https://cdnjs.cloudflare.com/ajax/libs/psd.js/3.4.0/psd.min.js', rar : 'https://cdn.jsdelivr.net/gh/nao-pon/rar.js@6cef13ec66dd67992fc7f3ea22f132d770ebaf8b/rar.min.js', zlibUnzip : 'https://cdn.jsdelivr.net/gh/imaya/zlib.js@0.3.1/bin/unzip.min.js', // need check unzipFiles() in quicklook.plugins.js when update zlibGunzip : 'https://cdn.jsdelivr.net/gh/imaya/zlib.js@0.3.1/bin/gunzip.min.js', bzip2 : 'https://cdn.jsdelivr.net/gh/nao-pon/bzip2.js@0.8.0/bzip2.js', - marked : 'https://cdnjs.cloudflare.com/ajax/libs/marked/5.0.4/marked.min.js', + marked : 'https://cdnjs.cloudflare.com/ajax/libs/marked/11.1.0/marked.min.js', sparkmd5 : 'https://cdnjs.cloudflare.com/ajax/libs/spark-md5/3.0.2/spark-md5.min.js', - jssha : 'https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.3.0/sha.min.js', + jssha : 'https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.3.1/sha.min.js', amr : 'https://cdn.jsdelivr.net/gh/yxl/opencore-amr-js@dcf3d2b5f384a1d9ded2a54e4c137a81747b222b/js/amrnb.js', tiff : 'https://cdn.jsdelivr.net/gh/seikichi/tiff.js@545ede3ee46b5a5bc5f06d65954e775aa2a64017/tiff.min.js' }, @@ -12565,7 +12603,7 @@ elFinder.prototype._options = { * * @type Null|Function */ - rawStringDecoder : typeof Encoding === 'object' && $.isFunction(Encoding.convert)? function(str) { + rawStringDecoder : typeof Encoding === 'object' && typeof Encoding.convert === 'function'? function(str) { return Encoding.convert(str, { to: 'UNICODE', type: 'string' @@ -12584,7 +12622,12 @@ elFinder.prototype._options = { * * @type Boolean|Object (toast options) */ - toastBackendWarn : true + toastBackendWarn : true, + + /** + * Whether renaming root folders is enabled. If true, the alias for the root folder is stored as a preference for the user. + */ + enableRootRename : true, }; @@ -13864,6 +13907,7 @@ if (typeof elFinder === 'function' && elFinder.prototype.i18) { 'btnCancel' : 'Cancel', 'btnNo' : 'No', 'btnYes' : 'Yes', + 'btnDiscard': 'Discard changes', 'btnMount' : 'Mount', // added 18.04.2012 'btnApprove': 'Goto $1 & approve', // from v2.1 added 26.04.2012 'btnUnmount': 'Unmount', // from v2.1 added 30.04.2012 @@ -14212,6 +14256,12 @@ if (typeof elFinder === 'function' && elFinder.prototype.i18) { 'kindTTF' : 'True Type font', 'kindOTF' : 'Open Type font', 'kindRPM' : 'RPM package', + // fonts + 'kindFont' : 'Font', + 'kindSFNT' : 'SFNT font', + 'kindEOT' : 'Embedded Open Type font', + 'kindWOFF' : 'Web Open Font Format', + 'kindWOFF2' : 'Web Open Font Format 2', // texts 'kindText' : 'Text document', 'kindTextPlain' : 'Plain text', @@ -18291,6 +18341,10 @@ $.fn.elfinderdialog = function(opts, fm) { .on('mousedown touchstart', function(e) { e.preventDefault(); e.stopPropagation(); + if (typeof opts.headerBtnCloseAction === 'function') { + opts.headerBtnCloseAction(e); + return; + } self.elfinderdialog('close'); }) ); @@ -18901,6 +18955,7 @@ $.fn.elfinderdialog.defaults = { openMaximized : false, headerBtnPos : 'auto', headerBtnOrder : 'auto', + headerBtnCloseAction: null, optimizeNumber : true, propagationEvents : ['mousemove', 'mouseup'] }; @@ -20423,7 +20478,7 @@ $.fn.elfindersearchbutton = function(cmd) { typeSet.append($('')); }); } - opts.find('div.buttonset').controlgroup(); + opts.find('div.buttonset').buttonset(); $('#'+id('SearchFromAll')).next('label').attr('title', fm.i18n('searchTarget', fm.i18n('btnAll'))); if (sTypes) { $.each(sTypes, function(i, v) { @@ -24200,7 +24255,68 @@ elFinder.prototype.commands.edit = function() { }); }, cancel = function() { - ta.elfinderdialog('close'); + if (!self.options.confirmUnsavedBeforeClose) { + ta.elfinderdialog('close'); + } else { + var close = function() { + var conf; + dfrd.resolve(); + if (ta.editor) { + ta.editor.close(ta[0], ta.editor.instance); + conf = ta.editor.confObj; + if (conf.info && conf.info.syncInterval) { + fileSync(file.hash); + } + } + ta.elfinderdialog('destroy'); + }, + onlySaveAs = (typeof saveAsFile.name !== 'undefined'), + accept = onlySaveAs? { + label : 'btnSaveAs', + callback : function() { + requestAnimationFrame(saveAs); + } + } : { + label : 'btnSaveClose', + callback : function() { + save().done(function() { + close(); + }); + } + }; + changed().done(function(change) { + var msgs = ['confirmNotSave']; + var btnDiscard = { + label : 'btnDiscard', + callback : function() { + close(); + } + } + if (change) { + if (typeof change === 'string') { + msgs.unshift(change); + } + fm.confirm({ + title : self.title, + text : msgs, + accept : accept, + cancel : { + label : 'btnCancel', + callback : $.noop + }, + buttons : onlySaveAs? [btnDiscard] : [{ + label : 'btnSaveAs', + callback : function() { + ta.elfinderdialog('destroy'); + requestAnimationFrame(saveAs); + } + }, btnDiscard] + }); + } else { + close(); + } + }); + } }, savecl = function() { if (!loaded()) { return; } @@ -24347,7 +24463,13 @@ elFinder.prototype.commands.edit = function() { } } }, + headerBtnCloseAction : self.options.confirmUnsavedBeforeClose ? function() { + cancel(); + } : undefined, close : function() { + if (self.options.confirmUnsavedBeforeClose) { + return; + } var close = function() { var conf; dfrd.resolve(); @@ -25934,7 +26056,7 @@ elFinder.prototype.commands.fullscreen = function() { html.push(sep); html.push('
Licence: 3-clauses BSD Licence
'); - html.push('
Copyright © 2009-2022, Studio 42 / nao-pon
'); + html.push('
Copyright © 2009-2024, Studio 42 / nao-pon
'); html.push('
„ …'+fm.i18n('dontforget')+' ”
'); html.push(''); }, @@ -30590,12 +30712,16 @@ elFinder.prototype.commands.quicklook.plugins = [ } }, err = 0, + cssClass = '', canPlay; //reset(); pDash = null; opts = opts || {}; + if (opts.cssClass) { + cssClass = ' ' + opts.cssClass; + } ql.hideinfo(); - node = $('