mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-14 10:28:31 +02:00
move egw_get_file_editor_prefered_mimes() to egw.file_editor_prefered_mimes() as everything in old jsapi.js is deprecated and should be removed
.
This commit is contained in:
@ -276,6 +276,35 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function()
|
||||
if (typeof _callback == 'function') return false;
|
||||
}*/
|
||||
return typeof grants[_app] === 'object' ? jQuery.extend({}, grants[_app]) : grants[_app];
|
||||
},
|
||||
|
||||
/**
|
||||
* Get mime types supported by file editor AND not excluded by user
|
||||
*
|
||||
* @param {string} _mime current mime type
|
||||
* @returns {object|null} returns object of filemanager editor hook
|
||||
*/
|
||||
file_editor_prefered_mimes: function(_mime)
|
||||
{
|
||||
const fe = jQuery.extend(true, {}, this.link_get_registry('filemanager-editor'));
|
||||
let ex_mimes = this.preference('collab_excluded_mimes', 'filemanager');
|
||||
const dblclick_action = this.preference('document_doubleclick_action', 'filemanager');
|
||||
if (dblclick_action === 'download' && typeof _mime === 'string')
|
||||
{
|
||||
ex_mimes = !ex_mimes ? _mime : ex_mimes+','+_mime;
|
||||
}
|
||||
if (fe && fe.mime && ex_mimes && typeof ex_mimes === 'string')
|
||||
{
|
||||
ex_mimes = ex_mimes.split(',');
|
||||
for (let mime in fe.mime)
|
||||
{
|
||||
for (let i in ex_mimes)
|
||||
{
|
||||
if (ex_mimes[i] === mime) delete(fe.mime[mime]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fe && fe.mime ? fe : null;
|
||||
}
|
||||
};
|
||||
});
|
Reference in New Issue
Block a user