This commit is contained in:
Mirco Wittrien 2019-10-17 09:01:50 +02:00
parent af6957ec97
commit 86e9170695
2 changed files with 11 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -1341,6 +1341,11 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
LibraryModules.ReactDOM = BDFDB.WebModules.findByProperties('render', 'findDOMNode');
if (LibraryModules.React && LibraryModules.ReactDOM) {
BDFDB.React = Object.assign({}, LibraryModules.React, LibraryModules.ReactDOM);
BDFDB.React.createElement = function (...arguments) {
try {return LibraryModules.React.createElement(...arguments) || null;}
catch (err) {console.error(`%c[BDFDB]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not create react element! ' + err);}
return null;
};
BDFDB.React.elementToReact = function (node) {
if (BDFDB.React.isValidElement(node)) return node;
else if (!Node.prototype.isPrototypeOf(node)) return BDFDB.React.createElement('DIV', {});
@ -1352,10 +1357,11 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
for (let child of node.childNodes) attributes.children.push(BDFDB.React.elementToReact(child));
return BDFDB.React.createElement(node.tagName, attributes);
};
BDFDB.React.createElement = function (...arguments) {
try {return LibraryModules.React.createElement(...arguments) || null;}
catch (err) {console.error(`%c[BDFDB]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not create react element! ' + err);}
return null;
BDFDB.React.findDOMNode = function (instance) {
if (Node.prototype.isPrototypeOf(instance)) return instance;
if (!instance || !instance.updater || typeof instance.updater.isMounted !== 'function' || !instance.updater.isMounted(instance)) return null;
var node = LibraryModules.ReactDOM.findDOMNode(instance) || BDFDB.getReactValue(instance, 'child.stateNode');
return Node.prototype.isPrototypeOf(node) ? node : null;
};
};