@arc-fusion/pb-editor-wrapper
Advanced tools
Comparing version 0.0.358 to 0.0.359
@@ -49,13 +49,14 @@ "use strict"; | ||
function observeBoundaries(enterNode) { | ||
var parentNode = enterNode.parentNode; | ||
var boundaryNode = enterNode.previousSibling; | ||
var config = { | ||
attributes: false, | ||
childList: true, | ||
subtree: false | ||
attributes: true, | ||
subtree: true, | ||
characterData: true | ||
}; | ||
var observedFingerprints = []; | ||
var observer = new MutationObserver(callback); | ||
observer.observe(parentNode, config); | ||
observer.observe(boundaryNode, config); | ||
function callback(mutationsList) { | ||
console.log('THIS IS WORKING'); | ||
var _iterator = _createForOfIteratorHelper(mutationsList), | ||
@@ -70,18 +71,13 @@ _step; | ||
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$previousSib; | ||
if (mutation !== null && mutation !== void 0 && (_mutation$addedNodes = mutation.addedNodes) !== null && _mutation$addedNodes !== void 0 && _mutation$addedNodes.length) { | ||
console.log('MUTATION', { | ||
mutation: mutation | ||
}); | ||
var selectedFingerprint = mutation === null || mutation === void 0 ? void 0 : (_mutation$previousSib = mutation.previousSibling) === null || _mutation$previousSib === void 0 ? void 0 : _mutation$previousSib.getAttribute('data-fusion-component'); | ||
console.log('FINGERPRINT', fingerprint); | ||
if (isChain || observedFingerprints.includes(selectedFingerprint)) { | ||
console.log('DISCONNECT INSIDE'); | ||
if (isChain) { | ||
observer.disconnect(); | ||
} else { | ||
console.log('ADD WRAPPER AGAIN'); | ||
addMouseEventsToSiblings(enterNode); | ||
observedFingerprints.push(selectedFingerprint); | ||
} | ||
} else { | ||
console.log('DISCONNECT'); | ||
observer.disconnect(); | ||
@@ -88,0 +84,0 @@ } |
{ | ||
"name": "@arc-fusion/pb-editor-wrapper", | ||
"description": "PageBuilder Preview Wrapper", | ||
"version": "0.0.358", | ||
"version": "0.0.359", | ||
"module": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "files": [ |
10415
162