ZwiiCampus/core/vendor/filemanager/plugin.min.js

1 line
2.6 KiB
JavaScript
Raw Normal View History

tinymce.PluginManager.add("filemanager",(function(editor){function filemanager_onMessage(event){0===editor.settings.external_filemanager_path.toLowerCase().indexOf(event.origin.toLowerCase())&&"responsivefilemanager"===event.data.sender&&(tinymce.activeEditor.windowManager.getParams().setUrl(event.data.url),tinymce.activeEditor.windowManager.close(),window.removeEventListener?window.removeEventListener("message",filemanager_onMessage,!1):window.detachEvent("onmessage",filemanager_onMessage))}function filemanager(callback,value,meta){var width=window.innerWidth-30,height=window.innerHeight-60,width_reduce;(width>1800&&(width=1800),height>1200&&(height=1200),width>600)&&(width=width-(width-20)%138+10);urltype=2,"image"!==meta.filetype&&"image"!==meta.mediaType||(urltype=1),"media"!==meta.filetype&&"media"!==meta.mediaType||(urltype=3);var title="RESPONSIVE FileManager";void 0!==editor.settings.filemanager_title&&editor.settings.filemanager_title&&(title=editor.settings.filemanager_title);var akey="key";void 0!==editor.settings.filemanager_access_key&&editor.settings.filemanager_access_key&&(akey=editor.settings.filemanager_access_key);var sort_by="";void 0!==editor.settings.filemanager_sort_by&&editor.settings.filemanager_sort_by&&(sort_by="&sort_by="+editor.settings.filemanager_sort_by);var descending=0;void 0!==editor.settings.filemanager_descending&&editor.settings.filemanager_descending&&(descending=editor.settings.filemanager_descending);var fldr="";void 0!==editor.settings.filemanager_subfolder&&editor.settings.filemanager_subfolder&&(fldr="&fldr="+editor.settings.filemanager_subfolder);var crossdomain="";void 0!==editor.settings.filemanager_crossdomain&&editor.settings.filemanager_crossdomain&&(crossdomain="&crossdomain=1",window.addEventListener?window.addEventListener("message",filemanager_onMessage,!1):window.attachEvent("onmessage",filemanager_onMessage)),window.addEventListener("message",(function receiveMessage(event){"responsivefilemanager"===event.data.sender&&callback(event.data.url)}),!1);var dialogUrl=editor.settings.external_filemanager_path+"dialog.php?type="+urltype+"&descending="+descending+sort_by+fldr+crossdomain+"&lang="+editor.settings.language+"&akey="+akey;tinymce.majorVersion>4?tinymce.activeEditor.windowManager.openUrl({title:title,url:dialogUrl,width:width,height:height,resizable:!0,maximizable:!0,inline:1}):tinymce.activeEditor.windowManager.open({title:title,file:dialogUrl,width:width,height:height,resizable:!0,maximizable:!0,inline:1})}return editor.settings.file_picker_types="file image media",editor.settings.file_picker_callback=filemanager,!1}));