quill-html-edit-button
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -1,1 +0,1 @@ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("Quill"));else if("function"==typeof define&&define.amd)define(["Quill"],e);else{var n="object"==typeof exports?e(require("Quill")):e(t.Quill);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=7)}([function(t,e,n){"use strict";n.r(e),n.d(e,"htmlEditButton",(function(){return l}));n(1);function r(t){return document.createElement(t)}function o(t,e,n){return t.setAttribute(e,n)}var i=!1,a={prefixString:function(){return"</> quill-html-edit-button: "},get log(){return i?console.log.bind(console,this.prefixString()):function(){}}},l=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i=n&&n.debug,a.log("logging enabled");var l=e.container.parentElement.querySelectorAll(".ql-toolbar");(l=[].slice.call(l)).forEach((function(t){var n=r("span");o(n,"class","ql-formats");var i=r("button");i.innerHTML="<>",i.title="Show HTML source",i.onclick=function(t){t.preventDefault(),function(t){var e=t.container.querySelector(".ql-editor").innerHTML,n=r("div"),i=r("div");o(i,"class","ql-html-overlayContainer"),o(n,"class","ql-html-popupContainer");var l=r("i");o(l,"class","ql-html-popupTitle"),l.innerText='Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced';var u=r("div");u.appendChild(l),o(u,"class","ql-html-textContainer");var s=r("textarea");o(s,"class","ql-html-textArea"),s.value=function(t){for(var e=" ".repeat(2),n=0,r=null,o=null,i="",l=0;l<=t.length;l++){r=t.substr(l,1),o=t.substr(l+1,1);var u="<br>"===t.substr(l,4),s="<"===r&&"/"===o&&!u;u&&(i+="\n",n--,l+=4),"<"===r&&"/"!==o&&!u?(i+="\n"+e.repeat(n),n++):s?(--n<0&&(n=0),i+="\n"+e.repeat(n)):(" "===r&&" "===o||"\n"===r&&""===t.substr(l,t.substr(l).indexOf("<")).trim())&&(r=""),i+=r}return a.log("formatHTML",{before:t,after:i}),i}(e);var c=r("button");c.innerHTML="Cancel",o(c,"class","ql-html-buttonCancel");var f=r("button");f.innerHTML="Ok";var p=r("div");o(p,"class","ql-html-buttonGroup"),p.appendChild(c),p.appendChild(f),u.appendChild(s),u.appendChild(p),n.appendChild(u),i.appendChild(n),document.body.appendChild(i),c.onclick=function(){document.body.removeChild(i)},i.onclick=c.onclick,n.onclick=function(t){t.preventDefault(),t.stopPropagation()},f.onclick=function(){var e=s.value.split(/\r?\n/g).map((function(t){return t.trim()})).join("");t.container.querySelector(".ql-editor").innerHTML=e,document.body.removeChild(i)}}(e)},n.appendChild(i),t.appendChild(n)}))};window.htmlEditButton=l,e.default=l},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0};n(4)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,".ql-html-overlayContainer {\n background: #0000007d;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n}\n\n.ql-html-popupContainer {\n background: #ddd;\n position: absolute;\n top: 5%;\n left: 5%;\n right: 5%;\n bottom: 5%;\n border-radius: 10px;\n}\n\n.ql-html-textContainer {\n position: relative;\n width: calc(100% - 40px);\n height: calc(100% - 40px);\n padding: 20px;\n}\n\n.ql-html-textArea {\n position: absolute;\n left: 15px;\n width: calc(100% - 45px);\n height: calc(100% - 116px);\n}\n\n.ql-html-buttonCancel {\n margin-right: 20px;\n}\n\n.ql-html-popupTitle {\n margin: 0;\n display: block;\n}\n\n.ql-html-buttonGroup {\n position: absolute;\n bottom: 20px;\n transform: scale(1.5);\n left: calc(50% - 60px);\n}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(i).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(t){var e={};return function(n){if(void 0===e[n]){var r=t.call(this,n);if(r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[n]=r}return e[n]}}((function(t){return document.querySelector(t)})),u=null,s=0,c=[],f=n(5);function p(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=i[r.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(y(r.parts[a],e))}else{var l=[];for(a=0;a<r.parts.length;a++)l.push(y(r.parts[a],e));i[r.id]={id:r.id,refs:1,parts:l}}}}function d(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],l={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(l):n.push(r[a]={id:a,parts:[l]})}return n}function h(t,e){var n=l(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=c[c.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),c.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function b(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=c.indexOf(t);e>=0&&c.splice(e,1)}function v(t){var e=document.createElement("style");return t.attrs.type="text/css",m(e,t.attrs),h(t,e),e}function m(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var a=s++;n=u||(u=v(e)),r=w.bind(null,n,a,!1),o=w.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",m(e,t.attrs),h(t,e),e}(e),r=j.bind(null,n,e),o=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),r=C.bind(null,n),o=function(){b(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return p(n,e),function(t){for(var r=[],o=0;o<n.length;o++){var a=n[o];(l=i[a.id]).refs--,r.push(l)}t&&p(d(t,e),e);for(o=0;o<r.length;o++){var l;if(0===(l=r[o]).refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete i[l.id]}}}};var g,x=(g=[],function(t,e){return g[t]=e,g.filter(Boolean).join("\n")});function w(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=x(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function C(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function j(t,e,n){var r=n.css,o=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(r=f(r)),o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),l=t.href;t.href=URL.createObjectURL(a),l&&URL.revokeObjectURL(l)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r=n(6),o=n.n(r),i=n(0);o.a.register("modules/htmlEditButton",i.htmlEditButton);console.log("Demo loaded...");new o.a("#editor",{theme:"snow",modules:{toolbar:{container:[[{header:[1,2,3,!1]}],["bold","italic"],["clean"],["image"]]},htmlEditButton:{debug:!0}}})}])})); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("Quill"));else if("function"==typeof define&&define.amd)define(["Quill"],e);else{var n="object"==typeof exports?e(require("Quill")):e(t.Quill);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=7)}([function(t,e,n){"use strict";n.r(e),n.d(e,"htmlEditButton",(function(){return l}));n(1);function r(t){return document.createElement(t)}function o(t,e,n){return t.setAttribute(e,n)}var i=!1,a={prefixString:function(){return"</> quill-html-edit-button: "},get log(){return i?console.log.bind(console,this.prefixString()):function(){}}},l=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i=n&&n.debug,a.log("logging enabled");var l=e.getModule("toolbar");if(!l)throw new Error('quill.htmlEditButton requires the "toolbar" module to be included too');var u=l.container,s=r("span");o(s,"class","ql-formats");var c=r("button");c.innerHTML="<>",c.title="Show HTML source",c.onclick=function(t){t.preventDefault(),function(t){var e=t.container.querySelector(".ql-editor").innerHTML,n=r("div"),i=r("div");o(i,"class","ql-html-overlayContainer"),o(n,"class","ql-html-popupContainer");var l=r("i");o(l,"class","ql-html-popupTitle"),l.innerText='Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced';var u=r("div");u.appendChild(l),o(u,"class","ql-html-textContainer");var s=r("textarea");o(s,"class","ql-html-textArea"),s.value=function(t){for(var e=" ".repeat(2),n=0,r=null,o=null,i="",l=0;l<=t.length;l++){r=t.substr(l,1),o=t.substr(l+1,1);var u="<br>"===t.substr(l,4),s="<"===r&&"/"===o&&!u;u&&(i+="\n",n--,l+=4),"<"===r&&"/"!==o&&!u?(i+="\n"+e.repeat(n),n++):s?(--n<0&&(n=0),i+="\n"+e.repeat(n)):(" "===r&&" "===o||"\n"===r&&""===t.substr(l,t.substr(l).indexOf("<")).trim())&&(r=""),i+=r}return a.log("formatHTML",{before:t,after:i}),i}(e);var c=r("button");c.innerHTML="Cancel",o(c,"class","ql-html-buttonCancel");var f=r("button");f.innerHTML="Ok";var p=r("div");o(p,"class","ql-html-buttonGroup"),p.appendChild(c),p.appendChild(f),u.appendChild(s),u.appendChild(p),n.appendChild(u),i.appendChild(n),document.body.appendChild(i),c.onclick=function(){document.body.removeChild(i)},i.onclick=c.onclick,n.onclick=function(t){t.preventDefault(),t.stopPropagation()},f.onclick=function(){var e=s.value.split(/\r?\n/g).map((function(t){return t.trim()})).join("");t.container.querySelector(".ql-editor").innerHTML=e,document.body.removeChild(i)}}(e)},s.appendChild(c),u.appendChild(s)};window.htmlEditButton=l,e.default=l},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0};n(4)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,".ql-html-overlayContainer {\n background: #0000007d;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n}\n\n.ql-html-popupContainer {\n background: #ddd;\n position: absolute;\n top: 5%;\n left: 5%;\n right: 5%;\n bottom: 5%;\n border-radius: 10px;\n}\n\n.ql-html-textContainer {\n position: relative;\n width: calc(100% - 40px);\n height: calc(100% - 40px);\n padding: 20px;\n}\n\n.ql-html-textArea {\n position: absolute;\n left: 15px;\n width: calc(100% - 45px);\n height: calc(100% - 116px);\n}\n\n.ql-html-buttonCancel {\n margin-right: 20px;\n}\n\n.ql-html-popupTitle {\n margin: 0;\n display: block;\n}\n\n.ql-html-buttonGroup {\n position: absolute;\n bottom: 20px;\n transform: scale(1.5);\n left: calc(50% - 60px);\n}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(i).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(t){var e={};return function(n){if(void 0===e[n]){var r=t.call(this,n);if(r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[n]=r}return e[n]}}((function(t){return document.querySelector(t)})),u=null,s=0,c=[],f=n(5);function p(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=i[r.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(g(r.parts[a],e))}else{var l=[];for(a=0;a<r.parts.length;a++)l.push(g(r.parts[a],e));i[r.id]={id:r.id,refs:1,parts:l}}}}function d(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],l={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(l):n.push(r[a]={id:a,parts:[l]})}return n}function h(t,e){var n=l(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=c[c.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),c.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function b(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=c.indexOf(t);e>=0&&c.splice(e,1)}function m(t){var e=document.createElement("style");return t.attrs.type="text/css",v(e,t.attrs),h(t,e),e}function v(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function g(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var a=s++;n=u||(u=m(e)),r=w.bind(null,n,a,!1),o=w.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",v(e,t.attrs),h(t,e),e}(e),r=j.bind(null,n,e),o=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),r=C.bind(null,n),o=function(){b(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return p(n,e),function(t){for(var r=[],o=0;o<n.length;o++){var a=n[o];(l=i[a.id]).refs--,r.push(l)}t&&p(d(t,e),e);for(o=0;o<r.length;o++){var l;if(0===(l=r[o]).refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete i[l.id]}}}};var y,x=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function w(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=x(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function C(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function j(t,e,n){var r=n.css,o=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(r=f(r)),o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),l=t.href;t.href=URL.createObjectURL(a),l&&URL.revokeObjectURL(l)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r=n(6),o=n.n(r),i=n(0);o.a.register("modules/htmlEditButton",i.htmlEditButton);console.log("Demo loaded...");new o.a("#editor",{theme:"snow",modules:{toolbar:{container:[[{header:[1,2,3,!1]}],["bold","italic"],["clean"],["image"]]},htmlEditButton:{debug:!0}}})}])})); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e=n();for(var r in e)("object"==typeof exports?exports:t)[r]=e[r]}}(window,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="/dist/",e(e.s=0)}([function(t,n,e){"use strict";e.r(n),e.d(n,"htmlEditButton",(function(){return l}));e(1);function r(t){return document.createElement(t)}function o(t,n,e){return t.setAttribute(n,e)}var i=!1,a={prefixString:function(){return"</> quill-html-edit-button: "},get log(){return i?console.log.bind(console,this.prefixString()):function(){}}},l=function t(n,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),i=e&&e.debug,a.log("logging enabled");var l=n.container.parentElement.querySelectorAll(".ql-toolbar");(l=[].slice.call(l)).forEach((function(t){var e=r("span");o(e,"class","ql-formats");var i=r("button");i.innerHTML="<>",i.title="Show HTML source",i.onclick=function(t){t.preventDefault(),function(t){var n=t.container.querySelector(".ql-editor").innerHTML,e=r("div"),i=r("div");o(i,"class","ql-html-overlayContainer"),o(e,"class","ql-html-popupContainer");var l=r("i");o(l,"class","ql-html-popupTitle"),l.innerText='Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced';var s=r("div");s.appendChild(l),o(s,"class","ql-html-textContainer");var u=r("textarea");o(u,"class","ql-html-textArea"),u.value=function(t){for(var n=" ".repeat(2),e=0,r=null,o=null,i="",l=0;l<=t.length;l++){r=t.substr(l,1),o=t.substr(l+1,1);var s="<br>"===t.substr(l,4),u="<"===r&&"/"===o&&!s;s&&(i+="\n",e--,l+=4),"<"===r&&"/"!==o&&!s?(i+="\n"+n.repeat(e),e++):u?(--e<0&&(e=0),i+="\n"+n.repeat(e)):(" "===r&&" "===o||"\n"===r&&""===t.substr(l,t.substr(l).indexOf("<")).trim())&&(r=""),i+=r}return a.log("formatHTML",{before:t,after:i}),i}(n);var c=r("button");c.innerHTML="Cancel",o(c,"class","ql-html-buttonCancel");var f=r("button");f.innerHTML="Ok";var p=r("div");o(p,"class","ql-html-buttonGroup"),p.appendChild(c),p.appendChild(f),s.appendChild(u),s.appendChild(p),e.appendChild(s),i.appendChild(e),document.body.appendChild(i),c.onclick=function(){document.body.removeChild(i)},i.onclick=c.onclick,e.onclick=function(t){t.preventDefault(),t.stopPropagation()},f.onclick=function(){var n=u.value.split(/\r?\n/g).map((function(t){return t.trim()})).join("");t.container.querySelector(".ql-editor").innerHTML=n,document.body.removeChild(i)}}(n)},e.appendChild(i),t.appendChild(e)}))};window.htmlEditButton=l,n.default=l},function(t,n,e){var r=e(2);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0};e(4)(r,o);r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(3)(!1)).push([t.i,".ql-html-overlayContainer {\n background: #0000007d;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n}\n\n.ql-html-popupContainer {\n background: #ddd;\n position: absolute;\n top: 5%;\n left: 5%;\n right: 5%;\n bottom: 5%;\n border-radius: 10px;\n}\n\n.ql-html-textContainer {\n position: relative;\n width: calc(100% - 40px);\n height: calc(100% - 40px);\n padding: 20px;\n}\n\n.ql-html-textArea {\n position: absolute;\n left: 15px;\n width: calc(100% - 45px);\n height: calc(100% - 116px);\n}\n\n.ql-html-buttonCancel {\n margin-right: 20px;\n}\n\n.ql-html-popupTitle {\n margin: 0;\n display: block;\n}\n\n.ql-html-buttonGroup {\n position: absolute;\n bottom: 20px;\n transform: scale(1.5);\n left: calc(50% - 60px);\n}\n",""])},function(t,n){t.exports=function(t){var n=[];return n.toString=function(){return this.map((function(n){var e=function(t,n){var e=t[1]||"",r=t[3];if(!r)return e;if(n&&"function"==typeof btoa){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[e].concat(i).concat([o]).join("\n")}var a;return[e].join("\n")}(n,t);return n[2]?"@media "+n[2]+"{"+e+"}":e})).join("")},n.i=function(t,e){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&r[a[0]]||(e&&!a[2]?a[2]=e:e&&(a[2]="("+a[2]+") and ("+e+")"),n.push(a))}},n}},function(t,n,e){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(t){var n={};return function(e){if(void 0===n[e]){var r=t.call(this,e);if(r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}n[e]=r}return n[e]}}((function(t){return document.querySelector(t)})),s=null,u=0,c=[],f=e(5);function p(t,n){for(var e=0;e<t.length;e++){var r=t[e],o=i[r.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(y(r.parts[a],n))}else{var l=[];for(a=0;a<r.parts.length;a++)l.push(y(r.parts[a],n));i[r.id]={id:r.id,refs:1,parts:l}}}}function d(t,n){for(var e=[],r={},o=0;o<t.length;o++){var i=t[o],a=n.base?i[0]+n.base:i[0],l={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(l):e.push(r[a]={id:a,parts:[l]})}return e}function h(t,n){var e=l(t.insertInto);if(!e)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=c[c.length-1];if("top"===t.insertAt)r?r.nextSibling?e.insertBefore(n,r.nextSibling):e.appendChild(n):e.insertBefore(n,e.firstChild),c.push(n);else if("bottom"===t.insertAt)e.appendChild(n);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(t.insertInto+" "+t.insertAt.before);e.insertBefore(n,o)}}function b(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var n=c.indexOf(t);n>=0&&c.splice(n,1)}function v(t){var n=document.createElement("style");return t.attrs.type="text/css",m(n,t.attrs),h(t,n),n}function m(t,n){Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])}))}function y(t,n){var e,r,o,i;if(n.transform&&t.css){if(!(i=n.transform(t.css)))return function(){};t.css=i}if(n.singleton){var a=u++;e=s||(s=v(n)),r=w.bind(null,e,a,!1),o=w.bind(null,e,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(e=function(t){var n=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",m(n,t.attrs),h(t,n),n}(n),r=j.bind(null,e,n),o=function(){b(e),e.href&&URL.revokeObjectURL(e.href)}):(e=v(n),r=C.bind(null,e),o=function(){b(e)});return r(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;r(t=n)}else o()}}t.exports=function(t,n){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(n=n||{}).attrs="object"==typeof n.attrs?n.attrs:{},n.singleton||"boolean"==typeof n.singleton||(n.singleton=a()),n.insertInto||(n.insertInto="head"),n.insertAt||(n.insertAt="bottom");var e=d(t,n);return p(e,n),function(t){for(var r=[],o=0;o<e.length;o++){var a=e[o];(l=i[a.id]).refs--,r.push(l)}t&&p(d(t,n),n);for(o=0;o<r.length;o++){var l;if(0===(l=r[o]).refs){for(var s=0;s<l.parts.length;s++)l.parts[s]();delete i[l.id]}}}};var g,x=(g=[],function(t,n){return g[t]=n,g.filter(Boolean).join("\n")});function w(t,n,e,r){var o=e?"":r.css;if(t.styleSheet)t.styleSheet.cssText=x(n,o);else{var i=document.createTextNode(o),a=t.childNodes;a[n]&&t.removeChild(a[n]),a.length?t.insertBefore(i,a[n]):t.appendChild(i)}}function C(t,n){var e=n.css,r=n.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}function j(t,n,e){var r=e.css,o=e.sourceMap,i=void 0===n.convertToAbsoluteUrls&&o;(n.convertToAbsoluteUrls||i)&&(r=f(r)),o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),l=t.href;t.href=URL.createObjectURL(a),l&&URL.revokeObjectURL(l)}},function(t,n){t.exports=function(t){var n="undefined"!=typeof window&&window.location;if(!n)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var e=n.protocol+"//"+n.host,r=e+n.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,n){var o,i=n.trim().replace(/^"(.*)"$/,(function(t,n){return n})).replace(/^'(.*)'$/,(function(t,n){return n}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?e+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}])})); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"htmlEditButton",(function(){return l}));n(1);function r(t){return document.createElement(t)}function o(t,e,n){return t.setAttribute(e,n)}var i=!1,a={prefixString:function(){return"</> quill-html-edit-button: "},get log(){return i?console.log.bind(console,this.prefixString()):function(){}}},l=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i=n&&n.debug,a.log("logging enabled");var l=e.getModule("toolbar");if(!l)throw new Error('quill.htmlEditButton requires the "toolbar" module to be included too');var u=l.container,s=r("span");o(s,"class","ql-formats");var c=r("button");c.innerHTML="<>",c.title="Show HTML source",c.onclick=function(t){t.preventDefault(),function(t){var e=t.container.querySelector(".ql-editor").innerHTML,n=r("div"),i=r("div");o(i,"class","ql-html-overlayContainer"),o(n,"class","ql-html-popupContainer");var l=r("i");o(l,"class","ql-html-popupTitle"),l.innerText='Edit HTML here, when you click "OK" the quill editor\'s contents will be replaced';var u=r("div");u.appendChild(l),o(u,"class","ql-html-textContainer");var s=r("textarea");o(s,"class","ql-html-textArea"),s.value=function(t){for(var e=" ".repeat(2),n=0,r=null,o=null,i="",l=0;l<=t.length;l++){r=t.substr(l,1),o=t.substr(l+1,1);var u="<br>"===t.substr(l,4),s="<"===r&&"/"===o&&!u;u&&(i+="\n",n--,l+=4),"<"===r&&"/"!==o&&!u?(i+="\n"+e.repeat(n),n++):s?(--n<0&&(n=0),i+="\n"+e.repeat(n)):(" "===r&&" "===o||"\n"===r&&""===t.substr(l,t.substr(l).indexOf("<")).trim())&&(r=""),i+=r}return a.log("formatHTML",{before:t,after:i}),i}(e);var c=r("button");c.innerHTML="Cancel",o(c,"class","ql-html-buttonCancel");var f=r("button");f.innerHTML="Ok";var p=r("div");o(p,"class","ql-html-buttonGroup"),p.appendChild(c),p.appendChild(f),u.appendChild(s),u.appendChild(p),n.appendChild(u),i.appendChild(n),document.body.appendChild(i),c.onclick=function(){document.body.removeChild(i)},i.onclick=c.onclick,n.onclick=function(t){t.preventDefault(),t.stopPropagation()},f.onclick=function(){var e=s.value.split(/\r?\n/g).map((function(t){return t.trim()})).join("");t.container.querySelector(".ql-editor").innerHTML=e,document.body.removeChild(i)}}(e)},s.appendChild(c),u.appendChild(s)};window.htmlEditButton=l,e.default=l},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0};n(4)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,".ql-html-overlayContainer {\n background: #0000007d;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n}\n\n.ql-html-popupContainer {\n background: #ddd;\n position: absolute;\n top: 5%;\n left: 5%;\n right: 5%;\n bottom: 5%;\n border-radius: 10px;\n}\n\n.ql-html-textContainer {\n position: relative;\n width: calc(100% - 40px);\n height: calc(100% - 40px);\n padding: 20px;\n}\n\n.ql-html-textArea {\n position: absolute;\n left: 15px;\n width: calc(100% - 45px);\n height: calc(100% - 116px);\n}\n\n.ql-html-buttonCancel {\n margin-right: 20px;\n}\n\n.ql-html-popupTitle {\n margin: 0;\n display: block;\n}\n\n.ql-html-buttonGroup {\n position: absolute;\n bottom: 20px;\n transform: scale(1.5);\n left: calc(50% - 60px);\n}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(i).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(t){var e={};return function(n){if(void 0===e[n]){var r=t.call(this,n);if(r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[n]=r}return e[n]}}((function(t){return document.querySelector(t)})),u=null,s=0,c=[],f=n(5);function p(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=i[r.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(y(r.parts[a],e))}else{var l=[];for(a=0;a<r.parts.length;a++)l.push(y(r.parts[a],e));i[r.id]={id:r.id,refs:1,parts:l}}}}function d(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],l={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(l):n.push(r[a]={id:a,parts:[l]})}return n}function h(t,e){var n=l(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=c[c.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),c.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function b(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=c.indexOf(t);e>=0&&c.splice(e,1)}function v(t){var e=document.createElement("style");return t.attrs.type="text/css",m(e,t.attrs),h(t,e),e}function m(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var a=s++;n=u||(u=v(e)),r=w.bind(null,n,a,!1),o=w.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",m(e,t.attrs),h(t,e),e}(e),r=j.bind(null,n,e),o=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),r=C.bind(null,n),o=function(){b(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return p(n,e),function(t){for(var r=[],o=0;o<n.length;o++){var a=n[o];(l=i[a.id]).refs--,r.push(l)}t&&p(d(t,e),e);for(o=0;o<r.length;o++){var l;if(0===(l=r[o]).refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete i[l.id]}}}};var g,x=(g=[],function(t,e){return g[t]=e,g.filter(Boolean).join("\n")});function w(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=x(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function C(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function j(t,e,n){var r=n.css,o=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(r=f(r)),o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),l=t.href;t.href=URL.createObjectURL(a),l&&URL.revokeObjectURL(l)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}])})); |
{ | ||
"name": "quill-html-edit-button", | ||
"description": "A Quill rich text editor Module which adds an html edit button to the quill editor", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"main": "dist/quill.htmlEditButton.min.js", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/benwinding/quill-html-edit-button", |
@@ -29,19 +29,20 @@ import './styles.css'; | ||
// Add button to all quill toolbar instances | ||
let toolbars = quill.container.parentElement.querySelectorAll( | ||
".ql-toolbar" | ||
); | ||
toolbars = [].slice.call(toolbars); | ||
toolbars.forEach(toolbarEl => { | ||
const buttonContainer = $create("span"); | ||
$setAttr(buttonContainer, "class", "ql-formats"); | ||
const button = $create("button"); | ||
button.innerHTML = "<>"; | ||
button.title = "Show HTML source"; | ||
button.onclick = function(e) { | ||
e.preventDefault(); | ||
launchPopupEditor(quill); | ||
}; | ||
buttonContainer.appendChild(button); | ||
toolbarEl.appendChild(buttonContainer); | ||
}); | ||
const toolbarModule = quill.getModule('toolbar'); | ||
if (!toolbarModule) { | ||
throw new Error( | ||
'quill.htmlEditButton requires the "toolbar" module to be included too' | ||
); | ||
} | ||
let toolbarEl = toolbarModule.container; | ||
const buttonContainer = $create("span"); | ||
$setAttr(buttonContainer, "class", "ql-formats"); | ||
const button = $create("button"); | ||
button.innerHTML = "<>"; | ||
button.title = "Show HTML source"; | ||
button.onclick = function(e) { | ||
e.preventDefault(); | ||
launchPopupEditor(quill); | ||
}; | ||
buttonContainer.appendChild(button); | ||
toolbarEl.appendChild(buttonContainer); | ||
} | ||
@@ -48,0 +49,0 @@ } |
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
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
60236
246
0