Search code examples
tinymce

FileManagerBundle. Implement FileMangerBundle (artgris) using TinyMCE v6.2 with Symfony4


I have tinyMCE 6.2 in my project. How to chose file?

And I can't choose an image by click or by check. The selected file path (tinymceCallBackURL) is empty. Can you help me?

tinyMCE init:

tinymce.init({ selector: '.tinymce', file_picker_callback: myFileBrowser, .......... }

My code js:

var type = meta.filetype;  
var cmsURL = "file_manager/?conf=tiny";  
if (cmsURL.indexOf("?") < 0) {    
  cmsURL = cmsURL + "?type=" + type;  
} else {    
  cmsURL = cmsURL + "&type=" + type;  
}  
var windowManagerCSS = '<style type="text/css">' + '.tox-dialog {max-width: 100%!important; width:97.5%!important; overflow: hidden; height:95%!important; border-radius:0.25em;}' + '.tox-dialog__body { padding: 0!important; }' + '.tox-dialog__body-content > div { height: 100%; overflow:hidden}' + '</style> ';
window.tinymceCallBackURL = '';  
window.tinymceWindowManager = tinymce.activeEditor.windowManager;
tinymceWindowManager.open({    
  title: 'Menedżer plików',    
  url: cmsURL,    
  body: {      
    type: 'panel',
      items: [{
        type: 'htmlpanel',
        html: windowManagerCSS + <iframe src="/file_manager/?conf=tiny&type=${type}" style="width:100%; height:500px" id="filemanager"></iframe> }]
      },
    buttons: [],
    onClose: function () {
      if (tinymceCallBackURL != '') callback(tinymceCallBackURL, {}); //to set selected file path }   });  }````

Solution

  • I have a solution. (unswer in github issue https://github.com/artgris/FileManagerBundle/issues/107):

    I needed to add module=tiny in cmsURL :

    var cmsURL = "file_manager/?module=tiny&conf=tiny";

    and replace: html: windowManagerCSS + '<iframe src="/file_manager/?conf=tiny&type=${type}" ... thinking with: html: windowManagerCSS + '<iframe src="' + cmsURL ...

    https://github.com/artgris/FileManagerBundle/blob/master/Resources/doc/tutorials/integrate-tinymce.md