попытка переместить tinymce 4 в tinymce 5 с добавлением пользовательского filemanager

#javascript #jquery #tinymce-4 #tinymce-plugins #tinymce-5

#javascript #jquery #tinymce-4 #tinymce-плагины #tinymce-5

Вопрос:

Я пытаюсь переместить tinymce с 4 на версию 5 и создал новый файл для добавления панели инструментов и плагина в tinymce, который называется filemanager.

итак, при перемещении я внес это изменение в файл плагина filemanager

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

    if (typeof fileManager != 'undefined') {
        var fileManager = editor.settings.fileManager_path;
    } else {
        var fileManager = editor.settings.url_converter_scope.baseURI.directory   '/plugins/filemanager/index.cfm'
    }
    
    // Add a button that opens a window
    editor.ui.registry.addButton('filemanager', {
        tooltip: 'Insert From My Files',
        icon: 'browse',
        onclick: showDialog
    });

    function showDialog() {
            editor.windowManager.open({ 
                url: fileManager,
                title: 'My Files Home',
                width: Number($(window).innerWidth()) - 40,
                height: Number($(window).innerHeight()) - 80  
            });

    }
    // Adds a menu item to the tools menu
    editor.ui.registry.addMenuItem('filemanager', {
        text: 'My Files',
        context: 'insert',
        icon: 'browse',
        onclick: showDialog
    });
});
 

и получил эту ошибку в theme.min.js

 Uncaught Error: Errors: 
Failed path: (toolbarbutton)
Could not find valid *strict* value for "onAction" in {
  "tooltip": "Insert From My Files",
  "icon": "browse",
  "type": "button"
}

Input object: {
  "tooltip": "Insert From My Files",
  "icon": "browse",
  "type": "button"
}
 

Обновление # 1

Внес пару изменений, но все равно ошибка

 tinymce.PluginManager.add('filemanager', function(editor, url) {
    var openDialog = function () {
    return editor.windowManager.open({
      title: 'My Files',
      width: Number($(window).innerWidth()) - 40,
      height: Number($(window).innerHeight()) - 80,
      onSubmit: function (api) {
        var data = api.getData();
        // Insert content when the window form is submitted
        editor.insertContent('Title: '   data.title);
        api.close();
      }
    });
  };

    
    // Add a button that opens a window
    editor.ui.registry.addButton('filemanager', {
        tooltip: 'Insert From My Files',
        icon: 'browse',
        onAction: function () {
            openDialog();
        }
    });

    // Adds a menu item to the tools menu
    editor.ui.registry.addMenuItem('filemanager', {
        text: 'My Files',
        context: 'insert',
        icon: 'browse',
        onAction: function() {
            openDialog();
        }
    });

    return {
        getMetadata: function () {
        if (typeof fileManager != 'undefined') {
            var fileManager = editor.settings.fileManager_path;
        } else {
            var fileManager = editor.settings.url_converter_scope.baseURI.directory   '/plugins/filemanager/index.cfm'
        }   
        return  {
            name: "Upload Files",
            url: filemanager
        };
        }
    };
});
 

Ошибка, которую я получаю сейчас, это

 Uncaught Error: Errors: 
Failed path: (dialog)
Could not find valid *strict* value for "body" in {
  "title": "My Files",
  "width": 1543,
  "height": 302
}
Failed path: (dialog)
Could not find valid *strict* value for "buttons" in {
  "title": "My Files",
  "width": 1543,
  "height": 302
}

Input object: {
  "title": "My Files",
  "width": 1543,
  "height": 302
}