We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27708 MODX Staff
    • 2,502 Posts
    I've encountered an issue with elfinder in NewsPublisher and elFinder where I cannot select an image from a directory. It's throwing an error about the setURL as follows:

    elfinder.min.js:9 TypeError: parent.tinymce.activeEditor.windowManager.getParams(...).setUrl is not a function
        at Object.mySubmit (http://example.com/npelfinder.html:23:75)
        at i.commands.getfile.getFileCallback [as callback] (http://example.com/npelfinder.html:56:45)
        at Object.<anonymous> (http://example.com/assets/components/newspublisher/elfinder/js/elfinder.min.js:16:15922)
        at i (http://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js:2:27451)
        at Object.fireWith [as resolveWith] (http://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js:2:28215)
        at Object.e.(anonymous function) [as resolve] (http://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js:2:29194)
        at i.commands.getfile.exec (http://example.com/assets/components/newspublisher/elfinder/js/elfinder.min.js:16:17143)
        at i.exec (http://example.com/assets/components/newspublisher/elfinder/js/elfinder.min.js:9:24448)
        at Array.<anonymous> (http://example.com/assets/components/newspublisher/elfinder/js/elfinder.min.js:10:3028)
        at i.trigger (http://example.com/assets/components/newspublisher/elfinder/js/elfinder.min.js:9:22784)


    I've been mucking about this extra doing some pretty serious customizing but I can't think I did anything that would cause an issue.

    Also, I am not seeing a way to dismiss or close the elFinder window in the view.
      Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
      • 3749
      • 24,544 Posts
      Do you have the MODX TinyMCE extra installed (or incompletely uninstalled)?

      Have you modified the npElFinderInit TPL chunk? A typo there might cause this.

      These lines in that chunk are suggestive:

      // file is the URL of of the npElFinder resource
      file: '[[++site_url]]npelfinder[[+np_html_extension]]',

      If the HTML extension is wrong it will crap things up. The code queries the modx_content_types table in the DB to get the np_html_extension. Could you look in that table and see if HTML is the first entry and if its value field matches the extension used in the sites page's? Also, if that resource is a container and containers don't have an extension, that could be the problem.

      Another thought: If it's a multi-language site, maybe the site_url tag should be uncached:

      [[!++site_url]]


      I've never tested with multiple contexts, so that by itself could cause an issue, though if it was working before, that's probably not it.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 27708 MODX Staff
        • 2,502 Posts
        This is a single context site. I uninstalled and reinstalled completely. I've removed customizations and removed CSS overrides and I cannot get this to work. There are things I think are acting up: 1) there is no closure for the elFinder window/tinywindow that it's wrapped in and escape doesn't dismiss. 2) No matter what browser I check this in, it happens. In Safari the error looks like this:
        TypeError: parent.tinymce.activeEditor.windowManager.getParams().setUrl is not a function. (In 'parent.tinymce.activeEditor.windowManager.getParams().setUrl(URL)', 'parent.tinymce.activeEditor.windowManager.getParams().setUrl' is undefined)


        I confirmed the connector page and this page are not containers and have .html file extension. I confirmed the modx_content_types table contains the .html.

        I just can't figure this out.
          Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
          • 3749
          • 24,544 Posts
          I'm baffled as well. AFIK, it hasn't done this for anyone else.

          Is the MODX TinyMCE extra installed (or incompletely uninstalled)? Is TinyMCEWrapper installed?
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 42562
            • 1,145 Posts
              TinymceWrapper: Complete back/frontend content solution.
              Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
              5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
              • 27708 MODX Staff
              • 2,502 Posts
              @donshakespeare. This completed fixed this. Thanks so much for chiming in here.

              @bobray, I'd suggest updating the code to use 4.5 by default. Works fine and this now works properly.
                Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
                • 42562
                • 1,145 Posts
                Actually, switching to 4.5 is downgrading, thus ignoring all the minor serious fixes and lo, the latest major V of 7.
                4 keeps you afloat with, of course, the pitfall in mind.

                Anyways, problem officially fixed, see updated thread. Keep using old CDN [ed. note: donshakespeare last edited this post 7 years, 2 months ago.]
                  TinymceWrapper: Complete back/frontend content solution.
                  Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                  5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                  • 3749
                  • 24,544 Posts
                  Jay, have you tried the original code since the latest TinyMCE update? If I'm understanding donshakespeare, Version 4.7.0 of TinyMCE fixes this issue.



                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting