Skip to content

Commit

Permalink
Update for TinyMCE 6
Browse files Browse the repository at this point in the history
  • Loading branch information
jDanek committed Sep 14, 2023
1 parent 117438d commit 8da56f7
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions plugins/extend/wysiwyg-fm/public/filemanager/plugin.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@

tinymce.PluginManager.add('filemanager', function(editor) {

editor.settings.file_picker_types = 'file image media';
editor.settings.file_picker_callback = filemanager;
editor.options.register('file_picker_types', {
processor: 'string',
default: 'file image media'
});
editor.options.register('file_picker_callback', {
processor: 'function',
default: filemanager
});

function filemanager_onMessage(event){
if(editor.settings.external_filemanager_path.toLowerCase().indexOf(event.origin.toLowerCase()) === 0){
if(editor.getParam('external_filemanager_path').toLowerCase().indexOf(event.origin.toLowerCase()) === 0){
if(event.data.sender === 'responsivefilemanager'){
tinymce.activeEditor.windowManager.getParams().setUrl(event.data.url);
tinymce.activeEditor.windowManager.close();
Expand Down Expand Up @@ -44,27 +50,27 @@ tinymce.PluginManager.add('filemanager', function(editor) {
if (meta.filetype === 'media' || meta.mediaType === 'media') { urltype=3; }

var title="RESPONSIVE FileManager";
if (typeof editor.settings.filemanager_title !== "undefined" && editor.settings.filemanager_title) {
title=editor.settings.filemanager_title;
if (typeof editor.getParam('filemanager_title') !== "undefined" && editor.getParam('filemanager_title')) {
title = editor.getParam('filemanager_title');
}
var akey="key";
if (typeof editor.settings.filemanager_access_key !== "undefined" && editor.settings.filemanager_access_key) {
akey=editor.settings.filemanager_access_key;
if (typeof editor.getParam('filemanager_access_key') !== "undefined" && editor.getParam('filemanager_access_key')) {
akey=editor.getParam('filemanager_access_key');
}
var sort_by="";
if (typeof editor.settings.filemanager_sort_by !== "undefined" && editor.settings.filemanager_sort_by) {
sort_by="&sort_by="+editor.settings.filemanager_sort_by;
if (typeof editor.getParam('filemanager_sort_by') !== "undefined" &&editor.getParam('filemanager_sort_by')) {
sort_by="&sort_by="+editor.getParam('filemanager_sort_by');
}
var descending=0;
if (typeof editor.settings.filemanager_descending !== "undefined" && editor.settings.filemanager_descending) {
descending=editor.settings.filemanager_descending;
if (typeof editor.getParam('filemanager_descending') !== "undefined" && editor.getParam('filemanager_descending')) {
descending=editor.getParam('filemanager_descending');
}
var fldr="";
if (typeof editor.settings.filemanager_subfolder !== "undefined" && editor.settings.filemanager_subfolder) {
fldr="&fldr="+editor.settings.filemanager_subfolder;
if (typeof editor.getParam('filemanager_subfolder') !== "undefined" && editor.getParam('filemanager_subfolder')) {
fldr="&fldr="+editor.getParam('filemanager_subfolder');
}
var crossdomain="";
if (typeof editor.settings.filemanager_crossdomain !== "undefined" && editor.settings.filemanager_crossdomain) {
if (typeof editor.getParam('filemanager_crossdomain') !== "undefined" && editor.getParam('filemanager_crossdomain')) {
crossdomain="&crossdomain=1";

// Add handler for a message from ResponsiveFilemanager
Expand All @@ -82,7 +88,7 @@ tinymce.PluginManager.add('filemanager', function(editor) {
}
}, false);

var dialogUrl = editor.settings.external_filemanager_path+'dialog.php?type='+urltype+'&descending='+descending+sort_by+fldr+crossdomain+'&lang='+editor.settings.language+'&akey='+akey;
var dialogUrl = editor.getParam('external_filemanager_path')+'dialog.php?type='+urltype+'&descending='+descending+sort_by+fldr+crossdomain+'&lang='+editor.getParam('language')+'&akey='+akey;

if (tinymce.majorVersion > 4) {
tinymce.activeEditor.windowManager.openUrl({
Expand All @@ -107,5 +113,5 @@ tinymce.PluginManager.add('filemanager', function(editor) {
}
}

return false;
});
//return false;
});

0 comments on commit 8da56f7

Please sign in to comment.