@arc-fusion/pb-editor-wrapper
Advanced tools
Comparing version 0.0.352 to 0.0.353
@@ -70,11 +70,10 @@ "use strict"; | ||
var siblingNodes = (0, _getSiblingNodes.getSiblingNodes)(fingerprint, enterNode); | ||
addMouseEvents(siblingNodes); | ||
observeNode(enterNode); | ||
addMouseEventsToSiblings(enterNode); | ||
observeBoundaries(enterNode); | ||
return function () { | ||
removeMouseEvents(siblingNodes); | ||
removeMouseEventsFromSiblings(enterNode); | ||
}; | ||
}); | ||
function observeNode(enterNode) { | ||
function observeBoundaries(enterNode) { | ||
var parentNode = enterNode.parentNode; | ||
@@ -95,15 +94,14 @@ var config = { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var _mutation$addedNodes; | ||
var mutation = _step.value; | ||
if (mutation.type === 'childList' && mutation.addedNodes.length) { | ||
var selectedNode = mutation.target; | ||
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) { | ||
var _mutation$target; | ||
if (isChain || selectedNode.id === 'fusion-app') { | ||
if (isChain || (mutation === null || mutation === void 0 ? void 0 : mutation.oldValue) !== null && (mutation === null || mutation === void 0 ? void 0 : (_mutation$target = mutation.target) === null || _mutation$target === void 0 ? void 0 : _mutation$target.id) === 'fusion-app') { | ||
console.log('DISCONNECT'); | ||
observer.disconnect(); | ||
console.log('NO WRAPPER NEEDED'); | ||
} else { | ||
console.log('ADD WRAPPER'); | ||
var siblingNodes = (0, _getSiblingNodes.getSiblingNodes)(fingerprint, enterNode); | ||
addMouseEvents(siblingNodes); | ||
observer.disconnect(); | ||
addMouseEventsToSiblings(enterNode); | ||
} | ||
@@ -120,3 +118,4 @@ } | ||
function addMouseEvents(siblingNodes) { | ||
function addMouseEventsToSiblings(enterNode) { | ||
var siblingNodes = (0, _getSiblingNodes.getSiblingNodes)(fingerprint, enterNode); | ||
siblingNodes.forEach(function (element) { | ||
@@ -128,3 +127,4 @@ element === null || element === void 0 ? void 0 : element.addEventListener('mouseenter', onFeatureHover); | ||
function removeMouseEvents(siblingNodes) { | ||
function removeMouseEventsFromSiblings(enterNode) { | ||
var siblingNodes = (0, _getSiblingNodes.getSiblingNodes)(fingerprint, enterNode); | ||
siblingNodes.forEach(function (element) { | ||
@@ -131,0 +131,0 @@ element === null || element === void 0 ? void 0 : element.removeEventListener('mouseenter', onFeatureHover); |
{ | ||
"name": "@arc-fusion/pb-editor-wrapper", | ||
"description": "PageBuilder Preview Wrapper", | ||
"version": "0.0.352", | ||
"version": "0.0.353", | ||
"module": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "files": [ |
10652
158