onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

#4114937: Elementor ReCaptcha Bug #772

Closed pospisk closed 3 months ago

pospisk commented 7 months ago

@fredericalpers and I have noticed on customer websites which are using the Elementor Page Builder: If we create a form and add the shortcode in Elementor everything works, but as soon as we activate "Require ReCaptcha" Elementor stops working. (reproducible with a fresh install of oO-WP-Plugin + ReCaptcha + Elementor)

recaptcha

This is mainly due to the method with which the ReCaptcha Script is being added/enqueued because Elementor can't process those scripts.

File:

https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/e871c0ba2f42d4342bd1ddc571c0f3e773cff700/plugin/Form.php#L123

Current:

$this->renderCaptchaScript($pFormConfig->getCaptcha());

Fix Example:

if (!is_admin()) {
  $this->renderCaptchaScript($pFormConfig->getCaptcha());
}

Reasoning:

The enqueue method doesn't cause further complications so it can stay as it is. It would be enough to prevent the ReCaptcha Script from being loaded on the Admin pages to prevent the error because ReCaptcha isn't needed/required at that point.

I've tested if the change affects the "Test-Keys" element on the onOffice Settings page and it still works:

test-keys

TL;DR Elementor Browser Errors:

Uncaught ReferenceError: jQuery is not defined
    Backbone 2
load-scripts.php:9:88
Uncaught TypeError: y is undefined
    <anonymous> http://localhost:10074/wp-includes/js/dist/i18n.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/dist/i18n.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/dist/i18n.min.js:2
i18n.min.js:2:9134
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:196
post.php:196:1
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/wp-util.min.js:2
wp-util.min.js:2:1384
Uncaught ReferenceError: jQuery is not defined
    <anonymous> Backbone
wp-backbone.min.js:2:2997
Uncaught TypeError: wp.ajax is undefined
    <anonymous> http://localhost:10074/wp-includes/js/media-models.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/media-models.min.js:2
media-models.min.js:2:12667
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/plupload/wp-plupload.min.js:1
wp-plupload.min.js:1:5896
Uncaught ReferenceError: jQuery is not defined
    jQuery 2
sortable.min.js:9:107
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/mediaelement/mediaelement-migrate.min.js:1
mediaelement-migrate.min.js:1:1183
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/mediaelement/wp-mediaelement.min.js:1
wp-mediaelement.min.js:1:1100
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:237
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:238
post.php:237:2
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:249
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:250
post.php:249:2
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/media-views.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/media-views.min.js:2
media-views.min.js:2:107342
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:257
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:258
post.php:257:2
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/media-editor.min.js:2
media-editor.min.js:2:10841
Uncaught TypeError: wp.media.view.settings is undefined
    <anonymous> http://localhost:10074/wp-includes/js/media-audiovideo.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/media-audiovideo.min.js:2
media-audiovideo.min.js:2:10628
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-widgets.min.js:2
media-widgets.min.js:2:14186
Uncaught TypeError: wp.mediaWidgets is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:264
post.php:264:1
Uncaught TypeError: wp.media.view.MediaFrame is undefined
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-audio-widget.min.js:2
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-audio-widget.min.js:2
media-audio-widget.min.js:2:33
Uncaught TypeError: wp.mediaWidgets is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:269
post.php:269:1
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-image-widget.min.js:2
media-image-widget.min.js:2:1982
Uncaught TypeError: wp.mediaWidgets is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:277
post.php:277:1
Uncaught TypeError: wp.media.view.MediaFrame is undefined
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-gallery-widget.min.js:2
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-gallery-widget.min.js:2
media-gallery-widget.min.js:2:33
Uncaught TypeError: wp.mediaWidgets is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:285
post.php:285:1
Uncaught TypeError: wp.media.view.MediaFrame is undefined
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-video-widget.min.js:2
    <anonymous> http://localhost:10074/wp-admin/js/widgets/media-video-widget.min.js:2
media-video-widget.min.js:2:33
Uncaught TypeError: wp.mediaWidgets is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:293
post.php:293:1
Uncaught TypeError: g is not a function
    switchEditors http://localhost:10074/wp-admin/js/editor.min.js:2
    <anonymous> http://localhost:10074/wp-admin/js/editor.min.js:2
    <anonymous> http://localhost:10074/wp-admin/js/editor.min.js:2
editor.min.js:2:10689
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-admin/js/widgets/text-widgets.min.js:2
text-widgets.min.js:2:5811
Uncaught TypeError: wp.textWidgets is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:305
post.php:305:1
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-admin/js/widgets/custom-html-widgets.min.js:2
custom-html-widgets.min.js:2:5527
Uncaught TypeError: wp.customHtmlWidgets is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:311
post.php:311:1
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/foogallery/js/admin-foogallery-editor.js:104
admin-foogallery-editor.js:104:48
Uncaught ReferenceError: jQuery is not defined
    attachEvents http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4443
    init http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4502
    ElementorTrySafeMode http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4505
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4508
post.php:4443:6
Uncaught ReferenceError: jQuery is not defined
    jQuery 2
