From c6dbad8dfb5da5995950127e2d7cddfce8aff491 Mon Sep 17 00:00:00 2001 From: ZenMasterJacob20011 Date: Wed, 8 May 2024 19:01:33 -0500 Subject: [PATCH 1/3] requireLibrary verifies that plugin is not of type HTMLElement --- src/components/_classes/component/Component.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index 9daa721c25..70b9b0c954 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -8,7 +8,7 @@ import { processOne, processOneSync, validateProcessInfo } from '@formio/core/pr import { Formio } from '../../../Formio'; import * as FormioUtils from '../../../utils/utils'; import { - fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone + fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone, getScriptPlugin } from '../../../utils/utils'; import Element from '../../../Element'; import ComponentModal from '../componentModal/ComponentModal'; @@ -3750,7 +3750,7 @@ Component.requireLibrary = function(name, property, src, polling) { }.bind(Component.externalLibraries[name]); } // See if the plugin already exists. - const plugin = _.get(window, property); + const plugin = getScriptPlugin(property) if (plugin) { Component.externalLibraries[name].resolve(plugin); } @@ -3795,7 +3795,7 @@ Component.requireLibrary = function(name, property, src, polling) { // if no callback is provided, then check periodically for the script. if (polling) { setTimeout(function checkLibrary() { - const plugin = _.get(window, property); + const plugin = getScriptPlugin(property) if (plugin) { Component.externalLibraries[name].resolve(plugin); } From 42bed1f0da90c8764c27f525848a2cc2391e9ff6 Mon Sep 17 00:00:00 2001 From: ZenMasterJacob20011 Date: Wed, 8 May 2024 19:02:29 -0500 Subject: [PATCH 2/3] requireLibrary verifies that plugin is not of type HTMLElement --- src/components/_classes/component/Component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/_classes/component/Component.js b/src/components/_classes/component/Component.js index 70b9b0c954..6f56ccf326 100644 --- a/src/components/_classes/component/Component.js +++ b/src/components/_classes/component/Component.js @@ -3750,7 +3750,7 @@ Component.requireLibrary = function(name, property, src, polling) { }.bind(Component.externalLibraries[name]); } // See if the plugin already exists. - const plugin = getScriptPlugin(property) + const plugin = getScriptPlugin(property); if (plugin) { Component.externalLibraries[name].resolve(plugin); } @@ -3795,7 +3795,7 @@ Component.requireLibrary = function(name, property, src, polling) { // if no callback is provided, then check periodically for the script. if (polling) { setTimeout(function checkLibrary() { - const plugin = getScriptPlugin(property) + const plugin = getScriptPlugin(property); if (plugin) { Component.externalLibraries[name].resolve(plugin); } From 0f690c84a4b9748b7df0faf99fbeda0520f9873d Mon Sep 17 00:00:00 2001 From: ZenMasterJacob20011 Date: Wed, 8 May 2024 19:03:55 -0500 Subject: [PATCH 3/3] Added utility function for wizard ace issue --- src/utils/utils.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utils/utils.js b/src/utils/utils.js index c06750eb3f..b0d2765552 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -150,6 +150,22 @@ export function getElementRect(element) { }; } +/** + * Get non HTMLElement property in the window object + * @param {String} property + * @return {any || undefined} + */ +export function getScriptPlugin(property) { + const obj = window[property]; + if ( + typeof HTMLElement === 'object' ? obj instanceof HTMLElement : //DOM2 + obj && typeof obj === 'object' && true && obj.nodeType === 1 && typeof obj.nodeName === 'string' + ) { + return undefined; + } + return obj; +} + /** * Determines the boolean value of a setting. *