@arc-fusion/pb-editor-wrapper
Advanced tools
Comparing version 0.0.367 to 0.0.368
@@ -37,2 +37,4 @@ "use strict"; | ||
(0, _react.useEffect)(function () { | ||
var _enterNode$nextSiblin; | ||
if (isChain) return; | ||
@@ -42,4 +44,8 @@ | ||
addMouseEventsToSiblings(fingerprint, enterNode); | ||
observeBoundaries(enterNode); | ||
addMouseEventsToSiblings(enterNode); // observe enterNodes with no added siblings | ||
if (!isChain && enterNode !== null && enterNode !== void 0 && (_enterNode$nextSiblin = enterNode.nextSibling) !== null && _enterNode$nextSiblin !== void 0 && _enterNode$nextSiblin.matches("[data-fusion-component=\"".concat(fingerprint, "\"]"))) { | ||
observeBoundaries(enterNode); | ||
} | ||
return function () { | ||
@@ -51,36 +57,32 @@ removeMouseEventsFromSiblings(enterNode); | ||
function observeBoundaries(enterNode) { | ||
var _enterNode$nextSiblin; | ||
var parentNode = enterNode.parentNode; | ||
var config = { | ||
childList: true | ||
}; | ||
var observer = new MutationObserver(callback); | ||
observer.observe(parentNode, config); | ||
console.log('ENTERNODE', enterNode); | ||
if (!isChain && enterNode !== null && enterNode !== void 0 && (_enterNode$nextSiblin = enterNode.nextSibling) !== null && _enterNode$nextSiblin !== void 0 && _enterNode$nextSiblin.matches("[data-fusion-component=\"".concat(fingerprint, "\"]"))) { | ||
var callback = function callback(mutationsList) { | ||
var _iterator = _createForOfIteratorHelper(mutationsList), | ||
_step; | ||
function callback(mutationsList) { | ||
var _iterator = _createForOfIteratorHelper(mutationsList), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var _mutation$addedNodes; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var _mutation$addedNodes; | ||
var mutation = _step.value; | ||
var mutation = _step.value; | ||
if ((mutation === null || mutation === void 0 ? void 0 : mutation.type) === 'childList' && mutation !== null && mutation !== void 0 && (_mutation$addedNodes = mutation.addedNodes) !== null && _mutation$addedNodes !== void 0 && _mutation$addedNodes.length) { | ||
console.log('ADD WRAPPER'); | ||
addMouseEventsToSiblings(enterNode); | ||
} else { | ||
observer.disconnect(); | ||
} | ||
if ((mutation === null || mutation === void 0 ? void 0 : mutation.type) === 'childList' && mutation !== null && mutation !== void 0 && (_mutation$addedNodes = mutation.addedNodes) !== null && _mutation$addedNodes !== void 0 && _mutation$addedNodes.length) { | ||
console.log('ADD WRAPPER'); | ||
addMouseEventsToSiblings(enterNode); | ||
} else { | ||
observer.disconnect(); | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
}; | ||
var parentNode = enterNode.parentNode; | ||
var config = { | ||
childList: true | ||
}; | ||
var observer = new MutationObserver(callback); | ||
observer.observe(parentNode, config); | ||
console.log('ENTERNODE', enterNode); | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
} | ||
@@ -87,0 +89,0 @@ } |
{ | ||
"name": "@arc-fusion/pb-editor-wrapper", | ||
"description": "PageBuilder Preview Wrapper", | ||
"version": "0.0.367", | ||
"version": "0.0.368", | ||
"module": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "files": [ |
10635