woo-email-editor
Advanced tools
Comparing version 1.0.8 to 1.0.9
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,2 +10,8 @@ value: true | ||
var htmlToImage = _interopRequireWildcard(require("html-to-image")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -27,2 +35,4 @@ | ||
_defineProperty(this, "containerEle", {}); | ||
this.$el = option.el; | ||
@@ -38,4 +48,8 @@ this.init(option); | ||
this.$iframe = document.createElement("iframe"); | ||
var containerEle = document.createElement("div"); | ||
this.containerEle = document.createElement("div"); | ||
this.$el.innerHTML = ""; | ||
this.$el.appendChild(this.$iframe); | ||
this.$el.appendChild(containerEle); | ||
containerEle.appendChild(this.containerEle); | ||
this.$iframe.style.border = "none"; | ||
@@ -45,2 +59,4 @@ this.$iframe.style.width = "100%"; | ||
this.$iframe.setAttribute("src", "https://email.t192.woodare.com/"); | ||
containerEle.style.position = "fixed"; | ||
containerEle.style.left = "-999999px"; | ||
@@ -56,2 +72,3 @@ this.$iframe.onload = function () { | ||
_this.easyEmailMap = e.data; | ||
_this.containerEle.innerHTML = e.data.html; | ||
}; | ||
@@ -72,2 +89,9 @@ } | ||
} | ||
}, { | ||
key: "getImageBase", | ||
value: function getImageBase(quality) { | ||
return htmlToImage.toJpeg(this.containerEle, { | ||
quality: quality || 0.6 | ||
}); | ||
} | ||
}]); | ||
@@ -74,0 +98,0 @@ |
{ | ||
"name": "woo-email-editor", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "", | ||
@@ -23,2 +23,3 @@ "main": "./lib/index.js", | ||
"html-loader": "^3.1.0", | ||
"html-to-image": "^1.10.8", | ||
"html-webpack-plugin": "^5.5.0", | ||
@@ -25,0 +26,0 @@ "moment": "^2.29.3", |
@@ -0,1 +1,2 @@ | ||
import * as htmlToImage from 'html-to-image'; | ||
export default class WooEmailEditor { | ||
@@ -5,2 +6,3 @@ $el = {}; | ||
easyEmailMap = {}; | ||
containerEle = {}; | ||
constructor(option){ | ||
@@ -12,4 +14,8 @@ this.$el = option.el; | ||
this.$iframe = document.createElement("iframe"); | ||
const containerEle = document.createElement("div"); | ||
this.containerEle = document.createElement("div"); | ||
this.$el.innerHTML = ""; | ||
this.$el.appendChild(this.$iframe); | ||
this.$el.appendChild(containerEle); | ||
containerEle.appendChild(this.containerEle); | ||
this.$iframe.style.border = "none"; | ||
@@ -19,2 +25,4 @@ this.$iframe.style.width = "100%"; | ||
this.$iframe.setAttribute("src","https://email.t192.woodare.com/"); | ||
containerEle.style.position = "fixed"; | ||
containerEle.style.left = "-999999px"; | ||
this.$iframe.onload = ()=>{ | ||
@@ -26,4 +34,7 @@ this.$iframe.contentWindow.postMessage({ | ||
}; | ||
window.onmessage = (e)=>{ | ||
this.easyEmailMap = e.data; | ||
this.containerEle.innerHTML = e.data.html; | ||
}; | ||
@@ -42,2 +53,5 @@ | ||
} | ||
getImageBase(quality){ | ||
return htmlToImage.toJpeg(this.containerEle,{quality:quality || 0.6}); | ||
} | ||
} |
@@ -29,3 +29,3 @@ const {CleanWebpackPlugin} = require("clean-webpack-plugin"); | ||
devServer: { | ||
port: 8081, | ||
port: 8082, | ||
host: "0.0.0.0" | ||
@@ -32,0 +32,0 @@ }, |
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
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
77029
278
15
10