load-scripts.php:9:107
Uncaught ReferenceError: jQuery is not defined
    11 http://localhost:10074/wp-content/plugins/duplicate-post/js/dist/duplicate-post-elementor-450.js:1
    n http://localhost:10074/wp-content/plugins/duplicate-post/js/dist/duplicate-post-elementor-450.js:1
    <anonymous> http://localhost:10074/wp-content/plugins/duplicate-post/js/dist/duplicate-post-elementor-450.js:1
    <anonymous> http://localhost:10074/wp-content/plugins/duplicate-post/js/dist/duplicate-post-elementor-450.js:1
duplicate-post-elementor-450.js:1:2343
Uncaught TypeError: b.$ is undefined
    Backbone 3
backbone.marionette.min.js:24:5955
Uncaught ReferenceError: jQuery is not defined
    extend http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
    52640 http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
    15955 http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/common-modules.min.js:2
common-modules.min.js:2:59212
Uncaught ReferenceError: jQuery is not defined
    Module http://localhost:10074/wp-content/plugins/elementor/assets/js/web-cli.min.js:3
    _createSuperInternal http://localhost:10074/wp-content/plugins/elementor/assets/js/web-cli.min.js:3
    _default http://localhost:10074/wp-content/plugins/elementor/assets/js/web-cli.min.js:3
    API http://localhost:10074/wp-content/plugins/elementor/assets/js/web-cli.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/web-cli.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/web-cli.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/web-cli.min.js:3
web-cli.min.js:3:55692
Uncaught TypeError: p.extend is not a function
    createWidgetType http://localhost:10074/wp-content/plugins/elementor/assets/lib/dialog/dialog.min.js:3
    addWidgetType http://localhost:10074/wp-content/plugins/elementor/assets/lib/dialog/dialog.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/lib/dialog/dialog.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/lib/dialog/dialog.min.js:3
dialog.min.js:3:204
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9307
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9308
post.php:9307:2
Uncaught ReferenceError: elementorModules is not defined
    35107 http://localhost:10074/wp-content/plugins/elementor/assets/js/common.min.js:3
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/common.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/common.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/common.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/common.min.js:3
common.min.js:3:73342
Uncaught ReferenceError: elementorModules is not defined
    4746 http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-modules.min.js:3
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-modules.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-modules.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-modules.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-modules.min.js:3
editor-modules.min.js:3:22154
Uncaught ReferenceError: $e is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-document.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-document.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-document.min.js:2
editor-document.min.js:2:26454
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9338
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9339
post.php:9338:2
Uncaught TypeError: __webpack_require__(...) is undefined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/editor.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/editor.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/editor.min.js:2
editor.min.js:2:136012
Uncaught TypeError: e is undefined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/packages/ui/ui.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/packages/ui/ui.min.js:205
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/packages/ui/ui.min.js:205
ui.min.js:2:56639
Uncaught TypeError: window.elementorV2 is undefined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/packages/icons/icons.min.js:1
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/packages/icons/icons.min.js:1
icons.min.js:1:2325
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9365
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9366
post.php:9365:2
Uncaught ReferenceError: ReactDOM is not defined
    61533 http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    96333 http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    94066 http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/ai.min.js:3
ai.min.js:3:317825
Uncaught TypeError: r(...) is undefined
    33602 http://localhost:10074/wp-content/plugins/elementor/assets/js/kit-elements-defaults-editor.min.js:3
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/kit-elements-defaults-editor.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/kit-elements-defaults-editor.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/kit-elements-defaults-editor.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/kit-elements-defaults-editor.min.js:3
kit-elements-defaults-editor.min.js:3:18521
Uncaught TypeError: s.template is not a function
    <anonymous> http://localhost:10074/wp-includes/js/mce-view.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/mce-view.min.js:2
mce-view.min.js:2:7438
Uncaught ReferenceError: jQuery is not defined
    <anonymous> jQuery
jquery.imgareaselect.min.js:1:9763
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9380
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9381
post.php:9380:2
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-admin/js/image-edit.min.js:2
image-edit.min.js:2:14597
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/imagify/assets/js/beat.min.js:1
beat.min.js:1:5998
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/imagify/assets/js/admin.min.js:1
admin.min.js:1:35
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/imagify/assets/js/media-modal.min.js:1
media-modal.min.js:1:4039
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/wplink.min.js:2
wplink.min.js:2:11183
Uncaught ReferenceError: jQuery is not defined
    jQuery 2
menu.min.js:9:97
Uncaught ReferenceError: jQuery is not defined
    jQuery 2
autocomplete.min.js:9:106
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/thickbox/thickbox.js:15
thickbox.js:15:1
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-admin/js/media-upload.min.js:2
media-upload.min.js:2:1110
Uncaught ReferenceError: $e is not defined
    78402 http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    2584 http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    34261 http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/app-loader.min.js:2
app-loader.min.js:2:51838
Uncaught TypeError: r(...) is undefined
    6231 http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/display-conditions.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/display-conditions.min.js:2
    9013 http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/display-conditions.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/display-conditions.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/display-conditions.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/display-conditions.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor-pro/assets/js/display-conditions.min.js:2
