• Resolved etesea

    (@etesea)


    Hello Enrico,

    I’m trying to add a default world map through a widget placed inside Gutenberg custom field block.
    I receive two errors in dev tools console:
    1. jquery-jvectormap-world_merc_en.js?ver=5.4:3 Uncaught TypeError: $.fn.vectorMap is not a function
    at jquery-jvectormap-world_merc_en.js?ver=5.4:3
    at jquery-jvectormap-world_merc_en.js?ver=5.4:4
    2.jquery-jvectormap-2.0.3.min.js?ver=2.0.3:2 Uncaught Error: Attempt to use map which was not loaded: world_merc_en
    at new jvm.Map (jquery-jvectormap-2.0.3.min.js?ver=2.0.3:2)
    at HTMLDocument.<anonymous> ((index):176)
    at i (jquery.js?ver=1.12.4-wp:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
    at Function.ready (jquery.js?ver=1.12.4-wp:2)
    at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2)

    Same errors appear when testing Italy map and example camera map.
    I’m using plugin Version 6.3.6, WordPress version 5.4
    This happens on local environment and when testing it on live site.

    Could you please help suggest what might cause these mistakes?

    p.s. When tested in on a newly created site with a default editor, there have been no mistakes and the map loaded at once

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Enrico Urbinati

    (@enrico-urbinati)

    Good morning etesea,
    thanks for contacting me and for your feedback!
    RVM maps are already tested on WP 5.4 and Gutenberg ready: How do you try to display map within Gutenberg?

    You can use the map shortcode directly in the body of your post/page or better using Add block –> Widgets –> shortcode.

    Maybe some other plugin affecting RVM? Are you using any minifying system pushing all javascript to the footer?

    From the issue you report seems more jQuery is loaded after jvectormap library…

    Try disable all plugins but RVM and see if it works.
    Would be even better having a link to test.

    Just let em know ??

    Thread Starter etesea

    (@etesea)

    Hi Enrico,

    Thank you for the quick reply!
    I’ve disabled all plugins except Advance Custom Fields, which are essential for the custom theme I’m working on. I’m using custom blocks added through ACF, all default Gutenberg blocks have been disabled except for Widgets –> shortcode.
    jQuery script is loaded in head, script for Vector Maps loads after jQuery but errors are still present.

    So, I’ve created several pages for the testing purposes, all of them use default maps:
    1. Italy map -> https://20304050.hqsite.online/testxc/italy-map/
    Map is added through to a custom widget (added with register sidebar function)
    2.Camera map -> https://20304050.hqsite.online/testxc/camera-map/
    Shortcode is added through Widgets –> shortcode.
    3.World map -> https://20304050.hqsite.online/testxc/world-map/
    Shortcode is added through Widgets –> shortcode.

    Thank you for looking into these issues!

    Plugin Author Enrico Urbinati

    (@enrico-urbinati)

    Hi there,
    could you please just deactivate ACF just for testing purpose? I need to know what and if is interfering with RVM ??

    Another hypothesis could be if you are using any Ajax page loading technology, please update rvm_shortcode.php
    inside rvm plugin directory as follows:

    at line 553 please replace this:
    $output .= '});})(jQuery);</script>';

    with this:

    $output .= 'map.updateSize();});})(jQuery);</script>';

    By the way I’m not receiving any issue in Console.
    Just let em know!

    Thread Starter etesea

    (@etesea)

    Hello again,

    And thanks again for taking time to look into this!

    Basically, there’s no sense in disabling ACF plugin, because current theme totally consists of custom reusable blocks created with it. So no specific page templates are used for pages, and no content would be visible without ACF (all default blocks are disabled). Therefore, it’s important for these two plugins to coexsist.
    Again, when I change theme to default, the map is visible without any additional actions.

    I’ve changed line 553 in rvm_shortcode.php, but, unfortunately, errors are still present.

    I’m not sure why you do not receive issues in console, I have them in different testing environments, but, just in case, I will try to implement another one and check again ??

    Again, if you have any other suggestions, I would appreciate them a lot! Meanwhile, if this isn’t currently solvable, I will check plan B – see whether map is loaded in case I use a custom page template.

    Anyway, thanks for your time and effort!

    P.S. In case this might be useful, Query Monitor plugin shows this suppressed notice: “Methods with the same name as their class will not be constructors in a future version of PHP; rvm_widget has a deprecated constructor” (line 14 of rvw_widget.php)

    • This reply was modified 4 years, 7 months ago by etesea.
    Plugin Author Enrico Urbinati

    (@enrico-urbinati)

    Hi,

    sorry did not work ??
    I have installed ACF on my local environment and RVM still works fine.
    Could you please tell me the exact steps you take in order to recreate same situation?
    Thank you!

    Thread Starter etesea

    (@etesea)

    Hi Enrico,

    Thank you for taking time to install ACF and test it! That, essentially, helped me find my mistake!
    Since it was proven that maps worked fine with ACF, I decided to create another copy of the theme with the minimum amount of basic php files and then add additional php/js files one by one. The reason maps didn’t load in my case turned out to be very simple – the minified file with all js libraries used in the theme have been inherited from the front end, and it held another jQuery include. So, basically there were two jquery files added – one WP default, and another in minified file.

    Thank you for helping me find this issue and thank you for your time and great support for the plugin!

    Thread Starter etesea

    (@etesea)

    Marking this as resolved

    Plugin Author Enrico Urbinati

    (@enrico-urbinati)

    Hi etesea,

    so glad you found out the issue: most of the time, as already said in my first reply, this kind of issue are related to this minifying process.

    May you consider to review RVM? That will help my project ??
    Thank you in advance,
    Enrico

    Thread Starter etesea

    (@etesea)

    Hi Enrico,

    Sure, will do!
    Thanks again

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘vectorMap is not a function in Gutenberg’ is closed to new replies.