JavaScript Integrating elfinder with TinyMCE 4, "TypeError: parent.tinymce.activeEditor.windowManager.getParams is not a function integrate elfinder with codeigniter

I am still newbie to integrate elfinder and tinymce, i already follow tutorial in elfinder wiki

in form.php in tinymce init already added file_browser_callback:elFinderBrowser:

tinyMCE.init({
                mode : "exact",
                elements : "txt_content",
                theme : "advanced",
                file_browser_callback : elFinderBrowser,
                plugins : "advimage,advlink,media,contextmenu",
                theme_advanced_buttons1_add_before : "newdocument,separator",
                theme_advanced_buttons1_add : "fontselect,fontsizeselect",
                theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle",
                theme_advanced_buttons2_add_before: "cut,copy,separator,",
                theme_advanced_buttons3_add_before : "",
                theme_advanced_buttons3_add : "media",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                extended_valid_elements : "hr[class|width|size|noshade]",

                paste_use_dialog : false,
                theme_advanced_resizing : true,
                theme_advanced_resize_horizontal : true,
                apply_source_formatting : true,
                force_br_newlines : true,
                force_p_newlines : false,
                relative_urls : true
        });

And also add function elFinderBrowser too:

function elFinderBrowser (field_name, url, type, win) {
  tinymce.activeEditor.windowManager.open({
    file: 'elfinder.html',// use an absolute path!
    title: 'elFinder 2.0',
    width: 900,  
    height: 450,
    resizable: 'yes',
    inline:true
  }, {
    setUrl: function (url) {
      win.document.getElementById(field_name).value = url;
    }
  });
  return false;
}

elfinder.html

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>elFinder 2.0</title>

        <!-- jQuery and jQuery UI (REQUIRED) -->
        <link rel="stylesheet" type="text/css" media="screen" target='_blank' href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css">
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>

        <!-- elFinder CSS (REQUIRED) -->
        <link rel="stylesheet" type="text/css" media="screen" target='_blank' href="<?php echo base_url() ?>assets/vendor/elfinder/css/elfinder.min.css">
        <link rel="stylesheet" type="text/css" media="screen" target='_blank' href="<?php echo base_url() ?>assets/vendor/elfinder/css/theme.css">

        <!-- elFinder JS (REQUIRED) -->
        <script type="text/javascript" src="<?php echo base_url() ?>assets/vendor/elfinder/js/elfinder.min.js"></script>

        <!-- elFinder initialization (REQUIRED) -->

    </head>
    <body>

        <!-- Element where elFinder will be created (REQUIRED) -->
        <div id="elfinder"></div>

        <script type="text/javascript" charset="utf-8">
            var FileBrowserDialogue = {
            init: function() {
              // Here goes your code for setting your custom things onLoad.
            },
            mySubmit: function (URL) {
              // pass selected file path to TinyMCE
              parent.tinymce.activeEditor.windowManager.getParams().setUrl(URL);

              // close popup window
              parent.tinymce.activeEditor.windowManager.close();
            }
          }

            $().ready(function() {
                var elf = $('#elfinder').elfinder({
                    url : 'connector.php',
                    getFileCallback: function(file) { // editor callback
                        // file.url - commandsOptions.getfile.onlyURL = false (default)
                        // file     - commandsOptions.getfile.onlyURL = true
                        FileBrowserDialogue.mySubmit(file); // pass selected file path to TinyMCE 
                      }
                }).elfinder('instance');
            });
        </script>

    </body>
</html>

but when i choose/select image in elfinder window, it show error in firegbug:

"TypeError: parent.tinymce.activeEditor.windowManager.getParams is not a function"

and it already driving me crazy, any hints, guys?

Answer:1

Have you tried top.tinymce.activeEditor.windowManager.getParams(); as stated in the tinyMce 4 documentation? so top instead of parent.

http://www.tinymce.com/wiki.php/api4:method.tinymce.WindowManager.getParams

Answer:2

For example, i have an array like this: var arr = [ {"keyword": "Sample 1", "item": {"title":"Sample Title", "url": "/sample"}}, {"keyword": "Foo 1", "item": {"title":"Foo Title", "url": "/...

For example, i have an array like this: var arr = [ {"keyword": "Sample 1", "item": {"title":"Sample Title", "url": "/sample"}}, {"keyword": "Foo 1", "item": {"title":"Foo Title", "url": "/...

  1. javascript search object for value
  2. javascript search object for key
  3. javascript search object array
  4. javascript search object for property
  5. javascript search object for string
  6. javascript search object array by property
  7. javascript search object for key value
  8. javascript search object array for value
  9. javascript search object recursively
  10. javascript search object property value

Following regex replaces " >" or " > " or "> " character with "/". tempKeyword = tempKeyword.replace(/( > )|( >)|(> )/g,'/'); How can I make this better? Thanks!

Following regex replaces " >" or " > " or "> " character with "/". tempKeyword = tempKeyword.replace(/( > )|( >)|(> )/g,'/'); How can I make this better? Thanks!

I want to catch all key presses on my webpage so that when you start typing the text appears in the search box (input) and this box gets focus. Can someone provide me some hints?

I want to catch all key presses on my webpage so that when you start typing the text appears in the search box (input) and this box gets focus. Can someone provide me some hints?

I have two classes in jquery e.g: function a(){ this.init = function(a){} } function b(){ this.init = function(a){} } Both the classes have this.init() method.I have a situation that i have the ...

I have two classes in jquery e.g: function a(){ this.init = function(a){} } function b(){ this.init = function(a){} } Both the classes have this.init() method.I have a situation that i have the ...

  1. get object name jquery
  2. object class name jquery
  3. json object name jquery
  4. jquery object name variable
  5. find object by name jquery
  6. jquery object name to string
  7. select object by name jquery
  8. get object key name jquery
  9. get object property name jquery
  10. get object class name jquery
  11. jquery object name convention
  12. jquery object name value
  13. jquery object name 取得