display-conditions.min.js:2:2510
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/heartbeat.min.js:2
heartbeat.min.js:2:5964
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9427
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9428
post.php:9427:2
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-includes/js/wp-auth-check.min.js:2
wp-auth-check.min.js:2:1616
Uncaught ReferenceError: jQuery is not defined
    jQuery 2
resizable.min.js:9:107
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/lib/tipsy/tipsy.min.js:1
tipsy.min.js:1:4980
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/lib/e-select2/js/e-select2.full.min.js:1
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/lib/e-select2/js/e-select2.full.min.js:1
e-select2.full.min.js:1:326
window.controllers/Controllers is deprecated. Do not use it for UA detection. ace.js:1:18447
Uncaught ReferenceError: jQuery is not defined
    <anonymous> jQuery
jquery-hover-intent.min.js:1:1023
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9447
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:9448
post.php:9447:2
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor.min.js:3
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor.min.js:3
editor.min.js:3:1125809
Uncaught TypeError: wp.i18n is undefined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:10262
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:10263
post.php:10262:2
Uncaught TypeError: r(...) is undefined
    46458 http://localhost:10074/wp-content/plugins/elementor/assets/js/responsive-bar.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/responsive-bar.min.js:2
    64376 http://localhost:10074/wp-content/plugins/elementor/assets/js/responsive-bar.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/responsive-bar.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/responsive-bar.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/responsive-bar.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/responsive-bar.min.js:2
responsive-bar.min.js:2:1444
Uncaught TypeError: window.elementor is undefined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-loader-v1.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-loader-v1.min.js:2
editor-loader-v1.min.js:2:20
Uncaught TypeError: k is undefined
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/packages/query/query.min.js:1
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/packages/query/query.min.js:1
query.min.js:1:21369
Uncaught ReferenceError: ReactDOM is not defined
    61533 http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-notifications.min.js:2
    __webpack_require__ http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-notifications.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-notifications.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-notifications.min.js:2
    <anonymous> http://localhost:10074/wp-content/plugins/elementor/assets/js/editor-notifications.min.js:2
editor-notifications.min.js:2:12129
Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:11680
post.php:11680:3
Uncaught TypeError: o is undefined
    d http://localhost:10074/wp-includes/js/dist/a11y.min.js:2
    d http://localhost:10074/wp-includes/js/dist/a11y.min.js:2
    n http://localhost:10074/wp-includes/js/dist/dom-ready.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/dist/a11y.min.js:2
    <anonymous> http://localhost:10074/wp-includes/js/dist/a11y.min.js:2
a11y.min.js:2:1444
Uncaught ReferenceError: jQuery is not defined
    handleTrySafeModeNotice http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4484
    setTimeout handler*init http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4500
    ElementorTrySafeMode http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4505
    <anonymous> http://localhost:10074/wp-admin/post.php?post=13834&action=elementor:4508
post.php:4484:20
dai-eastgate commented 7 months ago

@fredericalpers I will investigate and report back asap

dai-eastgate commented 7 months ago

This is mainly due to the method with which the ReCaptcha Script is being added/enqueued because Elementor can't process those scripts.

@pospisk @fredericalpers I agree with you

Fix Example:

if (!is_admin()) {
  $this->renderCaptchaScript($pFormConfig->getCaptcha());
}

Thanks for your suggestions. However, I checked and found that the "renderCaptchaScript" method is only used in Front-end of the three components: Contact form, Interest form, Owner form. => My suggestion: Load "onoffice-captchacontrol" JS file when necessary at "renderScriptForFormPage" method in "ScriptLoaderGenericConfigurationDefault" class.

Extend notes:

I have refactored the code. You can test and review it at the branch 45882-elementor-recaptcha-bug

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/106214469/cc229c75-fdb3-4d69-9f24-ba06439328e2

fredericalpers commented 7 months ago

@dai-eastgate thank you we will review it carefully. :)

the following is just knowledge sharing:

Details

We have received a message that the use of the function wp_enqueue_script() in combination with the immediate call of wp_print_scripts() for the script onoffice-captchacontrol.min.js within the CaptchaHandler class causes problems. As far as you know, the explicit call of wp_print_scripts() is normally not necessary. Immediately "printing" the script can lead to sequencing problems with the script loads. In this particular case, this call causes the script to be executed before jQuery is loaded, resulting in errors due to the absence of jQuery. He has also sent the following code, which seems to work better: public static function registerScripts() { $siteKey = get_option('onoffice-settings-captcha-sitekey', ''); if ($siteKey !== '') { wp_enqueue_script('onoffice-captchacontrol', plugins_url('/dist/onoffice-captchacontrol.min.js', ONOFFICE_PLUGIN_DIR.'/index.php'), array('jquery'), null, true); // wp_print_scripts() NOT NECESSARY } } Translated with DeepL.com (free version)

dai-eastgate commented 7 months ago

@fredericalpers I understand your knowledge sharing.

That logic has been changed in this branch https://github.com/onOffice-Web-Org/oo-wp-plugin/pull/600/files

fredericalpers commented 3 months ago

Released in v4.20 - https://github.com/onOffice-Web-Org/oo-wp-plugin/pull/774