From 54e93c6bef7a1d0526fea8f3941cccefe7e55a7e Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Tue, 21 May 2019 15:52:55 -0500 Subject: [PATCH] Prepare for 2.8.0 release --- README.md | 2 +- bower.json | 10 +++--- dist/dom-to-image-more.min.js | 5 +-- package-lock.json | 61 ++++++++++++++++++++--------------- package.json | 8 +++-- src/dom-to-image-more.js | 6 +++- 6 files changed, 55 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 101ee198..a43d26c8 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ for you, following steps are taken: ## Authors Marc Brooks, Anatolii Saienko (original dom-to-image), Paul Bakaus (original idea), -Aidas Klimas (fixes) +Aidas Klimas (fixes), Edgardo Di Gesto (fixes), 樊冬 Fan Dong (fixes) ## License diff --git a/bower.json b/bower.json index 28f9e967..ea92508d 100644 --- a/bower.json +++ b/bower.json @@ -1,12 +1,14 @@ { "name": "dom-to-image-more", - "version": "2.7.7", + "version": "2.8.0", "homepage": "https://github.com/1904labs/dom-to-image-more", "authors": [ "Marc Brooks ", "Daniel Fischer ", "Anatolii Saienko ", - "Aidas Klimas" + "Aidas Klimas", + "Edgardo Di Gesto", + "樊冬 Fan Dong " ], "description": "Generates an image from a DOM node using HTML5 canvas and SVG", "main": "src/dom-to-image-more.js", @@ -31,7 +33,7 @@ ], "devDependencies": { "js-imagediff": "~1.0.8", - "jquery": "~2.1.3", - "fontawesome": "~4.4.0" + "jquery": "~3.4.1", + "fontawesome": "~5.8.2" } } \ No newline at end of file diff --git a/dist/dom-to-image-more.min.js b/dist/dom-to-image-more.min.js index c893456a..a33fadd9 100644 --- a/dist/dom-to-image-more.min.js +++ b/dist/dom-to-image-more.min.js @@ -1,2 +1,3 @@ -/*! dom-to-image-more 17-08-2018 */ -!function(a){"use strict";function b(a,b){function c(a){return b.bgcolor&&(a.style.backgroundColor=b.bgcolor),b.width&&(a.style.width=b.width+"px"),b.height&&(a.style.height=b.height+"px"),b.style&&Object.keys(b.style).forEach(function(c){a.style[c]=b.style[c]}),a}return b=b||{},g(b),Promise.resolve(a).then(function(a){return i(a,b.filter,!0)}).then(j).then(k).then(c).then(function(c){return l(c,b.width||q.width(a),b.height||q.height(a))})}function c(a,b){return h(a,b||{}).then(function(b){return b.getContext("2d").getImageData(0,0,q.width(a),q.height(a)).data})}function d(a,b){return h(a,b||{}).then(function(a){return a.toDataURL()})}function e(a,b){return b=b||{},h(a,b).then(function(a){return a.toDataURL("image/jpeg",b.quality||1)})}function f(a,b){return h(a,b||{}).then(q.canvasToBlob)}function g(a){"undefined"==typeof a.imagePlaceholder?v.impl.options.imagePlaceholder=u.imagePlaceholder:v.impl.options.imagePlaceholder=a.imagePlaceholder,"undefined"==typeof a.cacheBust?v.impl.options.cacheBust=u.cacheBust:v.impl.options.cacheBust=a.cacheBust}function h(a,c){function d(a,b){var d=document.createElement("canvas");if(d.width=(c.width||q.width(a))*b,d.height=(c.height||q.height(a))*b,c.bgcolor){var e=d.getContext("2d");e.fillStyle=c.bgcolor,e.fillRect(0,0,d.width,d.height)}return d}return b(a,c).then(q.makeImage).then(q.delay(100)).then(function(b){var e="number"!=typeof c.scale?1:c.scale,f=d(a,e),g=f.getContext("2d");return g.scale(e,e),g.drawImage(b,0,0),f})}function i(a,b,c){function d(a){return a instanceof HTMLCanvasElement?q.makeImage(a.toDataURL()):a.cloneNode(!1)}function e(a,b,c){function d(a,b,c){var d=Promise.resolve();return b.forEach(function(b){d=d.then(function(){return i(b,c)}).then(function(b){b&&a.appendChild(b)})}),d}var e=a.childNodes;return 0===e.length?Promise.resolve(b):d(b,q.asArray(e),c).then(function(){return b})}function f(a,b){function c(){function c(a,b){function c(a,b){q.asArray(a).forEach(function(c){b.setProperty(c,a.getPropertyValue(c),a.getPropertyPriority(c))})}a.cssText?(b.cssText=a.cssText,b.font=a.font):c(a,b)}c(window.getComputedStyle(a),b.style)}function d(){function c(c){function d(a,b,c){function d(a){var b=a.getPropertyValue("content");return a.cssText+" content: "+b+";"}function e(a){function b(b){return b+": "+a.getPropertyValue(b)+(a.getPropertyPriority(b)?" !important":"")}return q.asArray(a).map(b).join("; ")+";"}var f="."+a+":"+b,g=c.cssText?d(c):e(c);return document.createTextNode(f+"{"+g+"}")}var e=window.getComputedStyle(a,c),f=e.getPropertyValue("content");if(""!==f&&"none"!==f){var g=q.uid();b.className=b.className+" "+g;var h=document.createElement("style");h.appendChild(d(g,c,e)),b.appendChild(h)}}[":before",":after"].forEach(function(a){c(a)})}function e(){a instanceof HTMLTextAreaElement&&(b.innerHTML=a.value),a instanceof HTMLInputElement&&b.setAttribute("value",a.value)}function f(){b instanceof SVGElement&&(b.setAttribute("xmlns","http://www.w3.org/2000/svg"),b instanceof SVGRectElement&&["width","height"].forEach(function(a){var c=b.getAttribute(a);c&&b.style.setProperty(a,c)}))}return b instanceof Element?Promise.resolve().then(c).then(d).then(e).then(f).then(function(){return b}):b}return c||!b||b(a)?Promise.resolve(a).then(d).then(function(c){return e(a,c,b)}).then(function(b){return f(a,b)}):Promise.resolve()}function j(a){return s.resolveAll().then(function(b){var c=document.createElement("style");return a.appendChild(c),c.appendChild(document.createTextNode(b)),a})}function k(a){return t.inlineAll(a).then(function(){return a})}function l(a,b,c){return Promise.resolve(a).then(function(a){return a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(a)}).then(q.escapeXhtml).then(function(a){return''+a+""}).then(function(a){return''+a+""}).then(function(a){return"data:image/svg+xml;charset=utf-8,"+a})}function m(){function a(){var a="application/font-woff",b="image/jpeg";return{woff:a,woff2:a,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:b,jpeg:b,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}function b(a){var b=/\.([^\.\/]*?)$/g.exec(a);return b?b[1]:""}function c(c){var d=b(c).toLowerCase();return a()[d]||""}function d(a){return a.search(/^(data:)/)!==-1}function e(a){return new Promise(function(b){for(var c=window.atob(a.toDataURL().split(",")[1]),d=c.length,e=new Uint8Array(d),f=0;f'+e+""}).then(function(e){return''+e+""}).then(function(e){return"data:image/svg+xml;charset=utf-8,"+e})}(e,n.width||s.width(t),n.height||s.height(t))})}function i(o,i){return a(o,i).then(s.makeImage).then(s.delay(100)).then(function(e){var t="number"!=typeof i.scale?1:i.scale,n=function(e,t){var n=document.createElement("canvas");if(n.width=(i.width||s.width(e))*t,n.height=(i.height||s.height(e))*t,i.bgcolor){var r=n.getContext("2d");r.fillStyle=i.bgcolor,r.fillRect(0,0,n.width,n.height)}return n}(o,t),r=n.getContext("2d");return e&&(r.scale(t,t),r.drawImage(e,0,0)),n})}function c(n){return t.resolveAll().then(function(e){var t=document.createElement("style");return n.appendChild(t),t.appendChild(document.createTextNode(e)),n})}function l(e){return n.inlineAll(e).then(function(){return e})}"object"==typeof exports&&"object"==typeof module?module.exports=u:e.domtoimage=u}(this); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index dc319bc7..ac15ba09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dom-to-image-more", - "version": "2.7.7", + "version": "2.8.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1530,7 +1530,8 @@ "version": "2.1.1", "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -1554,13 +1555,15 @@ "version": "1.0.0", "resolved": false, "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "resolved": false, "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1577,19 +1580,22 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "resolved": false, "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "resolved": false, "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -1720,7 +1726,8 @@ "version": "2.0.3", "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -1734,6 +1741,7 @@ "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1750,6 +1758,7 @@ "resolved": false, "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1758,13 +1767,15 @@ "version": "0.0.8", "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "resolved": false, "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -1785,6 +1796,7 @@ "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -1873,7 +1885,8 @@ "version": "1.0.1", "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -1887,6 +1900,7 @@ "resolved": false, "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -1982,7 +1996,8 @@ "version": "5.1.2", "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -2024,6 +2039,7 @@ "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2045,6 +2061,7 @@ "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2093,13 +2110,15 @@ "version": "1.0.2", "resolved": false, "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "resolved": false, "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true + "dev": true, + "optional": true } } }, @@ -3404,9 +3423,9 @@ } }, "mocha": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.1.3.tgz", - "integrity": "sha512-QdE/w//EPHrqgT5PNRUjRVHy6IJAzAf1R8n2O8W8K2RZ+NbPfOD5cBDp+PGa2Gptep37C/TdBiaNwakppEzEbg==", + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.1.4.tgz", + "integrity": "sha512-PN8CIy4RXsIoxoFJzS4QNnCH4psUCPWc4/rPrst/ecSJJbLBkubMiyGCP2Kj/9YnWbotFqAoeXyXMucj7gwCFg==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -3418,7 +3437,7 @@ "glob": "7.1.3", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "3.13.0", + "js-yaml": "3.13.1", "log-symbols": "2.2.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", @@ -3466,16 +3485,6 @@ "path-is-absolute": "^1.0.0" } }, - "js-yaml": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz", - "integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", diff --git a/package.json b/package.json index 0cf320d1..5bfa57a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dom-to-image-more", - "version": "2.7.7", + "version": "2.8.0", "description": "Generates an image from a DOM node using HTML5 canvas and SVG", "main": "src/dom-to-image-more.js", "dependencies": {}, @@ -19,7 +19,7 @@ "karma-firefox-launcher": "^1.1.0", "karma-mocha": "^1.3.0", "karma-mocha-reporter": "^2.2.5", - "mocha": "^6.1.3" + "mocha": "^6.1.4" }, "scripts": { "test": "./node_modules/.bin/grunt test" @@ -42,7 +42,9 @@ "Anatolii Saienko ", "Marc Brooks ", "Daniel Fischer ", - "Aidas Klimas" + "Aidas Klimas", + "Edgardo Di Gesto", + "樊冬 Fan Dong " ], "license": "MIT", "bugs": { diff --git a/src/dom-to-image-more.js b/src/dom-to-image-more.js index 21c8dccb..e299b243 100644 --- a/src/dom-to-image-more.js +++ b/src/dom-to-image-more.js @@ -282,7 +282,11 @@ if (content === '' || content === 'none') return; var className = util.uid(); - clone.className = clone.className + ' ' + className; + var currentClass = clone.getAttribute('class'); + if (currentClass) { + clone.setAttribute('class', currentClass + ' ' + className); + } + var styleElement = document.createElement('style'); styleElement.appendChild(formatPseudoElementStyle(className, element, style)); clone.appendChild(styleElement);