• Resolved brunods

    (@brunods)


    Hello!

    In order to use “Add ERE Real Estate Shortcodes” I first had to install the “Classic Editor” plugin, and then the button appears.
    When I click on it in the console:
    Uncaught ReferenceError: G5Utils is not defined
    at HTMLAnchorElement. (insert-shortcode.min.js?ver=5.0.8:1:153)
    at HTMLAnchorElement.dispatch (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,underscore,moxiejs,plupload,wp-codemirror&ver=6.6.2:2:40035)
    at HTMLAnchorElement. (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,underscore,moxiejs,plupload,wp-codemirror&ver=6.6.2:2:38006)

    If I add this code in the console:

    var G5Utils = {
    popup: {
    show: function(options) {
    console.log("Showing popup with target:", options.target);
    jQuery(options.target).css({
    display: 'block',
    visibility: 'visible',
    });
    },
    close: function() {
    jQuery('#ere-input-shortcode-wrap').hide(); // Oculta el popup
    }
    }
    };

    (function($) {
    $(document).ready(function() {
    $(".ere-insert-shortcode-button").off("click").on("click", function() {
    console.log("Button clicked"); // Log para verificar el clic
    ERE_POPUP.required_element();
    ERE_POPUP.reset_fileds();
    if (G5Utils && G5Utils.popup && G5Utils.popup.show) {
    G5Utils.popup.show({
    target: "#ere-input-shortcode-wrap",
    type: "target",
    callback: function() {}
    });
    } else {
    console.error("G5Utils.popup.show is not defined");
    }
    });

    // Manejo del cierre del popup
    $(document).on("click", ".close-popup", function() {
    G5Utils.popup.close();
    });
    });
    })(jQuery);

    And some CSS:

    #ere-input-shortcode-wrap {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background-color: white;
    border: 1px solid #ccc;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    }

    Then the popup appears.

    Is this just me?
    Is there another, simpler way to fix it?
    Is there a definitive solution?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.