react-email-editor
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -10,4 +10,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import React, { Component } from 'react'; | ||
import Script from 'react-load-script'; | ||
import { loadScript } from './loadScript'; | ||
import pkg from '../package.json'; | ||
var lastEditorId = 0; | ||
var _default = function (_Component) { | ||
@@ -25,3 +28,3 @@ _inherits(_default, _Component); | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.unlayerReady = function () { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.loadEditor = function () { | ||
var options = _this.props.options || {}; | ||
@@ -45,5 +48,9 @@ | ||
unlayer.init(_extends({}, options, { | ||
id: 'editor', | ||
displayMode: 'email' | ||
_this.editor = unlayer.createEditor(_extends({}, options, { | ||
id: _this.editorId, | ||
displayMode: 'email', | ||
source: { | ||
name: pkg.name, | ||
version: pkg.version | ||
} | ||
})); | ||
@@ -77,16 +84,20 @@ | ||
}, _this.registerCallback = function (type, callback) { | ||
unlayer.registerCallback(type, callback); | ||
_this.editor.registerCallback(type, callback); | ||
}, _this.addEventListener = function (type, callback) { | ||
unlayer.addEventListener(type, callback); | ||
_this.editor.addEventListener(type, callback); | ||
}, _this.loadDesign = function (design) { | ||
unlayer.loadDesign(design); | ||
_this.editor.loadDesign(design); | ||
}, _this.saveDesign = function (callback) { | ||
unlayer.saveDesign(callback); | ||
_this.editor.saveDesign(callback); | ||
}, _this.exportHtml = function (callback) { | ||
unlayer.exportHtml(callback); | ||
_this.editor.exportHtml(callback); | ||
}, _this.setMergeTags = function (mergeTags) { | ||
unlayer.setMergeTags(mergeTags); | ||
_this.editor.setMergeTags(mergeTags); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_default.prototype.componentDidMount = function componentDidMount() { | ||
loadScript(this.loadEditor); | ||
}; | ||
_default.prototype.render = function render() { | ||
@@ -100,17 +111,14 @@ var _props = this.props, | ||
this.editorId = 'editor-' + ++lastEditorId; | ||
return React.createElement( | ||
'div', | ||
{ style: { | ||
{ | ||
style: { | ||
flex: 1, | ||
display: 'flex', | ||
minHeight: minHeight | ||
} }, | ||
React.createElement(Script, { | ||
url: 'https://editor.unlayer.com/embed.js?1', | ||
onLoad: this.unlayerReady | ||
}), | ||
React.createElement('div', { | ||
id: 'editor', | ||
style: _extends({}, style, { flex: 1 }) | ||
}) | ||
} | ||
}, | ||
React.createElement('div', { id: this.editorId, style: _extends({}, style, { flex: 1 }) }) | ||
); | ||
@@ -117,0 +125,0 @@ }; |
@@ -12,6 +12,8 @@ 'use strict'; | ||
var _reactLoadScript = require('react-load-script'); | ||
var _loadScript = require('./loadScript'); | ||
var _reactLoadScript2 = _interopRequireDefault(_reactLoadScript); | ||
var _package = require('../package.json'); | ||
var _package2 = _interopRequireDefault(_package); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -25,2 +27,4 @@ | ||
var lastEditorId = 0; | ||
var _default = function (_Component) { | ||
@@ -38,3 +42,3 @@ _inherits(_default, _Component); | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.unlayerReady = function () { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.loadEditor = function () { | ||
var options = _this.props.options || {}; | ||
@@ -58,5 +62,9 @@ | ||
unlayer.init(_extends({}, options, { | ||
id: 'editor', | ||
displayMode: 'email' | ||
_this.editor = unlayer.createEditor(_extends({}, options, { | ||
id: _this.editorId, | ||
displayMode: 'email', | ||
source: { | ||
name: _package2.default.name, | ||
version: _package2.default.version | ||
} | ||
})); | ||
@@ -90,16 +98,20 @@ | ||
}, _this.registerCallback = function (type, callback) { | ||
unlayer.registerCallback(type, callback); | ||
_this.editor.registerCallback(type, callback); | ||
}, _this.addEventListener = function (type, callback) { | ||
unlayer.addEventListener(type, callback); | ||
_this.editor.addEventListener(type, callback); | ||
}, _this.loadDesign = function (design) { | ||
unlayer.loadDesign(design); | ||
_this.editor.loadDesign(design); | ||
}, _this.saveDesign = function (callback) { | ||
unlayer.saveDesign(callback); | ||
_this.editor.saveDesign(callback); | ||
}, _this.exportHtml = function (callback) { | ||
unlayer.exportHtml(callback); | ||
_this.editor.exportHtml(callback); | ||
}, _this.setMergeTags = function (mergeTags) { | ||
unlayer.setMergeTags(mergeTags); | ||
_this.editor.setMergeTags(mergeTags); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_default.prototype.componentDidMount = function componentDidMount() { | ||
(0, _loadScript.loadScript)(this.loadEditor); | ||
}; | ||
_default.prototype.render = function render() { | ||
@@ -113,17 +125,14 @@ var _props = this.props, | ||
this.editorId = 'editor-' + ++lastEditorId; | ||
return _react2.default.createElement( | ||
'div', | ||
{ style: { | ||
{ | ||
style: { | ||
flex: 1, | ||
display: 'flex', | ||
minHeight: minHeight | ||
} }, | ||
_react2.default.createElement(_reactLoadScript2.default, { | ||
url: 'https://editor.unlayer.com/embed.js?1', | ||
onLoad: this.unlayerReady | ||
}), | ||
_react2.default.createElement('div', { | ||
id: 'editor', | ||
style: _extends({}, style, { flex: 1 }) | ||
}) | ||
} | ||
}, | ||
_react2.default.createElement('div', { id: this.editorId, style: _extends({}, style, { flex: 1 }) }) | ||
); | ||
@@ -130,0 +139,0 @@ }; |
{ | ||
"name": "react-email-editor", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Unlayer's Email Editor Component for React.js", | ||
@@ -19,7 +19,6 @@ "main": "lib/index.js", | ||
"test:coverage": "nwb test-react --coverage", | ||
"test:watch": "nwb test-react --server" | ||
"test:watch": "nwb test-react --server", | ||
"release": "npm run build && npm publish" | ||
}, | ||
"dependencies": { | ||
"react-load-script": "^0.0.6" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
@@ -26,0 +25,0 @@ "react": "15.x || 16.x" |
@@ -87,5 +87,7 @@ # React Email Editor | ||
[![Custom Tools](https://unlayer.com/assets/images/features/custom_tools.png)](https://docs.unlayer.com/docs/custom-tools) | ||
[![Custom Tools](https://unroll-assets.s3.amazonaws.com/custom_tools.png)](https://docs.unlayer.com/docs/custom-tools) | ||
## Localization | ||
@@ -97,2 +99,2 @@ | ||
Copyright (c) 2019 Unlayer. [MIT](LICENSE) Licensed. | ||
Copyright (c) 2020 Unlayer. [MIT](LICENSE) Licensed. |
/*! | ||
* react-email-editor v1.0.0 - https://github.com/unlayer/react-email-editor#readme | ||
* react-email-editor v1.1.0 - https://github.com/unlayer/react-email-editor#readme | ||
* MIT Licensed | ||
@@ -83,3 +83,3 @@ */ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 8); | ||
/******/ return __webpack_require__(__webpack_require__.s = 3); | ||
/******/ }) | ||
@@ -95,409 +95,90 @@ /************************************************************************/ | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/***/ (function(module) { | ||
"use strict"; | ||
module.exports = {"name":"react-email-editor","version":"1.1.0","description":"Unlayer's Email Editor Component for React.js","main":"lib/index.js","module":"es/index.js","files":["css","es","lib","umd"],"scripts":{"build":"nwb build-react-component","clean":"nwb clean-module && nwb clean-demo","start":"nwb serve-react-demo","test":"nwb test-react","test:coverage":"nwb test-react --coverage","test:watch":"nwb test-react --server","release":"npm run build && npm publish"},"dependencies":{},"peerDependencies":{"react":"15.x || 16.x"},"devDependencies":{"nwb":"^0.22.0","react":"^16.8.6","react-dom":"^16.8.6","styled-components":"^4.2.0"},"author":"","homepage":"https://github.com/unlayer/react-email-editor#readme","license":"MIT","repository":"https://github.com/unlayer/react-email-editor.git","keywords":["react-component"]}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = __webpack_require__(0); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = __webpack_require__(6); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Script = function (_React$Component) { | ||
_inherits(Script, _React$Component); | ||
// A dictionary mapping script URL to a boolean value indicating if the script | ||
// has failed to load. | ||
// A dictionary mapping script URLs to a dictionary mapping | ||
// component key to component for all components that are waiting | ||
// for the script to load. | ||
function Script(props) { | ||
_classCallCheck(this, Script); | ||
var _this = _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).call(this, props)); | ||
_this.scriptLoaderId = 'id' + _this.constructor.idCount++; // eslint-disable-line space-unary-ops, no-plusplus | ||
return _this; | ||
} | ||
// A counter used to generate a unique id for each component that uses | ||
// ScriptLoaderMixin. | ||
// A dictionary mapping script URL to a boolean value indicating if the script | ||
// has already been loaded. | ||
_createClass(Script, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
var _props = this.props, | ||
onError = _props.onError, | ||
onLoad = _props.onLoad, | ||
url = _props.url; | ||
if (this.constructor.loadedScripts[url]) { | ||
onLoad(); | ||
return; | ||
} | ||
if (this.constructor.erroredScripts[url]) { | ||
onError(); | ||
return; | ||
} | ||
// If the script is loading, add the component to the script's observers | ||
// and return. Otherwise, initialize the script's observers with the component | ||
// and start loading the script. | ||
if (this.constructor.scriptObservers[url]) { | ||
this.constructor.scriptObservers[url][this.scriptLoaderId] = this.props; | ||
return; | ||
} | ||
this.constructor.scriptObservers[url] = _defineProperty({}, this.scriptLoaderId, this.props); | ||
this.createScript(); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
var url = this.props.url; | ||
var observers = this.constructor.scriptObservers[url]; | ||
// If the component is waiting for the script to load, remove the | ||
// component from the script's observers before unmounting the component. | ||
if (observers) { | ||
delete observers[this.scriptLoaderId]; | ||
} | ||
} | ||
}, { | ||
key: 'createScript', | ||
value: function createScript() { | ||
var _this2 = this; | ||
var _props2 = this.props, | ||
onCreate = _props2.onCreate, | ||
url = _props2.url, | ||
attributes = _props2.attributes; | ||
var script = document.createElement('script'); | ||
onCreate(); | ||
// add 'data-' or non standard attributes to the script tag | ||
if (attributes) { | ||
Object.keys(attributes).forEach(function (prop) { | ||
return script.setAttribute(prop, attributes[prop]); | ||
}); | ||
} | ||
script.src = url; | ||
// default async to true if not set with custom attributes | ||
if (!script.hasAttribute('async')) { | ||
script.async = 1; | ||
} | ||
var callObserverFuncAndRemoveObserver = function callObserverFuncAndRemoveObserver(shouldRemoveObserver) { | ||
var observers = _this2.constructor.scriptObservers[url]; | ||
Object.keys(observers).forEach(function (key) { | ||
if (shouldRemoveObserver(observers[key])) { | ||
delete _this2.constructor.scriptObservers[url][_this2.scriptLoaderId]; | ||
} | ||
}); | ||
}; | ||
script.onload = function () { | ||
_this2.constructor.loadedScripts[url] = true; | ||
callObserverFuncAndRemoveObserver(function (observer) { | ||
observer.onLoad(); | ||
return true; | ||
}); | ||
}; | ||
script.onerror = function () { | ||
_this2.constructor.erroredScripts[url] = true; | ||
callObserverFuncAndRemoveObserver(function (observer) { | ||
observer.onError(); | ||
return true; | ||
}); | ||
}; | ||
document.body.appendChild(script); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return null; | ||
} | ||
}]); | ||
return Script; | ||
}(_react2.default.Component); | ||
Script.propTypes = { | ||
attributes: _propTypes.PropTypes.object, // eslint-disable-line react/forbid-prop-types | ||
onCreate: _propTypes.PropTypes.func, | ||
onError: _propTypes.PropTypes.func.isRequired, | ||
onLoad: _propTypes.PropTypes.func.isRequired, | ||
url: _propTypes.PropTypes.string.isRequired | ||
}; | ||
Script.defaultProps = { | ||
attributes: {}, | ||
onCreate: function onCreate() {}, | ||
onError: function onError() {}, | ||
onLoad: function onLoad() {} }; | ||
Script.scriptObservers = {}; | ||
Script.loadedScripts = {}; | ||
Script.erroredScripts = {}; | ||
Script.idCount = 0; | ||
exports.default = Script; | ||
module.exports = exports['default']; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
__webpack_require__.r(__webpack_exports__); | ||
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"} | ||
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(0); | ||
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_); | ||
// CONCATENATED MODULE: ./src/loadScript.js | ||
var scriptUrl = '//editor.unlayer.com/embed.js?2'; | ||
var callbacks = []; | ||
var loaded = false; | ||
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
var isScriptInjected = function isScriptInjected() { | ||
var scripts = document.querySelectorAll('script'); | ||
var injected = false; | ||
module.exports = ReactPropTypesSecret; | ||
scripts.forEach(function (script) { | ||
if (script.src.includes(scriptUrl)) { | ||
injected = true; | ||
} | ||
}); | ||
return injected; | ||
}; | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var addCallback = function addCallback(callback) { | ||
callbacks.push(callback); | ||
}; | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
var runCallbacks = function runCallbacks() { | ||
if (loaded) { | ||
var callback = void 0; | ||
/** | ||
* Use invariant() to assert state which your program assumes to be true. | ||
* | ||
* Provide sprintf-style format (only %s is supported) and arguments | ||
* to provide information about what broke and what you were | ||
* expecting. | ||
* | ||
* The invariant message will be stripped in production, but the invariant | ||
* will remain to ensure logic does not differ in production. | ||
*/ | ||
var validateFormat = function validateFormat(format) {}; | ||
if (false) {} | ||
function invariant(condition, format, a, b, c, d, e, f) { | ||
validateFormat(format); | ||
if (!condition) { | ||
var error; | ||
if (format === undefined) { | ||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
} else { | ||
var args = [a, b, c, d, e, f]; | ||
var argIndex = 0; | ||
error = new Error(format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
})); | ||
error.name = 'Invariant Violation'; | ||
while (callback = callbacks.shift()) { | ||
callback(); | ||
} | ||
error.framesToPop = 1; // we don't care about invariant's own frame | ||
throw error; | ||
} | ||
} | ||
module.exports = invariant; | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
function makeEmptyFunction(arg) { | ||
return function () { | ||
return arg; | ||
}; | ||
} | ||
/** | ||
* This function accepts and discards inputs; it has no side effects. This is | ||
* primarily useful idiomatically for overridable function endpoints which | ||
* always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
*/ | ||
var emptyFunction = function emptyFunction() {}; | ||
emptyFunction.thatReturns = makeEmptyFunction; | ||
emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
emptyFunction.thatReturnsThis = function () { | ||
return this; | ||
}; | ||
emptyFunction.thatReturnsArgument = function (arg) { | ||
return arg; | ||
}; | ||
module.exports = emptyFunction; | ||
var loadScript = function loadScript(callback) { | ||
addCallback(callback); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var emptyFunction = __webpack_require__(4); | ||
var invariant = __webpack_require__(3); | ||
var ReactPropTypesSecret = __webpack_require__(2); | ||
module.exports = function() { | ||
function shim(props, propName, componentName, location, propFullName, secret) { | ||
if (secret === ReactPropTypesSecret) { | ||
// It is still safe when called from React. | ||
return; | ||
} | ||
invariant( | ||
false, | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
'Use PropTypes.checkPropTypes() to call them. ' + | ||
'Read more at http://fb.me/use-check-prop-types' | ||
); | ||
}; | ||
shim.isRequired = shim; | ||
function getShim() { | ||
return shim; | ||
}; | ||
// Important! | ||
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. | ||
var ReactPropTypes = { | ||
array: shim, | ||
bool: shim, | ||
func: shim, | ||
number: shim, | ||
object: shim, | ||
string: shim, | ||
symbol: shim, | ||
any: shim, | ||
arrayOf: getShim, | ||
element: shim, | ||
instanceOf: getShim, | ||
node: shim, | ||
objectOf: getShim, | ||
oneOf: getShim, | ||
oneOfType: getShim, | ||
shape: getShim, | ||
exact: getShim | ||
}; | ||
ReactPropTypes.checkPropTypes = emptyFunction; | ||
ReactPropTypes.PropTypes = ReactPropTypes; | ||
return ReactPropTypes; | ||
if (!isScriptInjected()) { | ||
var embedScript = document.createElement('script'); | ||
embedScript.setAttribute('src', scriptUrl); | ||
embedScript.onload = function () { | ||
loaded = true; | ||
runCallbacks(); | ||
}; | ||
document.head.appendChild(embedScript); | ||
} else { | ||
runCallbacks(); | ||
} | ||
}; | ||
// EXTERNAL MODULE: ./package.json | ||
var package_0 = __webpack_require__(1); | ||
// CONCATENATED MODULE: ./src/index.js | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return src_default; }); | ||
var src_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
function src_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
function src_possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
if (false) { var throwOnDirectAccess, isValidElement, REACT_ELEMENT_TYPE; } else { | ||
// By explicitly using `prop-types` you are opting into new production behavior. | ||
// http://fb.me/prop-types-in-prod | ||
module.exports = __webpack_require__(5)(); | ||
} | ||
function src_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _default; }); | ||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); | ||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var react_load_script__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); | ||
/* harmony import */ var react_load_script__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_load_script__WEBPACK_IMPORTED_MODULE_1__); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var src_lastEditorId = 0; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var src_default = function (_Component) { | ||
src_inherits(_default, _Component); | ||
var _default = function (_Component) { | ||
_inherits(_default, _Component); | ||
function _default() { | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, _default); | ||
src_classCallCheck(this, _default); | ||
@@ -508,3 +189,3 @@ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.unlayerReady = function () { | ||
return _ret = (_temp = (_this = src_possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.loadEditor = function () { | ||
var options = _this.props.options || {}; | ||
@@ -528,5 +209,9 @@ | ||
unlayer.init(_extends({}, options, { | ||
id: 'editor', | ||
displayMode: 'email' | ||
_this.editor = unlayer.createEditor(src_extends({}, options, { | ||
id: _this.editorId, | ||
displayMode: 'email', | ||
source: { | ||
name: package_0.name, | ||
version: package_0.version | ||
} | ||
})); | ||
@@ -560,16 +245,20 @@ | ||
}, _this.registerCallback = function (type, callback) { | ||
unlayer.registerCallback(type, callback); | ||
_this.editor.registerCallback(type, callback); | ||
}, _this.addEventListener = function (type, callback) { | ||
unlayer.addEventListener(type, callback); | ||
_this.editor.addEventListener(type, callback); | ||
}, _this.loadDesign = function (design) { | ||
unlayer.loadDesign(design); | ||
_this.editor.loadDesign(design); | ||
}, _this.saveDesign = function (callback) { | ||
unlayer.saveDesign(callback); | ||
_this.editor.saveDesign(callback); | ||
}, _this.exportHtml = function (callback) { | ||
unlayer.exportHtml(callback); | ||
_this.editor.exportHtml(callback); | ||
}, _this.setMergeTags = function (mergeTags) { | ||
unlayer.setMergeTags(mergeTags); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
_this.editor.setMergeTags(mergeTags); | ||
}, _temp), src_possibleConstructorReturn(_this, _ret); | ||
} | ||
_default.prototype.componentDidMount = function componentDidMount() { | ||
loadScript(this.loadEditor); | ||
}; | ||
_default.prototype.render = function render() { | ||
@@ -583,17 +272,14 @@ var _props = this.props, | ||
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement( | ||
this.editorId = 'editor-' + ++src_lastEditorId; | ||
return external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement( | ||
'div', | ||
{ style: { | ||
{ | ||
style: { | ||
flex: 1, | ||
display: 'flex', | ||
minHeight: minHeight | ||
} }, | ||
react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_load_script__WEBPACK_IMPORTED_MODULE_1___default.a, { | ||
url: 'https://editor.unlayer.com/embed.js?1', | ||
onLoad: this.unlayerReady | ||
}), | ||
react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('div', { | ||
id: 'editor', | ||
style: _extends({}, style, { flex: 1 }) | ||
}) | ||
} | ||
}, | ||
external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement('div', { id: this.editorId, style: src_extends({}, style, { flex: 1 }) }) | ||
); | ||
@@ -603,3 +289,3 @@ }; | ||
return _default; | ||
}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); | ||
}(external_root_React_commonjs2_react_commonjs_react_amd_react_["Component"]); | ||
@@ -609,6 +295,6 @@ | ||
/***/ }), | ||
/* 8 */ | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(7); | ||
module.exports = __webpack_require__(2); | ||
@@ -615,0 +301,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.EmailEditor=t(require("react")):e.EmailEditor=t(e.React)}(window,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),s=(n=i)&&n.__esModule?n:{default:n},c=r(6);var a=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.scriptLoaderId="id"+r.constructor.idCount++,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default.Component),o(t,[{key:"componentDidMount",value:function(){var e,t,r,n=this.props,o=n.onError,i=n.onLoad,s=n.url;this.constructor.loadedScripts[s]?i():this.constructor.erroredScripts[s]?o():this.constructor.scriptObservers[s]?this.constructor.scriptObservers[s][this.scriptLoaderId]=this.props:(this.constructor.scriptObservers[s]=(e={},t=this.scriptLoaderId,r=this.props,t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e),this.createScript())}},{key:"componentWillUnmount",value:function(){var e=this.props.url,t=this.constructor.scriptObservers[e];t&&delete t[this.scriptLoaderId]}},{key:"createScript",value:function(){var e=this,t=this.props,r=t.onCreate,n=t.url,o=t.attributes,i=document.createElement("script");r(),o&&Object.keys(o).forEach(function(e){return i.setAttribute(e,o[e])}),i.src=n,i.hasAttribute("async")||(i.async=1);var s=function(t){var r=e.constructor.scriptObservers[n];Object.keys(r).forEach(function(o){t(r[o])&&delete e.constructor.scriptObservers[n][e.scriptLoaderId]})};i.onload=function(){e.constructor.loadedScripts[n]=!0,s(function(e){return e.onLoad(),!0})},i.onerror=function(){e.constructor.erroredScripts[n]=!0,s(function(e){return e.onError(),!0})},document.body.appendChild(i)}},{key:"render",value:function(){return null}}]),t}();a.propTypes={attributes:c.PropTypes.object,onCreate:c.PropTypes.func,onError:c.PropTypes.func.isRequired,onLoad:c.PropTypes.func.isRequired,url:c.PropTypes.string.isRequired},a.defaultProps={attributes:{},onCreate:function(){},onError:function(){},onLoad:function(){}},a.scriptObservers={},a.loadedScripts={},a.erroredScripts={},a.idCount=0,t.default=a,e.exports=t.default},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";var n=function(e){};e.exports=function(e,t,r,o,i,s,c,a){if(n(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[r,o,i,s,c,a],l=0;(u=new Error(t.replace(/%s/g,function(){return p[l++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(e,t,r){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,r){"use strict";var n=r(4),o=r(3),i=r(2);e.exports=function(){function e(e,t,r,n,s,c){c!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){e.exports=r(5)()},function(e,t,r){"use strict";r.r(t),r.d(t,"default",function(){return u});var n=r(0),o=r.n(n),i=r(1),s=r.n(i),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var u=function(e){function t(){var r,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=n=a(this,e.call.apply(e,[this].concat(i))),n.unlayerReady=function(){var e=n.props.options||{};n.props.projectId&&(e.projectId=n.props.projectId),n.props.tools&&(e.tools=n.props.tools),n.props.appearance&&(e.appearance=n.props.appearance),n.props.locale&&(e.locale=n.props.locale),unlayer.init(c({},e,{id:"editor",displayMode:"email"}));var t=Object.entries(n.props),r=Array.isArray(t),o=0;for(t=r?t:t[Symbol.iterator]();;){var i;if(r){if(o>=t.length)break;i=t[o++]}else{if((o=t.next()).done)break;i=o.value}var s=i,a=s[0],u=s[1];/^on/.test(a)&&"onLoad"!=a&&n.addEventListener(a,u)}var p=n.props.onLoad;p&&p()},n.registerCallback=function(e,t){unlayer.registerCallback(e,t)},n.addEventListener=function(e,t){unlayer.addEventListener(e,t)},n.loadDesign=function(e){unlayer.loadDesign(e)},n.saveDesign=function(e){unlayer.saveDesign(e)},n.exportHtml=function(e){unlayer.exportHtml(e)},n.setMergeTags=function(e){unlayer.setMergeTags(e)},a(n,r)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.render=function(){var e=this.props,t=e.minHeight,r=void 0===t?500:t,n=e.style,i=void 0===n?{}:n;return o.a.createElement("div",{style:{flex:1,display:"flex",minHeight:r}},o.a.createElement(s.a,{url:"https://editor.unlayer.com/embed.js?1",onLoad:this.unlayerReady}),o.a.createElement("div",{id:"editor",style:c({},i,{flex:1})}))},t}(n.Component)},function(e,t,r){e.exports=r(7)}]).default}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.EmailEditor=t(require("react")):e.EmailEditor=t(e.React)}(window,function(e){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(t,r){t.exports=e},function(e){e.exports={name:"react-email-editor",version:"1.1.0",description:"Unlayer's Email Editor Component for React.js",main:"lib/index.js",module:"es/index.js",files:["css","es","lib","umd"],scripts:{build:"nwb build-react-component",clean:"nwb clean-module && nwb clean-demo",start:"nwb serve-react-demo",test:"nwb test-react","test:coverage":"nwb test-react --coverage","test:watch":"nwb test-react --server",release:"npm run build && npm publish"},dependencies:{},peerDependencies:{react:"15.x || 16.x"},devDependencies:{nwb:"^0.22.0",react:"^16.8.6","react-dom":"^16.8.6","styled-components":"^4.2.0"},author:"",homepage:"https://github.com/unlayer/react-email-editor#readme",license:"MIT",repository:"https://github.com/unlayer/react-email-editor.git",keywords:["react-component"]}},function(e,t,r){"use strict";r.r(t);var o=r(0),n=r.n(o),i="//editor.unlayer.com/embed.js?2",a=[],c=!1,s=function(){if(c)for(var e=void 0;e=a.shift();)e()},p=function(e){if(function(e){a.push(e)}(e),r=!1,document.querySelectorAll("script").forEach(function(e){e.src.includes(i)&&(r=!0)}),r)s();else{var t=document.createElement("script");t.setAttribute("src",i),t.onload=function(){c=!0,s()},document.head.appendChild(t)}var r},l=r(1);r.d(t,"default",function(){return m});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e};function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var f=0,m=function(e){function t(){var r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=o=d(this,e.call.apply(e,[this].concat(i))),o.loadEditor=function(){var e=o.props.options||{};o.props.projectId&&(e.projectId=o.props.projectId),o.props.tools&&(e.tools=o.props.tools),o.props.appearance&&(e.appearance=o.props.appearance),o.props.locale&&(e.locale=o.props.locale),o.editor=unlayer.createEditor(u({},e,{id:o.editorId,displayMode:"email",source:{name:l.name,version:l.version}}));var t=Object.entries(o.props),r=Array.isArray(t),n=0;for(t=r?t:t[Symbol.iterator]();;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var a=i,c=a[0],s=a[1];/^on/.test(c)&&"onLoad"!=c&&o.addEventListener(c,s)}var p=o.props.onLoad;p&&p()},o.registerCallback=function(e,t){o.editor.registerCallback(e,t)},o.addEventListener=function(e,t){o.editor.addEventListener(e,t)},o.loadDesign=function(e){o.editor.loadDesign(e)},o.saveDesign=function(e){o.editor.saveDesign(e)},o.exportHtml=function(e){o.editor.exportHtml(e)},o.setMergeTags=function(e){o.editor.setMergeTags(e)},d(o,r)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentDidMount=function(){p(this.loadEditor)},t.prototype.render=function(){var e=this.props,t=e.minHeight,r=void 0===t?500:t,o=e.style,i=void 0===o?{}:o;return this.editorId="editor-"+ ++f,n.a.createElement("div",{style:{flex:1,display:"flex",minHeight:r}},n.a.createElement("div",{id:this.editorId,style:u({},i,{flex:1})}))},t}(o.Component)},function(e,t,r){e.exports=r(2)}]).default}); | ||
//# sourceMappingURL=react-email-editor.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
10
99
42412
541
1
- Removedreact-load-script@^0.0.6
- Removedreact-load-script@0.0.6(transitive)