@arc-fusion/pb-editor-wrapper
Advanced tools
Comparing version 0.0.144 to 0.0.145
@@ -14,3 +14,3 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
@@ -29,3 +29,3 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
@@ -183,10 +183,2 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
isChain = _ref.isChain, | ||
onHover = _ref.onHover, | ||
onHoverEnd = _ref.onHoverEnd, | ||
onAddTop = _ref.onAddTop, | ||
onAddBottom = _ref.onAddBottom, | ||
onEdit = _ref.onEdit, | ||
onDelete = _ref.onDelete, | ||
onLocate = _ref.onLocate, | ||
onPluginLoad = _ref.onPluginLoad, | ||
children = _ref.children; | ||
@@ -199,4 +191,47 @@ | ||
var previewEvents = { | ||
onHover: new CustomEvent('onFeatureHover', { | ||
detail: { | ||
fingerprint: id | ||
} | ||
}), | ||
onHoverEnd: new CustomEvent('onFeatureHoverEnd', { | ||
detail: { | ||
fingerprint: id | ||
} | ||
}), | ||
onEdit: new CustomEvent('onFeatureEdit', { | ||
detail: { | ||
fingerprint: id | ||
} | ||
}), | ||
onAddTop: new CustomEvent('onFeatureAddTop', { | ||
detail: { | ||
fingerprint: id | ||
} | ||
}), | ||
onAddBottom: new CustomEvent('onFeatureAddBottom', { | ||
detail: { | ||
fingerprint: id | ||
} | ||
}), | ||
onDelete: new CustomEvent('onFeatureDelete', { | ||
detail: { | ||
fingerprint: id | ||
} | ||
}), | ||
onLocate: new CustomEvent('onFeatureLocate', { | ||
detail: { | ||
fingerprint: id | ||
} | ||
}), | ||
onPluginLoad: new CustomEvent('onFeaturePluginLoad', { | ||
detail: { | ||
fingerprint: id, | ||
plugins: plugins | ||
} | ||
}) | ||
}; | ||
(0, _react.useEffect)(function () { | ||
return isHovered ? onHover && onHover() : onHoverEnd && onHoverEnd(); | ||
return isHovered ? window.dispatchEvent(previewEvents.onHover) : window.dispatchEvent(previewEvents.onHoverEnd); | ||
}, [isHovered]); | ||
@@ -222,3 +257,5 @@ | ||
style: _objectSpread(_objectSpread({}, styles.button), styles.buttonTop), | ||
onClick: onAddTop | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onAddTop); | ||
} | ||
}, /*#__PURE__*/React.createElement("i", { | ||
@@ -228,3 +265,5 @@ style: styles.buttonIcon | ||
style: _objectSpread(_objectSpread({}, styles.button), styles.buttonBottom), | ||
onClick: onAddBottom | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onAddBottom); | ||
} | ||
}, /*#__PURE__*/React.createElement("i", { | ||
@@ -236,12 +275,20 @@ style: styles.buttonIcon | ||
style: styles.actionIcon, | ||
onClick: onPluginLoad | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onPluginLoad); | ||
} | ||
}, /*#__PURE__*/React.createElement(PluginIcon, null)), /*#__PURE__*/React.createElement("i", { | ||
style: styles.actionIcon, | ||
onClick: onEdit | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onEdit); | ||
} | ||
}, /*#__PURE__*/React.createElement(EditIcon, null)), /*#__PURE__*/React.createElement("i", { | ||
style: styles.actionIcon, | ||
onClick: onLocate | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onLocate); | ||
} | ||
}, /*#__PURE__*/React.createElement(LocatorIcon, null)), /*#__PURE__*/React.createElement("i", { | ||
style: styles.actionIcon, | ||
onClick: onDelete | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onDelete); | ||
} | ||
}, /*#__PURE__*/React.createElement(TrashIcon, null)))), children); | ||
@@ -248,0 +295,0 @@ }; |
{ | ||
"name": "@arc-fusion/pb-editor-wrapper", | ||
"description": "PageBuilder Preview Wrapper", | ||
"version": "0.0.144", | ||
"version": "0.0.145", | ||
"module": "dist/index.js", | ||
@@ -27,3 +27,2 @@ "files": [ | ||
"@babel/preset-react": "^7.14.5", | ||
"@emotion/babel-plugin": "^11.3.0", | ||
"cross-env": "^7.0.3", | ||
@@ -30,0 +29,0 @@ "watch": "^1.0.2" |
13941
5
295