jodit-pro 1.3.19 → 1.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/jodit.es5.css +1 -1
- package/build/jodit.es5.js +1 -1
- package/build/jodit.fat.es5.js +1 -1
- package/build/jodit.fat.js +1 -1
- package/build/jodit.js +1 -1
- package/build/plugins/paste-from-word/paste-from-word.es5.js +1 -1
- package/build/plugins/paste-from-word/paste-from-word.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[92],{68356:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearAttributes=void 0;var n=r(70655),i=["cellspacing","cellpadding","border","v:shapes","o:spid"];t.clearAttributes=function(e){var t,r;if(/^OLE_LINK\d+$/.test(e.attributes.name)&&(e.attributes.name=null,0===e.length))return e.remove(),null;"_GoBack"===e.attributes.name&&(e.attributes.name=null);try{for(var a=n.__values(i),o=a.next();!o.done;o=a.next()){var s=o.value;e.attributes[s]&&(e.attributes[s]=null)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return e}},67635:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearClassName=void 0;var n=r(589);t.clearClassName=function(e){return e.attributes.class&&(e.attributes.class=e.attributes.class.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/gi,""),(0,n.trim)(e.attributes.class)||(e.attributes.class=null)),e}},57446:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.convertStyleUnitToPixels=void 0;var n=r(29580);t.convertStyleUnitToPixels=function(e,t){if(!t.jodit.o.pasteFromWord.convertUnitsToPixel)return e;var r=e.style;return r.forEach((function(e){var t=r.get(e);t&&r.set(e,t.toString().replace(/\d+(\.\d+)?(pt|cm)/g,(function(e){return(0,n.convertUnitToPx)(e)+"px"})))})),e}},44815:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.removeRedundancyStyle=t.convertToList=void 0;var n=r(29580),i=r(18566),a=r(11606),o=r(51330);function s(e){var t;!(0,i.isList)(e)||"li"===(null===(t=e.parent)||void 0===t?void 0:t.name)||"disc"!==e.style.get(o.STYLE_CSS_KEY)&&"decimal"!==e.style.get(o.STYLE_CSS_KEY)||e.style.set(o.STYLE_CSS_KEY,null)}t.convertToList=function(e){var t;if((0,i.isPseudoLeaf)(e)){e.name="li",e.style.set("text-indent",null);var r=l(e),a=/[\da-np-zA-NP-Z].?/.test(r)?"ol":"ul",u=function(e,t){for(var r in o.listStyleMap)if(RegExp(r).test(e))return o.listStyleMap[r];return"ol"===t?"decimal":"disc"}(r,a);e.attributes[o.TYPE_KEY]=a,e.attributes[o.STYLE_KEY]=u,(0,n.calcListLevels)(e),function(e){for(;e;){var t=e.previousElement;if(!(0,i.isLeaf)(t)&&!(0,i.isList)(t))break;if((0,i.isLeaf)(t)){if(t.attributes[o.LEVEL_KEY]>e.attributes[o.LEVEL_KEY])break;if(e.attributes[o.LEVEL_KEY]===t.attributes[o.LEVEL_KEY]&&e.parent&&(0,i.isSameType)(e,e.parent))break;t.append(e)}else{var r=t;if(r.attributes[o.LEVEL_KEY]>e.attributes[o.LEVEL_KEY])break;if(e.attributes[o.LEVEL_KEY]===r.attributes[o.LEVEL_KEY]&&!(0,i.isSameType)(e,r))break;r.append(e)}}}(e);var c=e.parent;if(!(0,i.isList)(c)||!(0,i.isSameType)(e,c)){var f=function(e,t,r,i){var a=e.wrap(t);return a.attributes.start=(0,n.calcStartBySymbol)(r),a.attributes[o.LEVEL_KEY]=e.attributes[o.LEVEL_KEY],a.attributes[o.STYLE_KEY]=e.attributes[o.STYLE_KEY],a.attributes[o.STYLE_VALID_KEY]=e.attributes[o.STYLE_KEY],a.style.set(o.STYLE_CSS_KEY,i),s(a),a}(e,a,r,u);return(0,i.isList)(c)&&(f.remove(),null===(t=c.lastElement)||void 0===t||t.append(f)),e}}return e},t.removeRedundancyStyle=s;var l=function(e){return e.textBetween((function(e){return e.isComment&&/\[if.*supportLists.*]/.test((0,i.html)(e))}),(function(e){return e.isComment&&/\[endif]/.test((0,i.html)(e))})).replace(/ /g,"").replace((0,a.SPACE_REG_EXP)(),"")}},2394:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.cases=void 0;var n=r(44815),i=r(68356),a=r(65302),o=r(75099),s=r(74587),l=r(57446),u=r(67635),c=r(35264),f=r(41925),d=r(83161),p=r(26549),m=r(40522);t.cases=[m.processImage,p.markPageBreakElements,a.removeExtraTags,o.replaceOldTags,i.clearAttributes,n.convertToList,c.processLinks,s.removeInsideComment,l.convertStyleUnitToPixels,u.clearClassName,f.normalizeImageProps,d.removeWidthFromTableCell]},26549:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.markPageBreakElements=void 0,t.markPageBreakElements=function(e){return(e.isElement&&"always"===e.style.get("page-break-before")||"page"===e.style.get("break-before"))&&(e.attributes["jd-safe"]=!0,e.style.add("page-break-before","always"),e.isSingle&&(e.name="div")),e}},41925:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeImageProps=void 0,t.normalizeImageProps=function(e){return e.isElement?("img"===e.name&&(e.attributes.align&&(e.style.add("float",e.attributes.align),e.attributes.align=null),e.attributes.hspace&&(e.style.add("marginLeft",e.attributes.hspace+"px"),e.style.add("marginRight",e.attributes.hspace+"px"),e.attributes.hspace=null)),e):e}},40522:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.processImage=void 0;var n=r(70655),i=r(75204);function a(e,t,r,i){var a,o,s=e.split(r);try{for(var l=n.__values(s),u=l.next();!u.done;u=l.next()){var c=u.value.split("shplid");if(c.length>1){for(var f=c[1],d="",p=0;f.length>p&&!/[{ \r\n\\]/.test(f[p]);p++)d+=f[p];var m=f.split("bliptag");if(m&&2>m.length)continue;var v=null;if(m[0].indexOf("pngblip")?v="image/png":-1!==m[0].indexOf("jpegblip")&&(v="image/jpeg"),!v)continue;var h=m[1].split("}");if(h&&2>h.length)continue;var y=void 0;if(h.length>2&&h[0].includes("blipuid"))y=h[1].split(" ");else{if((y=h[0].split(" "))&&2>y.length)continue;y.shift()}i[t+d]={hex:y.join(""),type:v}}}}catch(e){a={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(a)throw a.error}}}t.processImage=function(e,t){var r;if(t.rtf&&"#comment"===e.name&&e.attributes.nodeValue&&-1!==e.attributes.nodeValue.indexOf("<v:shape")){t.shapes||(t.shapes={});var n=t.jodit.create.fromHTML(e.attributes.nodeValue);return(0,i.toArray)(n.getElementsByTagName("v:shape")).forEach((function(e){t.shapes[e.id]=e.getAttribute("o:spid")})),e}if("img"!==e.name)return e;if(t.rtf&&e.attributes["v:shapes"]){var o=null===(r=t.shapes)||void 0===r?void 0:r[e.attributes["v:shapes"]];if(o){t.imageMap||(t.imageMap={},a(t.rtf,"i","\\shppict",t.imageMap),a(t.rtf,"s","\\shp{",t.imageMap));var s=t.imageMap[o.substring(7)];if(s){var l=[],u=s.hex.match(/[0-9a-f]{2}/gi);if(u){for(var c=0;u.length>c;c++)l.push(String.fromCharCode(parseInt(u[c],16)));e.attributes.src="data:"+s.type+";base64,"+btoa(l.join(""))}}}}return e}},35264:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.processLinks=void 0,t.processLinks=function(e,t){var r,n=null!==(r=t.links)&&void 0!==r?r:{};if(e.attributes.href&&e.attributes.href.match(/#.+$/)&&(n[e.attributes.href.match(/#(.+)$/)[1]]=e),e.attributes.name&&n[e.attributes.name]){var i=n[e.attributes.name];i.attributes.href=i.attributes.href.replace(/.*#(.*)$/,"#$1")}return t.links=n,e}},65302:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeExtraTags=void 0;var r=new Set(["o:p","xml","script","meta","link","v:imagedata","style"]);t.removeExtraTags=function(e){return"none"===e.style.get("display")||0===e.length&&"span"===e.name||r.has(e.name)?(e.remove(),null):e}},74587:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.removeInsideComment=void 0;var n=r(18566),i=0;t.removeInsideComment=function(e){return e.isComment&&/\[if.*(supportLists|gte vml).*]/.test((0,n.html)(e))&&(i++,e.remove()),e.isComment&&i>0&&(0,n.html)(e).includes("[endif]")&&(i=i>0?i-1:0,e.remove()),i&&(e.isText||"img"===e.name&&(!e.attributes.src||/^file:/.test(e.attributes.src)))?(e.remove(),null):e}},75099:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.replaceOldTags=void 0;var r={i:"em",b:"strong"};t.replaceOldTags=function(e){var t=e.name;return t in r&&(e.name=r[t]),e}},83161:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeWidthFromTableCell=void 0,t.removeWidthFromTableCell=function(e){return!e.attributes.width||"th"!==e.name&&"td"!==e.name||(e.attributes.width=null),e}},78322:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),r(85119).Config.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1,allowedStyleProps:["background","background-color","border","border-.*","color","float","font-family","font-size","font-style","font-weight","height","line-height","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","padding","text-align","text-autospace","text-justify","text-decoration","text-indent","vertical-align","width"]}},51330:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.listStyleMap=t.STYLE_CSS_KEY=t.STYLE_VALID_KEY=t.STYLE_KEY=t.TYPE_KEY=t.LEVEL_KEY=void 0,t.LEVEL_KEY="jd-list-level",t.TYPE_KEY="jd-list-type",t.STYLE_KEY="jd-list-style-type",t.STYLE_VALID_KEY="data-list-style-type",t.STYLE_CSS_KEY="list-style-type",t.listStyleMap={"·":"disc",o:"circle","§":"square","[ivx]":"lower-roman","[IVX]":"upper-roman","[a-z]":"lower-alpha","[A-Z]":"upper-alpha","\\d":"decimal"}},77800:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.isSameType=t.isPseudoLeaf=t.isLeaf=t.isList=void 0;var n=r(46801),i=r(51330);t.isList=function(e){return Boolean(e&&("ol"===e.name||"ul"===e.name))},t.isLeaf=function(e){return Boolean(e&&"li"===e.name)},t.isPseudoLeaf=function(e){return/mso-list:\s*l\d+ level\d+ lfo\d+/i.test(e.attributes.style)||/msolistparagraph/i.test(e.attributes.class)&&Boolean(e.find((function(e){return e.isComment&&(0,n.html)(e).includes("supportLists")})).length)},t.isSameType=function(e,t){return!(t.name!==e.attributes[i.TYPE_KEY]||t.attributes[i.STYLE_KEY]!==e.attributes[i.STYLE_KEY]||e.attributes[i.LEVEL_KEY]!==t.attributes[i.LEVEL_KEY])}},94616:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.JElement=void 0;var n=r(70655),i=r(44370),a=r(11606),o=r(75204),s=r(46801),l=r(15002),u=new Set(a.INSEPARABLE_TAGS),c=function(){function e(t,r){var n=this;this.parent=r,this.name=t.nodeName.toLowerCase(),this.type=t.nodeType,this.attributes=function(e){var t={};if(i.Dom.isElement(e))for(var r=0,n=e.attributes;n.length>r;r+=1)t[n[r].name]=n[r].value;else t.nodeValue=e.nodeValue;return t}(t),this.style=new l.Style(this.attributes.style),this.children=[],t.childNodes.forEach((function(t){return n.children.push(e.make(t,n))}))}return Object.defineProperty(e.prototype,"isText",{get:function(){return this.type===Node.TEXT_NODE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isElement",{get:function(){return this.type===Node.ELEMENT_NODE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isComment",{get:function(){return this.type===Node.COMMENT_NODE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSingle",{get:function(){return u.has(this.name)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.children.length},enumerable:!1,configurable:!0}),e.make=function(t,r){return void 0===r&&(r=null),new e(t,r)},e.prototype.wrap=function(t){var r;(0,o.assert)(null!=this.parent,"You can't wrap the root element");var n=e.make(document.createElement(t),this.parent),i=null!==(r=this.parent.children.indexOf(this))&&void 0!==r?r:-1;return-1===i?this.parent.append(n):this.parent.children[i]=n,n.append(this),n},e.prototype.append=function(e){return(0,o.assert)(e!==this,"Forbidden to add to yourself"),e.remove(),this.children.push(e),e.parent=this,this},Object.defineProperty(e.prototype,"previousElement",{get:function(){if(!this.parent)return null;var e=this.parent.children,t=e.indexOf(this);if(-1!==t)for(var r=t-1;r>=0;r-=1)if(e[r].isElement)return e[r];return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElement",{get:function(){for(var e=this.children,t=e.length-1;t>=0;t-=1)if(e[t].isElement)return e[t];return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){var e,t,r;return null!==(r=null!==(e=this.sibling(!1))&&void 0!==e?e:null===(t=this.parent)||void 0===t?void 0:t.previous)&&void 0!==r?r:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){var e,t,r;return null!==(r=null!==(e=this.sibling(!0))&&void 0!==e?e:null===(t=this.parent)||void 0===t?void 0:t.next)&&void 0!==r?r:null},enumerable:!1,configurable:!0}),e.prototype.sibling=function(e){if(!this.parent)return null;var t=this.parent.children,r=t.indexOf(this);return-1!==r&&t[r+(e?1:-1)]?t[r+(e?1:-1)]:null},e.prototype.forEach=function(e,t){var r,i;void 0===t&&(t=!1);var a=n.__spreadArray([],n.__read(this.children),!1);try{for(var o=n.__values(a),s=o.next();!s.done;s=o.next()){var l=s.value;if(!1===e(l))return!1;if(t&&!1===l.forEach(e,!0))return!1}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},e.prototype.find=function(e,t){void 0===t&&(t=!0);var r=[];return this.forEach((function(t){e(t)&&r.push(t)}),t),r},e.prototype.map=function(e){return this.children.map(e)},e.prototype.remove=function(){var e,t,r=null===(e=this.parent)||void 0===e?void 0:e.children.indexOf(this);return null!=r&&-1!==r&&(null===(t=this.parent)||void 0===t||t.children.splice(r,1)),this},e.prototype.textBetween=function(e,t){var r=!1,n=[];return this.forEach((function(i){if(!r&&e(i)&&(r=!0),r&&i.isText&&n.push((0,s.html)(i)),r&&t(i))return!1}),!0),n.join("")},e}();t.JElement=c},18566:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(70655);n.__exportStar(r(77800),t),n.__exportStar(r(94616),t),n.__exportStar(r(46801),t)},46801:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.innerHTML=t.html=void 0;var n=r(75204);function i(e,t,r,n){switch(void 0===t&&(t=function(){return!0}),void 0===r&&(r=!0),!0){case e.isComment:case e.isText:if(!t(e))return"";var i=e.attributes.nodeValue;return e.isComment?"\x3c!--".concat(i,"--\x3e"):i;case e.isElement:var l=e.attributes,u=o(e,t,r,n);if(!e.attributes["jd-safe"]&&r&&0===u.replace(/[\n\t]/g,"").length&&!e.isSingle)return"";var c=Object.keys(l).map((function(e){return"style"===e||null==l[e]||/^jd-/.test(e)?"":"".concat(e,'="').concat(s(l[e]),'"')})).filter(Boolean),f=s((0,e.style.str)((function(e){return a(e,n)})));if(f&&c.push('style="'.concat(f,'"')),r&&0===c.length&&["span","a"].includes(e.name))return u;var d=c.length?" "+c.join(" "):"";return t(e)?e.isSingle?"<".concat(e.name).concat(d,"/>"):"<".concat(e.name).concat(d,">").concat(u,"</").concat(e.name,">"):u}return""}function a(e,t){var r;if(!t)return!0;if(a.cache.has(t)){var i=null===(r=a.cache.get(t))||void 0===r?void 0:r.get(e);if((0,n.isBoolean)(i))return i}var o=t.some((function(t){return new RegExp(t).test(e)})),s=a.cache.get(t)||new Map;return s.set(e,o),a.cache.set(t,s),o}function o(e,t,r,a){void 0===t&&(t=function(){return!0}),void 0===r&&(r=!0);var o=e.map((function(e){return i(e,t,r,a)})).join("");return"p"===e.name&&0===(0,n.trim)(o).length&&(o=" "),o}function s(e){return e.toString().replace(/"/g,""")}t.html=i,a.cache=new WeakMap,t.innerHTML=o},15002:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Style=void 0;var n=r(70655),i=r(75204),a=r(23112),o=function(){function e(e){this._data=s(e)}return Object.defineProperty(e.prototype,"keys",{get:function(){return Object.keys(this._data)},enumerable:!1,configurable:!0}),e.prototype.forEach=function(e){this.keys.forEach((function(t){return e(t)}))},e.prototype.clear=function(){this._data={}},e.prototype.set=function(e,t){this._data[e]=t},e.prototype.get=function(e){var t;return null!==(t=this._data[e])&&void 0!==t?t:null},e.prototype.add=function(e,t){return this._data=s(this.str()+";"+"".concat(e,":").concat(t)),this},e.prototype.str=function(e){var t=this;void 0===e&&(e=function(e){return!0});var r=Object.keys(this._data).filter((function(r){return r&&!/^mso-/.test(r)&&e(r)&&null!=t.get(r)}));return r.length?r.map((function(e){return"".concat((0,i.kebabCase)(e),":").concat(t.get(e))})).join(";"):""},n.__decorate([a.autobind],e)}();function s(e){return function(e){for(var t={},r=[],n=e.length-1;n>=0;n-=1){var i=e[n][0];t[i]||(t[i]=!0,r.unshift(e[n]))}return r}((null!=e?e:"").replace(/"/g,'"').split(";").filter(Boolean).map((function(e){return(0,i.trim)(e).split(":").map(i.trim)}))).reduce((function(e,t){var r=n.__read(t,2),i=r[0],a=r[1];return i&&a&&(e[i]=a),e}),{})}t.Style=o},64282:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.applyStylesPro=void 0;var n=r(75204),i=r(44370),a=r(37987),o=r(18566);t.applyStylesPro=function(e,t,r,s){var l,u;void 0===s&&(s="");var c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);try{var f=null!==(l=c.contentDocument)&&void 0!==l?l:null===(u=c.contentWindow)||void 0===u?void 0:u.document;if(!f)return t;f.open(),f.write(t),f.close();for(var d="jd-style",p=function(e){try{for(var t=f.styleSheets[e].cssRules,r=function(e){if(!t[e].selectorText)return"continue";(0,n.$$)(t[e].selectorText,f.body).forEach((function(r){(0,n.attr)(r,d)||((0,n.attr)(r,d,(0,n.attr)(r,"style")||""),(0,n.attr)(r,"style","")),(0,n.attr)(r,"style","".concat((0,n.attr)(r,"style"),";").concat(t[e].style.cssText))}))},i=0;t.length>i;i+=1)r(i)}catch(e){}},m=0;f.styleSheets.length>m;m+=1)p(m);return(0,n.$$)("[".concat(d,"]"),f.body).forEach((function(e){(0,n.attr)(e,"style","".concat((0,n.attr)(e,"style"),";").concat((0,n.attr)(e,d)))})),(0,a.transformWordToHtml)(e,o.JElement.make(f.body),r,s)}finally{i.Dom.safeRemove(c)}return t}},20036:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.calcListLevels=void 0;var n=r(70655),i=r(18566),a=r(51330),o=r(90998);t.calcListLevels=function(e){if(void 0===e.attributes[a.LEVEL_KEY]){for(var t=[(0,o.realPixelIndent)(e)],r=[e],s=e.next;s;){if(s.isElement&&!s.attributes[a.LEVEL_KEY]&&(0,i.isPseudoLeaf)(s)){var l=(0,o.realPixelIndent)(s);l&&(t.push(l),r.push(s))}s=s.next}var u=Math.min.apply(Math,n.__spreadArray([],n.__read(t.filter((function(e){return e>0}))),!1)),c=t.map((function(e){return Math.ceil(e/10)}));-1!==c.indexOf(0)&&(c=c.map((function(e){return e+1}))),r.forEach((function(e,t){e.attributes[a.LEVEL_KEY]=c[t],e.style.add("margin-left","".concat(Math.max((0,o.realPixelIndent)(e)-10*c[t]/u*40,0),"px"))}))}}},90998:function(e,t){function r(e){if(!e)return[0,0,0,0];var t=e.match(/(0|auto|(-?[.\d]+(?:\w+|%)))/g)||["0px"];switch(t.length){case 2:return[0,1,0,1].map((function(e){return t[e]}));case 3:return[0,1,2,1].map((function(e){return t[e]}));case 4:return[0,1,2,3].map((function(e){return t[e]}));default:return[0,0,0,0].map((function(e){return t[e]}))}}var n;function i(e){if("number"==typeof e)return e;if(/%$/.test(e))return 0;n||(n=document.createElement("div"),Object.assign(n.style,{position:"absolute",left:"-9999px",top:"-9999px",margin:"0",padding:"0",border:"0"}),document.body.append(n),setTimeout((function(){null==n||n.remove(),n=null})));var t=0>parseFloat(e);t&&(e=e.replace("-","")),n.style.width=e;var r=n.clientWidth;return t?-r:r}Object.defineProperty(t,"__esModule",{value:!0}),t.calcStartBySymbol=t.realPixelIndent=t.convertUnitToPx=t.calcMarginParts=void 0,t.calcMarginParts=r,t.convertUnitToPx=i,t.realPixelIndent=function(e){var t=e.style,n=t.keys.filter((function(e){return/margin/.test(e)})),a=Math.max(n.indexOf("margin-left"),n.indexOf("margin")),o=a>0?n[a]:"margin-left";return i("margin"===o?r(t.get("margin"))[3]||0:t.get(o)||0)},t.calcStartBySymbol=function(e){return/\d.\d/.test(e)?e.split(".").pop()||null:/^\d/.test(e)?(parseInt(e,10)||1).toString():null}},29580:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(70655);n.__exportStar(r(90998),t),n.__exportStar(r(64282),t),n.__exportStar(r(37987),t),n.__exportStar(r(20036),t)},37987:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.transformWordToHtml=void 0;var n=r(70655),i=r(2394),a=r(589),o=r(18566);t.transformWordToHtml=function(e,t,r,s){var l={jodit:e,rtf:s};return t.forEach((function e(t){var r,a;if(t){try{for(var o=n.__values(i.cases),s=o.next();!s.done&&null!=(t=(0,s.value)(t,l));s=o.next());}catch(e){r={error:e}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}null==t||t.forEach(e)}})),r&&t.forEach((function(e){e.style.clear()}),!0),(0,a.trim)((0,o.innerHTML)(t,(function(e){return!e.isComment}),!0,e.o.pasteFromWord.allowedStyleProps))}},35794:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.PasteFromWordPro=void 0;var n=r(70655),i=r(97029),a=r(11606),o=r(10728),s=r(82726),l=r(29580);r(78322);var u=r(47036),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.insertFromWordByType=function(t,r,n,i){var s;if(!this.j.o.pasteFromWord.enable||n!==a.INSERT_AS_HTML&&n!==a.INSERT_AS_TEXT)return e.prototype.insertFromWordByType.call(this,t,r,n,i);if(r=(0,l.applyStylesPro)(this.j,r,n===a.INSERT_AS_TEXT,i.rtf),this.j.o.beautifyHTML){var c=null===(s=this.j.events)||void 0===s?void 0:s.fire("beautifyHTML",r);(0,o.isString)(c)&&(r=c)}(0,u.pasteInsertHtml)(t,this.j,r)},t}(s.pasteFromWord);t.PasteFromWordPro=c,i.Jodit.plugins.remove("pasteFromWord"),i.Jodit.plugins.add("pasteFromWordPro",c)}},function(e){return e(e.s=35794)}])}));
|
|
1
|
+
"use strict";!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[92],{57300:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.cleanStyles=void 0;var r={"text-justify":["inter-ideograph"]};t.cleanStyles=function(e){return e.isElement&&e.attributes.style&&Object.keys(r).forEach((function(t){var n=r[t];e.style.has(t)&&n.includes(e.style.get(t).toString())&&e.style.set(t,null)})),e}},68356:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearAttributes=void 0;var n=r(70655),i=["cellspacing","cellpadding","border","v:shapes","o:spid"];t.clearAttributes=function(e){var t,r;if(/^OLE_LINK\d+$/.test(e.attributes.name)&&(e.attributes.name=null,0===e.length))return e.remove(),null;"_GoBack"===e.attributes.name&&(e.attributes.name=null);try{for(var a=n.__values(i),o=a.next();!o.done;o=a.next()){var l=o.value;e.attributes[l]&&(e.attributes[l]=null)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return e}},67635:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearClassName=void 0;var n=r(589);t.clearClassName=function(e){return e.attributes.class&&(e.attributes.class=e.attributes.class.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/gi,""),(0,n.trim)(e.attributes.class)||(e.attributes.class=null)),e}},57446:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.convertStyleUnitToPixels=void 0;var n=r(29580);t.convertStyleUnitToPixels=function(e,t){if(!t.jodit.o.pasteFromWord.convertUnitsToPixel)return e;var r=e.style;return r.forEach((function(e){var t=r.get(e);t&&r.set(e,t.toString().replace(/\d+(\.\d+)?(pt|cm)/g,(function(e){return(0,n.convertUnitToPx)(e)+"px"})))})),e}},44815:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.removeRedundancyStyle=t.convertToList=void 0;var n=r(29580),i=r(18566),a=r(11606),o=r(51330);function l(e){var t;!(0,i.isList)(e)||"li"===(null===(t=e.parent)||void 0===t?void 0:t.name)||"disc"!==e.style.get(o.STYLE_CSS_KEY)&&"decimal"!==e.style.get(o.STYLE_CSS_KEY)||e.style.set(o.STYLE_CSS_KEY,null)}t.convertToList=function(e){var t;if((0,i.isPseudoLeaf)(e)){e.name="li",e.style.set("text-indent",null);var r=s(e),a=/[\da-np-zA-NP-Z].?/.test(r)?"ol":"ul",u=function(e,t){for(var r in o.listStyleMap)if(RegExp(r).test(e))return o.listStyleMap[r];return"ol"===t?"decimal":"disc"}(r,a);e.attributes[o.TYPE_KEY]=a,e.attributes[o.STYLE_KEY]=u,(0,n.calcListLevels)(e),function(e){for(;e;){var t=e.previousElement;if(!(0,i.isLeaf)(t)&&!(0,i.isList)(t))break;if((0,i.isLeaf)(t)){if(t.attributes[o.LEVEL_KEY]>e.attributes[o.LEVEL_KEY])break;if(e.attributes[o.LEVEL_KEY]===t.attributes[o.LEVEL_KEY]&&e.parent&&(0,i.isSameType)(e,e.parent))break;t.append(e)}else{var r=t;if(r.attributes[o.LEVEL_KEY]>e.attributes[o.LEVEL_KEY])break;if(e.attributes[o.LEVEL_KEY]===r.attributes[o.LEVEL_KEY]&&!(0,i.isSameType)(e,r))break;r.append(e)}}}(e);var c=e.parent;if(!(0,i.isList)(c)||!(0,i.isSameType)(e,c)){var f=function(e,t,r,i){var a=e.wrap(t);return a.attributes.start=(0,n.calcStartBySymbol)(r),a.attributes[o.LEVEL_KEY]=e.attributes[o.LEVEL_KEY],a.attributes[o.STYLE_KEY]=e.attributes[o.STYLE_KEY],a.attributes[o.STYLE_VALID_KEY]=e.attributes[o.STYLE_KEY],a.style.set(o.STYLE_CSS_KEY,i),l(a),a}(e,a,r,u);return(0,i.isList)(c)&&(f.remove(),null===(t=c.lastElement)||void 0===t||t.append(f)),e}}return e},t.removeRedundancyStyle=l;var s=function(e){return e.textBetween((function(e){return e.isComment&&/\[if.*supportLists.*]/.test((0,i.html)(e))}),(function(e){return e.isComment&&/\[endif]/.test((0,i.html)(e))})).replace(/ /g,"").replace((0,a.SPACE_REG_EXP)(),"")}},2394:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.cases=void 0;var n=r(44815),i=r(68356),a=r(65302),o=r(75099),l=r(74587),s=r(57446),u=r(67635),c=r(35264),f=r(41925),d=r(83161),p=r(26549),m=r(40522),v=r(57300);t.cases=[m.processImage,p.markPageBreakElements,a.removeExtraTags,o.replaceOldTags,i.clearAttributes,n.convertToList,c.processLinks,l.removeInsideComment,s.convertStyleUnitToPixels,u.clearClassName,f.normalizeImageProps,d.removeWidthFromTableCell,v.cleanStyles]},26549:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.markPageBreakElements=void 0,t.markPageBreakElements=function(e){return(e.isElement&&"always"===e.style.get("page-break-before")||"page"===e.style.get("break-before"))&&(e.attributes["jd-safe"]=!0,e.style.add("page-break-before","always"),e.isSingle&&(e.name="div")),e}},41925:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeImageProps=void 0,t.normalizeImageProps=function(e){return e.isElement?("img"===e.name&&(e.attributes.align&&(e.style.add("float",e.attributes.align),e.attributes.align=null),e.attributes.hspace&&(e.style.add("marginLeft",e.attributes.hspace+"px"),e.style.add("marginRight",e.attributes.hspace+"px"),e.attributes.hspace=null)),e):e}},40522:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.processImage=void 0;var n=r(70655),i=r(75204);function a(e,t,r,i){var a,o,l=e.split(r);try{for(var s=n.__values(l),u=s.next();!u.done;u=s.next()){var c=u.value.split("shplid");if(c.length>1){for(var f=c[1],d="",p=0;f.length>p&&!/[{ \r\n\\]/.test(f[p]);p++)d+=f[p];var m=f.split("bliptag");if(m&&2>m.length)continue;var v=null;if(m[0].indexOf("pngblip")?v="image/png":-1!==m[0].indexOf("jpegblip")&&(v="image/jpeg"),!v)continue;var h=m[1].split("}");if(h&&2>h.length)continue;var y=void 0;if(h.length>2&&h[0].includes("blipuid"))y=h[1].split(" ");else{if((y=h[0].split(" "))&&2>y.length)continue;y.shift()}i[t+d]={hex:y.join(""),type:v}}}}catch(e){a={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(a)throw a.error}}}t.processImage=function(e,t){var r;if(t.rtf&&"#comment"===e.name&&e.attributes.nodeValue&&-1!==e.attributes.nodeValue.indexOf("<v:shape")){t.shapes||(t.shapes={});var n=t.jodit.create.fromHTML(e.attributes.nodeValue);return(0,i.toArray)(n.getElementsByTagName("v:shape")).forEach((function(e){t.shapes[e.id]=e.getAttribute("o:spid")})),e}if("img"!==e.name)return e;if(t.rtf&&e.attributes["v:shapes"]){var o=null===(r=t.shapes)||void 0===r?void 0:r[e.attributes["v:shapes"]];if(o){t.imageMap||(t.imageMap={},a(t.rtf,"i","\\shppict",t.imageMap),a(t.rtf,"s","\\shp{",t.imageMap));var l=t.imageMap[o.substring(7)];if(l){var s=[],u=l.hex.match(/[0-9a-f]{2}/gi);if(u){for(var c=0;u.length>c;c++)s.push(String.fromCharCode(parseInt(u[c],16)));e.attributes.src="data:"+l.type+";base64,"+btoa(s.join(""))}}}}return e}},35264:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.processLinks=void 0,t.processLinks=function(e,t){var r,n=null!==(r=t.links)&&void 0!==r?r:{};if(e.attributes.href&&e.attributes.href.match(/#.+$/)&&(n[e.attributes.href.match(/#(.+)$/)[1]]=e),e.attributes.name&&n[e.attributes.name]){var i=n[e.attributes.name];i.attributes.href=i.attributes.href.replace(/.*#(.*)$/,"#$1")}return t.links=n,e}},65302:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeExtraTags=void 0;var r=new Set(["o:p","xml","script","meta","link","v:imagedata","style"]);t.removeExtraTags=function(e){return"none"===e.style.get("display")||0===e.length&&"span"===e.name||r.has(e.name)?(e.remove(),null):e}},74587:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.removeInsideComment=void 0;var n=r(18566),i=0;t.removeInsideComment=function(e){return e.isComment&&/\[if.*(supportLists|gte vml).*]/.test((0,n.html)(e))&&(i++,e.remove()),e.isComment&&i>0&&(0,n.html)(e).includes("[endif]")&&(i=i>0?i-1:0,e.remove()),i&&(e.isText||"img"===e.name&&(!e.attributes.src||/^file:/.test(e.attributes.src)))?(e.remove(),null):e}},75099:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.replaceOldTags=void 0;var r={i:"em",b:"strong"};t.replaceOldTags=function(e){var t=e.name;return t in r&&(e.name=r[t]),e}},83161:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeWidthFromTableCell=void 0,t.removeWidthFromTableCell=function(e){return!e.attributes.width||"th"!==e.name&&"td"!==e.name||(e.attributes.width=null),e}},78322:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),r(85119).Config.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1,allowedStyleProps:["background","background-color","border","border-.*","color","float","font-family","font-size","font-style","font-weight","height","line-height","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","padding","text-align","text-justify","text-decoration","text-indent","vertical-align","width"]}},51330:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.listStyleMap=t.STYLE_CSS_KEY=t.STYLE_VALID_KEY=t.STYLE_KEY=t.TYPE_KEY=t.LEVEL_KEY=void 0,t.LEVEL_KEY="jd-list-level",t.TYPE_KEY="jd-list-type",t.STYLE_KEY="jd-list-style-type",t.STYLE_VALID_KEY="data-list-style-type",t.STYLE_CSS_KEY="list-style-type",t.listStyleMap={"·":"disc",o:"circle","§":"square","[ivx]":"lower-roman","[IVX]":"upper-roman","[a-z]":"lower-alpha","[A-Z]":"upper-alpha","\\d":"decimal"}},77800:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.isSameType=t.isPseudoLeaf=t.isLeaf=t.isList=void 0;var n=r(46801),i=r(51330);t.isList=function(e){return Boolean(e&&("ol"===e.name||"ul"===e.name))},t.isLeaf=function(e){return Boolean(e&&"li"===e.name)},t.isPseudoLeaf=function(e){return"li"!==e.name&&/mso-list:\s*l\d+ level\d+ lfo\d+/i.test(e.attributes.style)||/msolistparagraph/i.test(e.attributes.class)&&Boolean(e.find((function(e){return e.isComment&&(0,n.html)(e).includes("supportLists")})).length)},t.isSameType=function(e,t){return!(t.name!==e.attributes[i.TYPE_KEY]||t.attributes[i.STYLE_KEY]!==e.attributes[i.STYLE_KEY]||e.attributes[i.LEVEL_KEY]!==t.attributes[i.LEVEL_KEY])}},94616:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.JElement=void 0;var n=r(70655),i=r(44370),a=r(11606),o=r(75204),l=r(46801),s=r(15002),u=new Set(a.INSEPARABLE_TAGS),c=function(){function e(t,r){var n=this;this.parent=r,this.name=t.nodeName.toLowerCase(),this.type=t.nodeType,this.attributes=function(e){var t={};if(i.Dom.isElement(e))for(var r=0,n=e.attributes;n.length>r;r+=1)t[n[r].name]=n[r].value;else t.nodeValue=e.nodeValue;return t}(t),this.style=new s.Style(this.attributes.style),this.children=[],t.childNodes.forEach((function(t){return n.children.push(e.make(t,n))}))}return Object.defineProperty(e.prototype,"isText",{get:function(){return this.type===Node.TEXT_NODE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isElement",{get:function(){return this.type===Node.ELEMENT_NODE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isComment",{get:function(){return this.type===Node.COMMENT_NODE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSingle",{get:function(){return u.has(this.name)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.children.length},enumerable:!1,configurable:!0}),e.make=function(t,r){return void 0===r&&(r=null),new e(t,r)},e.prototype.wrap=function(t){var r;(0,o.assert)(null!=this.parent,"You can't wrap the root element");var n=e.make(document.createElement(t),this.parent),i=null!==(r=this.parent.children.indexOf(this))&&void 0!==r?r:-1;return-1===i?this.parent.append(n):this.parent.children[i]=n,n.append(this),n},e.prototype.append=function(e){return(0,o.assert)(e!==this,"Forbidden to add to yourself"),e.remove(),this.children.push(e),e.parent=this,this},Object.defineProperty(e.prototype,"previousElement",{get:function(){if(!this.parent)return null;var e=this.parent.children,t=e.indexOf(this);if(-1!==t)for(var r=t-1;r>=0;r-=1)if(e[r].isElement)return e[r];return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElement",{get:function(){for(var e=this.children,t=e.length-1;t>=0;t-=1)if(e[t].isElement)return e[t];return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){var e,t,r;return null!==(r=null!==(e=this.sibling(!1))&&void 0!==e?e:null===(t=this.parent)||void 0===t?void 0:t.previous)&&void 0!==r?r:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){var e,t,r;return null!==(r=null!==(e=this.sibling(!0))&&void 0!==e?e:null===(t=this.parent)||void 0===t?void 0:t.next)&&void 0!==r?r:null},enumerable:!1,configurable:!0}),e.prototype.sibling=function(e){if(!this.parent)return null;var t=this.parent.children,r=t.indexOf(this);return-1!==r&&t[r+(e?1:-1)]?t[r+(e?1:-1)]:null},e.prototype.forEach=function(e,t){var r,i;void 0===t&&(t=!1);var a=n.__spreadArray([],n.__read(this.children),!1);try{for(var o=n.__values(a),l=o.next();!l.done;l=o.next()){var s=l.value;if(!1===e(s))return!1;if(t&&!1===s.forEach(e,!0))return!1}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},e.prototype.find=function(e,t){void 0===t&&(t=!0);var r=[];return this.forEach((function(t){e(t)&&r.push(t)}),t),r},e.prototype.map=function(e){return this.children.map(e)},e.prototype.remove=function(){var e,t,r=null===(e=this.parent)||void 0===e?void 0:e.children.indexOf(this);return null!=r&&-1!==r&&(null===(t=this.parent)||void 0===t||t.children.splice(r,1)),this},e.prototype.textBetween=function(e,t){var r=!1,n=[];return this.forEach((function(i){if(!r&&e(i)&&(r=!0),r&&i.isText&&n.push((0,l.html)(i)),r&&t(i))return!1}),!0),n.join("")},e}();t.JElement=c},18566:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(70655);n.__exportStar(r(77800),t),n.__exportStar(r(94616),t),n.__exportStar(r(46801),t)},46801:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.innerHTML=t.html=void 0;var n=r(75204);function i(e,t,r,n){switch(void 0===t&&(t=function(){return!0}),void 0===r&&(r=!0),!0){case e.isComment:case e.isText:if(!t(e))return"";var i=e.attributes.nodeValue;return e.isComment?"\x3c!--".concat(i,"--\x3e"):i;case e.isElement:var s=e.attributes,u=o(e,t,r,n);if(!e.attributes["jd-safe"]&&r&&0===u.replace(/[\n\t]/g,"").length&&!e.isSingle)return"";var c=Object.keys(s).map((function(e){return"style"===e||null==s[e]||/^jd-/.test(e)?"":"".concat(e,'="').concat(l(s[e]),'"')})).filter(Boolean),f=l((0,e.style.str)((function(e){return a(e,n)})));if(f&&c.push('style="'.concat(f,'"')),r&&0===c.length&&["span","a"].includes(e.name))return u;var d=c.length?" "+c.join(" "):"";return t(e)?e.isSingle?"<".concat(e.name).concat(d,"/>"):"<".concat(e.name).concat(d,">").concat(u,"</").concat(e.name,">"):u}return""}function a(e,t){var r;if(!t)return!0;if(a.cache.has(t)){var i=null===(r=a.cache.get(t))||void 0===r?void 0:r.get(e);if((0,n.isBoolean)(i))return i}var o=t.some((function(t){return new RegExp(t).test(e)})),l=a.cache.get(t)||new Map;return l.set(e,o),a.cache.set(t,l),o}function o(e,t,r,a){void 0===t&&(t=function(){return!0}),void 0===r&&(r=!0);var o=e.map((function(e){return i(e,t,r,a)})).join("");return"p"===e.name&&0===(0,n.trim)(o).length&&(o=" "),o}function l(e){return e.toString().replace(/"/g,""")}t.html=i,a.cache=new WeakMap,t.innerHTML=o},15002:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Style=void 0;var n=r(70655),i=r(75204),a=r(23112),o=function(){function e(e){this._data=l(e)}return Object.defineProperty(e.prototype,"keys",{get:function(){return Object.keys(this._data)},enumerable:!1,configurable:!0}),e.prototype.forEach=function(e){this.keys.forEach((function(t){return e(t)}))},e.prototype.clear=function(){this._data={}},e.prototype.set=function(e,t){this._data[e]=t},e.prototype.get=function(e){var t;return null!==(t=this._data[e])&&void 0!==t?t:null},e.prototype.has=function(e){return void 0!==this._data[e]},e.prototype.add=function(e,t){return this._data=l(this.str()+";"+"".concat(e,":").concat(t)),this},e.prototype.str=function(e){var t=this;void 0===e&&(e=function(e){return!0});var r=Object.keys(this._data).filter((function(r){return r&&!/^mso-/.test(r)&&e(r)&&null!=t.get(r)}));return r.length?r.map((function(e){return"".concat((0,i.kebabCase)(e),":").concat(t.get(e))})).join(";"):""},n.__decorate([a.autobind],e)}();function l(e){return function(e){for(var t={},r=[],n=e.length-1;n>=0;n-=1){var i=e[n][0];t[i]||(t[i]=!0,r.unshift(e[n]))}return r}((null!=e?e:"").replace(/"/g,'"').split(";").filter(Boolean).map((function(e){return(0,i.trim)(e).split(":").map(i.trim)}))).reduce((function(e,t){var r=n.__read(t,2),i=r[0],a=r[1];return i&&a&&(e[i]=a),e}),{})}t.Style=o},64282:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.applyStylesPro=void 0;var n=r(75204),i=r(44370),a=r(37987),o=r(18566);t.applyStylesPro=function(e,t,r,l){var s,u;void 0===l&&(l="");var c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);try{var f=null!==(s=c.contentDocument)&&void 0!==s?s:null===(u=c.contentWindow)||void 0===u?void 0:u.document;if(!f)return t;f.open(),f.write(t),f.close();for(var d="jd-style",p=function(e){try{for(var t=f.styleSheets[e].cssRules,r=function(e){if(!t[e].selectorText)return"continue";(0,n.$$)(t[e].selectorText,f.body).forEach((function(r){(0,n.attr)(r,d)||((0,n.attr)(r,d,(0,n.attr)(r,"style")||""),(0,n.attr)(r,"style","")),(0,n.attr)(r,"style","".concat((0,n.attr)(r,"style"),";").concat(t[e].style.cssText))}))},i=0;t.length>i;i+=1)r(i)}catch(e){}},m=0;f.styleSheets.length>m;m+=1)p(m);return(0,n.$$)("[".concat(d,"]"),f.body).forEach((function(e){(0,n.attr)(e,"style","".concat((0,n.attr)(e,"style"),";").concat((0,n.attr)(e,d)))})),(0,a.transformWordToHtml)(e,o.JElement.make(f.body),r,l)}finally{i.Dom.safeRemove(c)}return t}},20036:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.calcListLevels=void 0;var n=r(70655),i=r(18566),a=r(51330),o=r(90998);t.calcListLevels=function(e){if(void 0===e.attributes[a.LEVEL_KEY]){for(var t=[(0,o.realPixelIndent)(e)],r=[e],l=e.next;l;){if(l.isElement&&!l.attributes[a.LEVEL_KEY]&&(0,i.isPseudoLeaf)(l)){var s=(0,o.realPixelIndent)(l);s&&(t.push(s),r.push(l))}l=l.next}var u=Math.min.apply(Math,n.__spreadArray([],n.__read(t.filter((function(e){return e>0}))),!1)),c=t.map((function(e){return Math.ceil(e/10)}));-1!==c.indexOf(0)&&(c=c.map((function(e){return e+1}))),r.forEach((function(e,t){e.attributes[a.LEVEL_KEY]=c[t],e.style.add("margin-left","".concat(Math.max((0,o.realPixelIndent)(e)-10*c[t]/u*40,0),"px"))}))}}},90998:function(e,t){function r(e){if(!e)return[0,0,0,0];var t=e.match(/(0|auto|(-?[.\d]+(?:\w+|%)))/g)||["0px"];switch(t.length){case 2:return[0,1,0,1].map((function(e){return t[e]}));case 3:return[0,1,2,1].map((function(e){return t[e]}));case 4:return[0,1,2,3].map((function(e){return t[e]}));default:return[0,0,0,0].map((function(e){return t[e]}))}}var n;function i(e){if("number"==typeof e)return e;if(/%$/.test(e))return 0;n||(n=document.createElement("div"),Object.assign(n.style,{position:"absolute",left:"-9999px",top:"-9999px",margin:"0",padding:"0",border:"0"}),document.body.append(n),setTimeout((function(){null==n||n.remove(),n=null})));var t=0>parseFloat(e);t&&(e=e.replace("-","")),n.style.width=e;var r=n.clientWidth;return t?-r:r}Object.defineProperty(t,"__esModule",{value:!0}),t.calcStartBySymbol=t.realPixelIndent=t.convertUnitToPx=t.calcMarginParts=void 0,t.calcMarginParts=r,t.convertUnitToPx=i,t.realPixelIndent=function(e){var t=e.style,n=t.keys.filter((function(e){return/margin/.test(e)})),a=Math.max(n.indexOf("margin-left"),n.indexOf("margin")),o=a>0?n[a]:"margin-left";return i("margin"===o?r(t.get("margin"))[3]||0:t.get(o)||0)},t.calcStartBySymbol=function(e){return/\d.\d/.test(e)?e.split(".").pop()||null:/^\d/.test(e)?(parseInt(e,10)||1).toString():null}},29580:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(70655);n.__exportStar(r(90998),t),n.__exportStar(r(64282),t),n.__exportStar(r(37987),t),n.__exportStar(r(20036),t)},37987:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.transformWordToHtml=void 0;var n=r(70655),i=r(2394),a=r(589),o=r(18566);t.transformWordToHtml=function(e,t,r,l){var s={jodit:e,rtf:l};return t.forEach((function e(t){var r,a;if(t){try{for(var o=n.__values(i.cases),l=o.next();!l.done&&null!=(t=(0,l.value)(t,s));l=o.next());}catch(e){r={error:e}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}null==t||t.forEach(e)}})),r&&t.forEach((function(e){e.style.clear()}),!0),(0,a.trim)((0,o.innerHTML)(t,(function(e){return!e.isComment}),!0,e.o.pasteFromWord.allowedStyleProps))}},35794:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.PasteFromWordPro=void 0;var n=r(70655),i=r(97029),a=r(11606),o=r(10728),l=r(82726),s=r(29580);r(78322);var u=r(47036),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.insertFromWordByType=function(t,r,n,i){var l;if(!this.j.o.pasteFromWord.enable||n!==a.INSERT_AS_HTML&&n!==a.INSERT_AS_TEXT)return e.prototype.insertFromWordByType.call(this,t,r,n,i);if(r=(0,s.applyStylesPro)(this.j,r,n===a.INSERT_AS_TEXT,i.rtf),this.j.o.beautifyHTML){var c=null===(l=this.j.events)||void 0===l?void 0:l.fire("beautifyHTML",r);(0,o.isString)(c)&&(r=c)}(0,u.pasteInsertHtml)(t,this.j,r)},t}(l.pasteFromWord);t.PasteFromWordPro=c,i.Jodit.plugins.remove("pasteFromWord"),i.Jodit.plugins.add("pasteFromWordPro",c)}},function(e){return e(e.s=35794)}])}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";((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]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[92],{75293(t,e,n){n.r(e),n.d(e,{PasteFromWordPro:()=>B});var r=n(38219),s=n(11606),i=n(10728),a=n(33075);let l;function o(t){if("number"==typeof t)return t;if(/%$/.test(t))return 0;l||(l=document.createElement("div"),Object.assign(l.style,{position:"absolute",left:"-9999px",top:"-9999px",margin:"0",padding:"0",border:"0"}),document.body.append(l),setTimeout((()=>{null==l||l.remove(),l=null})));const e=0>parseFloat(t);e&&(t=t.replace("-","")),l.style.width=t;const n=l.clientWidth;return e?-n:n}function u(t){const{style:e}=t;let n=[0,0,0,0];const r=e.keys.filter((t=>/margin/.test(t))),s=Math.max(r.indexOf("margin-left"),r.indexOf("margin")),i=s>0?r[s]:"margin-left";let a;return"margin"===i?(n=(t=>{if(!t)return[0,0,0,0];const e=t.match(/(0|auto|(-?[.\d]+(?:\w+|%)))/g)||["0px"];switch(e.length){case 2:return[0,1,0,1].map((t=>e[t]));case 3:return[0,1,2,1].map((t=>e[t]));case 4:return[0,1,2,3].map((t=>e[t]));default:return[0,0,0,0].map((t=>e[t]))}})(e.get("margin")),a=n[3]||0):a=e.get(i)||0,o(a)}var c=n(91037),p=n(44370);function d(t,e=(()=>!0),n=!0,r){switch(!0){case t.isComment:case t.isText:{if(!e(t))return"";const{nodeValue:n}=t.attributes;return t.isComment?`\x3c!--${n}--\x3e`:n}case t.isElement:{const{attributes:s}=t,i=f(t,e,n,r);if(!t.attributes["jd-safe"]&&n&&0===i.replace(/[\n\t]/g,"").length&&!t.isSingle)return"";const a=Object.keys(s).map((t=>"style"===t||null==s[t]||/^jd-/.test(t)?"":`${t}="${m(s[t])}"`)).filter(Boolean),{str:l}=t.style,o=m(l((t=>h(t,r))));if(o&&a.push(`style="${o}"`),n&&0===a.length&&["span","a"].includes(t.name))return i;const u=a.length?" "+a.join(" "):"";return e(t)?t.isSingle?`<${t.name}${u}/>`:`<${t.name}${u}>${i}</${t.name}>`:i}}return""}function h(t,e){var n;if(!e)return!0;if(h.cache.has(e)){const r=null===(n=h.cache.get(e))||void 0===n?void 0:n.get(t);if((0,c.isBoolean)(r))return r}const r=e.some((e=>RegExp(e).test(t))),s=h.cache.get(e)||new Map;return s.set(t,r),h.cache.set(e,s),r}function f(t,e=(()=>!0),n=!0,r){let s=t.map((t=>d(t,e,n,r))).join("");return"p"===t.name&&0===(0,c.trim)(s).length&&(s=" "),s}function m(t){return(""+t).replace(/"/g,""")}h.cache=new WeakMap;const g="jd-list-level",b="jd-list-type",y="jd-list-style-type",v="list-style-type",x={"·":"disc",o:"circle","§":"square","[ivx]":"lower-roman","[IVX]":"upper-roman","[a-z]":"lower-alpha","[A-Z]":"upper-alpha","\\d":"decimal"};function E(t){return!(!t||"ol"!==t.name&&"ul"!==t.name)}function j(t){return!(!t||"li"!==t.name)}function k(t){return/mso-list:\s*l\d+ level\d+ lfo\d+/i.test(t.attributes.style)||/msolistparagraph/i.test(t.attributes.class)&&!!t.find((t=>t.isComment&&d(t).includes("supportLists"))).length}function w(t,e){return!(e.name!==t.attributes[b]||e.attributes[y]!==t.attributes[y]||t.attributes[g]!==e.attributes[g])}var T=n(70655),$=n(41257);let _=class{constructor(t){this._data=O(t)}get keys(){return Object.keys(this._data)}forEach(t){this.keys.forEach((e=>t(e)))}clear(){this._data={}}set(t,e){this._data[t]=e}get(t){var e;return null!==(e=this._data[t])&&void 0!==e?e:null}add(t,e){return this._data=O(this.str()+";"+`${t}:${e}`),this}str(t=(t=>!0)){const e=Object.keys(this._data).filter((e=>e&&!/^mso-/.test(e)&&t(e)&&null!=this.get(e)));return e.length?e.map((t=>`${(0,c.kebabCase)(t)}:${this.get(t)}`)).join(";"):""}};function O(t){return(t=>{const e={},n=[];for(let r=t.length-1;r>=0;r-=1){const s=t[r][0];e[s]||(e[s]=!0,n.unshift(t[r]))}return n})((null!=t?t:"").replace(/"/g,'"').split(";").filter(Boolean).map((t=>(0,c.trim)(t).split(":").map(c.trim)))).reduce(((t,[e,n])=>(e&&n&&(t[e]=n),t)),{})}_=(0,T.gn)([$.autobind],_);const S=new Set(s.INSEPARABLE_TAGS);class C{constructor(t,e){this.parent=e,this.name=t.nodeName.toLowerCase(),this.type=t.nodeType,this.attributes=(t=>{const e={};if(p.i.isElement(t))for(let n=0,r=t.attributes;r.length>n;n+=1)e[r[n].name]=r[n].value;else e.nodeValue=t.nodeValue;return e})(t),this.style=new _(this.attributes.style),this.children=[],t.childNodes.forEach((t=>this.children.push(C.make(t,this))))}get isText(){return this.type===Node.TEXT_NODE}get isElement(){return this.type===Node.ELEMENT_NODE}get isComment(){return this.type===Node.COMMENT_NODE}get isSingle(){return S.has(this.name)}get length(){return this.children.length}static make(t,e=null){return new C(t,e)}wrap(t){var e;(0,c.assert)(null!=this.parent,"You can't wrap the root element");const n=C.make(document.createElement(t),this.parent),r=null!==(e=this.parent.children.indexOf(this))&&void 0!==e?e:-1;return-1===r?this.parent.append(n):this.parent.children[r]=n,n.append(this),n}append(t){return(0,c.assert)(t!==this,"Forbidden to add to yourself"),t.remove(),this.children.push(t),t.parent=this,this}get previousElement(){if(!this.parent)return null;const{children:t}=this.parent,e=t.indexOf(this);if(-1!==e)for(let n=e-1;n>=0;n-=1)if(t[n].isElement)return t[n];return null}get lastElement(){const{children:t}=this;for(let e=t.length-1;e>=0;e-=1)if(t[e].isElement)return t[e];return null}get previous(){var t,e,n;return null!==(n=null!==(t=this.sibling(!1))&&void 0!==t?t:null===(e=this.parent)||void 0===e?void 0:e.previous)&&void 0!==n?n:null}get next(){var t,e,n;return null!==(n=null!==(t=this.sibling(!0))&&void 0!==t?t:null===(e=this.parent)||void 0===e?void 0:e.next)&&void 0!==n?n:null}sibling(t){if(!this.parent)return null;const{children:e}=this.parent,n=e.indexOf(this);return-1!==n&&e[n+(t?1:-1)]?e[n+(t?1:-1)]:null}forEach(t,e=!1){const n=[...this.children];for(const r of n){if(!1===t(r))return!1;if(e&&!1===r.forEach(t,!0))return!1}}find(t,e=!0){const n=[];return this.forEach((e=>{t(e)&&n.push(e)}),e),n}map(t){return this.children.map(t)}remove(){var t,e;const n=null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this);return null!=n&&-1!==n&&(null===(e=this.parent)||void 0===e||e.children.splice(n,1)),this}textBetween(t,e){let n=!1;const r=[];return this.forEach((s=>{if(!n&&t(s)&&(n=!0),n&&s.isText&&r.push(d(s)),n&&e(s))return!1}),!0),r.join("")}}const M=["cellspacing","cellpadding","border","v:shapes","o:spid"],N=new Set(["o:p","xml","script","meta","link","v:imagedata","style"]),L={i:"em",b:"strong"};let P=0;var R=n(589);function W(t,e,n,r){const s=t.split(n);for(const t of s){const n=t.split("shplid");if(n.length>1){const t=n[1];let s="";for(let e=0;t.length>e&&!/[{ \r\n\\]/.test(t[e]);e++)s+=t[e];const i=t.split("bliptag");if(i&&2>i.length)continue;let a=null;if(i[0].indexOf("pngblip")?a="image/png":-1!==i[0].indexOf("jpegblip")&&(a="image/jpeg"),!a)continue;const l=i[1].split("}");if(l&&2>l.length)continue;let o;if(l.length>2&&l[0].includes("blipuid"))o=l[1].split(" ");else{if(o=l[0].split(" "),o&&2>o.length)continue;o.shift()}r[e+s]={hex:o.join(""),type:a}}}}const A=[(t,e)=>{var n;if(e.rtf&&"#comment"===t.name&&t.attributes.nodeValue&&-1!==t.attributes.nodeValue.indexOf("<v:shape")){e.shapes||(e.shapes={});const n=e.jodit.create.fromHTML(t.attributes.nodeValue);return(0,c.toArray)(n.getElementsByTagName("v:shape")).forEach((t=>{e.shapes[t.id]=t.getAttribute("o:spid")})),t}if("img"!==t.name)return t;if(e.rtf&&t.attributes["v:shapes"]){const r=null===(n=e.shapes)||void 0===n?void 0:n[t.attributes["v:shapes"]];if(r){e.imageMap||(e.imageMap={},W(e.rtf,"i","\\shppict",e.imageMap),W(e.rtf,"s","\\shp{",e.imageMap));const n=e.imageMap[r.substring(7)];if(n){const e=[],r=n.hex.match(/[0-9a-f]{2}/gi);if(r){for(let t=0;r.length>t;t++)e.push(String.fromCharCode(parseInt(r[t],16)));t.attributes.src="data:"+n.type+";base64,"+btoa(e.join(""))}}}}return t},t=>((t.isElement&&"always"===t.style.get("page-break-before")||"page"===t.style.get("break-before"))&&(t.attributes["jd-safe"]=!0,t.style.add("page-break-before","always"),t.isSingle&&(t.name="div")),t),t=>"none"===t.style.get("display")||0===t.length&&"span"===t.name||N.has(t.name)?(t.remove(),null):t,t=>{const{name:e}=t;return e in L&&(t.name=L[e]),t},t=>{if(/^OLE_LINK\d+$/.test(t.attributes.name)&&(t.attributes.name=null,0===t.length))return t.remove(),null;"_GoBack"===t.attributes.name&&(t.attributes.name=null);for(const e of M)t.attributes[e]&&(t.attributes[e]=null);return t},t=>{var e;if(k(t)){t.name="li",t.style.set("text-indent",null);const n=(t=>t.textBetween((t=>t.isComment&&/\[if.*supportLists.*]/.test(d(t))),(t=>t.isComment&&/\[endif]/.test(d(t)))).replace(/ /g,"").replace((0,s.SPACE_REG_EXP)(),""))(t),r=/[\da-np-zA-NP-Z].?/.test(n)?"ol":"ul",i=((t,e)=>{for(const e in x)if(RegExp(e).test(t))return x[e];return"ol"===e?"decimal":"disc"})(n,r);t.attributes[b]=r,t.attributes[y]=i,(t=>{if(void 0!==t.attributes[g])return;const e=[u(t)],n=[t];let r=t.next;for(;r;){if(r.isElement&&!r.attributes[g]&&k(r)){const t=u(r);t&&(e.push(t),n.push(r))}r=r.next}const s=Math.min(...e.filter((t=>t>0)));let i=e.map((t=>Math.ceil(t/10)));-1!==i.indexOf(0)&&(i=i.map((t=>t+1))),n.forEach(((t,e)=>{t.attributes[g]=i[e],t.style.add("margin-left",Math.max(u(t)-10*i[e]/s*40,0)+"px")}))})(t),(t=>{for(;t;){const e=t.previousElement;if(!j(e)&&!E(e))break;if(j(e)){if(e.attributes[g]>t.attributes[g])break;if(t.attributes[g]===e.attributes[g]&&t.parent&&w(t,t.parent))break;e.append(t);continue}const n=e;if(n.attributes[g]>t.attributes[g])break;if(t.attributes[g]===n.attributes[g]&&!w(t,n))break;n.append(t)}})(t);const{parent:a}=t;if(!E(a)||!w(t,a)){const s=((t,e,n,r)=>{const s=t.wrap(e);return s.attributes.start=(t=>/\d.\d/.test(t)?t.split(".").pop()||null:/^\d/.test(t)?""+(parseInt(t,10)||1):null)(n),s.attributes[g]=t.attributes[g],s.attributes[y]=t.attributes[y],s.attributes["data-list-style-type"]=t.attributes[y],s.style.set(v,r),(t=>{var e;!E(t)||"li"===(null===(e=t.parent)||void 0===e?void 0:e.name)||"disc"!==t.style.get(v)&&"decimal"!==t.style.get(v)||t.style.set(v,null)})(s),s})(t,r,n,i);return E(a)&&(s.remove(),null===(e=a.lastElement)||void 0===e||e.append(s)),t}}return t},(t,e)=>{var n;const r=null!==(n=e.links)&&void 0!==n?n:{};if(t.attributes.href&&t.attributes.href.match(/#.+$/)&&(r[t.attributes.href.match(/#(.+)$/)[1]]=t),t.attributes.name&&r[t.attributes.name]){const e=r[t.attributes.name];e.attributes.href=e.attributes.href.replace(/.*#(.*)$/,"#$1")}return e.links=r,t},t=>(t.isComment&&/\[if.*(supportLists|gte vml).*]/.test(d(t))&&(P++,t.remove()),t.isComment&&P>0&&d(t).includes("[endif]")&&(P=P>0?P-1:0,t.remove()),P&&(t.isText||"img"===t.name&&(!t.attributes.src||/^file:/.test(t.attributes.src)))?(t.remove(),null):t),(t,{jodit:e})=>{if(!e.o.pasteFromWord.convertUnitsToPixel)return t;const{style:n}=t;return n.forEach((t=>{const e=n.get(t);e&&n.set(t,(""+e).replace(/\d+(\.\d+)?(pt|cm)/g,(t=>o(t)+"px")))})),t},t=>(t.attributes.class&&(t.attributes.class=t.attributes.class.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/gi,""),(0,R.f)(t.attributes.class)||(t.attributes.class=null)),t),t=>t.isElement?("img"===t.name&&(t.attributes.align&&(t.style.add("float",t.attributes.align),t.attributes.align=null),t.attributes.hspace&&(t.style.add("marginLeft",t.attributes.hspace+"px"),t.style.add("marginRight",t.attributes.hspace+"px"),t.attributes.hspace=null)),t):t,t=>(!t.attributes.width||"th"!==t.name&&"td"!==t.name||(t.attributes.width=null),t)];n(85119).D.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1,allowedStyleProps:["background","background-color","border","border-.*","color","float","font-family","font-size","font-style","font-weight","height","line-height","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","padding","text-align","text-autospace","text-justify","text-decoration","text-indent","vertical-align","width"]};var F=n(47036);class B extends a.L{insertFromWordByType(t,e,n,r){var a;if(!this.j.o.pasteFromWord.enable||n!==s.INSERT_AS_HTML&&n!==s.INSERT_AS_TEXT)return super.insertFromWordByType(t,e,n,r);if(e=((t,e,n,r="")=>{var s,i;const a=document.createElement("iframe");a.style.display="none",document.body.appendChild(a);try{const l=null!==(s=a.contentDocument)&&void 0!==s?s:null===(i=a.contentWindow)||void 0===i?void 0:i.document;if(!l)return e;l.open(),l.write(e),l.close();const o="jd-style";for(let t=0;l.styleSheets.length>t;t+=1)try{const e=l.styleSheets[t].cssRules;for(let t=0;e.length>t;t+=1)e[t].selectorText&&(0,c.$$)(e[t].selectorText,l.body).forEach((n=>{(0,c.attr)(n,o)||((0,c.attr)(n,o,(0,c.attr)(n,"style")||""),(0,c.attr)(n,"style","")),(0,c.attr)(n,"style",`${(0,c.attr)(n,"style")};${e[t].style.cssText}`)}))}catch(t){}return(0,c.$$)(`[${o}]`,l.body).forEach((t=>{(0,c.attr)(t,"style",`${(0,c.attr)(t,"style")};${(0,c.attr)(t,o)}`)})),((t,e,n,r)=>{const s={jodit:t,rtf:r};return e.forEach((function t(e){if(e){for(const t of A)if(null==(e=t(e,s)))break;null==e||e.forEach(t)}})),n&&e.forEach((t=>{t.style.clear()}),!0),(0,R.f)(f(e,(t=>!t.isComment),!0,t.o.pasteFromWord.allowedStyleProps))})(t,C.make(l.body),n,r)}finally{p.i.safeRemove(a)}return e})(this.j,e,n===s.INSERT_AS_TEXT,r.rtf),this.j.o.beautifyHTML){const t=null===(a=this.j.events)||void 0===a?void 0:a.fire("beautifyHTML",e);(0,i.H)(t)&&(e=t)}(0,F.kU)(t,this.j,e)}}r.Jodit.plugins.remove("pasteFromWord"),r.Jodit.plugins.add("pasteFromWordPro",B)},70655(t,e,n){function r(t,e,n,r){var s,i=arguments.length,a=3>i?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(3>i?s(a):i>3?s(e,n,a):s(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}n.d(e,{gn:()=>r})}},t=>t(t.s=75293)])}));
|
|
1
|
+
"use strict";((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]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[92],{51424(t,e,n){n.r(e),n.d(e,{PasteFromWordPro:()=>I});var r=n(38219),s=n(11606),i=n(10728),a=n(33075);let l;function o(t){if("number"==typeof t)return t;if(/%$/.test(t))return 0;l||(l=document.createElement("div"),Object.assign(l.style,{position:"absolute",left:"-9999px",top:"-9999px",margin:"0",padding:"0",border:"0"}),document.body.append(l),setTimeout((()=>{null==l||l.remove(),l=null})));const e=0>parseFloat(t);e&&(t=t.replace("-","")),l.style.width=t;const n=l.clientWidth;return e?-n:n}function u(t){const{style:e}=t;let n=[0,0,0,0];const r=e.keys.filter((t=>/margin/.test(t))),s=Math.max(r.indexOf("margin-left"),r.indexOf("margin")),i=s>0?r[s]:"margin-left";let a;return"margin"===i?(n=(t=>{if(!t)return[0,0,0,0];const e=t.match(/(0|auto|(-?[.\d]+(?:\w+|%)))/g)||["0px"];switch(e.length){case 2:return[0,1,0,1].map((t=>e[t]));case 3:return[0,1,2,1].map((t=>e[t]));case 4:return[0,1,2,3].map((t=>e[t]));default:return[0,0,0,0].map((t=>e[t]))}})(e.get("margin")),a=n[3]||0):a=e.get(i)||0,o(a)}var c=n(91037),d=n(44370);function p(t,e=(()=>!0),n=!0,r){switch(!0){case t.isComment:case t.isText:{if(!e(t))return"";const{nodeValue:n}=t.attributes;return t.isComment?`\x3c!--${n}--\x3e`:n}case t.isElement:{const{attributes:s}=t,i=f(t,e,n,r);if(!t.attributes["jd-safe"]&&n&&0===i.replace(/[\n\t]/g,"").length&&!t.isSingle)return"";const a=Object.keys(s).map((t=>"style"===t||null==s[t]||/^jd-/.test(t)?"":`${t}="${m(s[t])}"`)).filter(Boolean),{str:l}=t.style,o=m(l((t=>h(t,r))));if(o&&a.push(`style="${o}"`),n&&0===a.length&&["span","a"].includes(t.name))return i;const u=a.length?" "+a.join(" "):"";return e(t)?t.isSingle?`<${t.name}${u}/>`:`<${t.name}${u}>${i}</${t.name}>`:i}}return""}function h(t,e){var n;if(!e)return!0;if(h.cache.has(e)){const r=null===(n=h.cache.get(e))||void 0===n?void 0:n.get(t);if((0,c.isBoolean)(r))return r}const r=e.some((e=>RegExp(e).test(t))),s=h.cache.get(e)||new Map;return s.set(t,r),h.cache.set(e,s),r}function f(t,e=(()=>!0),n=!0,r){let s=t.map((t=>p(t,e,n,r))).join("");return"p"===t.name&&0===(0,c.trim)(s).length&&(s=" "),s}function m(t){return(""+t).replace(/"/g,""")}h.cache=new WeakMap;const g="jd-list-level",b="jd-list-type",y="jd-list-style-type",v="list-style-type",E={"·":"disc",o:"circle","§":"square","[ivx]":"lower-roman","[IVX]":"upper-roman","[a-z]":"lower-alpha","[A-Z]":"upper-alpha","\\d":"decimal"};function x(t){return!(!t||"ol"!==t.name&&"ul"!==t.name)}function j(t){return!(!t||"li"!==t.name)}function k(t){return"li"!==t.name&&/mso-list:\s*l\d+ level\d+ lfo\d+/i.test(t.attributes.style)||/msolistparagraph/i.test(t.attributes.class)&&!!t.find((t=>t.isComment&&p(t).includes("supportLists"))).length}function w(t,e){return!(e.name!==t.attributes[b]||e.attributes[y]!==t.attributes[y]||t.attributes[g]!==e.attributes[g])}var T=n(70655),$=n(41257);let _=class{constructor(t){this._data=O(t)}get keys(){return Object.keys(this._data)}forEach(t){this.keys.forEach((e=>t(e)))}clear(){this._data={}}set(t,e){this._data[t]=e}get(t){var e;return null!==(e=this._data[t])&&void 0!==e?e:null}has(t){return void 0!==this._data[t]}add(t,e){return this._data=O(this.str()+";"+`${t}:${e}`),this}str(t=(t=>!0)){const e=Object.keys(this._data).filter((e=>e&&!/^mso-/.test(e)&&t(e)&&null!=this.get(e)));return e.length?e.map((t=>`${(0,c.kebabCase)(t)}:${this.get(t)}`)).join(";"):""}};function O(t){return(t=>{const e={},n=[];for(let r=t.length-1;r>=0;r-=1){const s=t[r][0];e[s]||(e[s]=!0,n.unshift(t[r]))}return n})((null!=t?t:"").replace(/"/g,'"').split(";").filter(Boolean).map((t=>(0,c.trim)(t).split(":").map(c.trim)))).reduce(((t,[e,n])=>(e&&n&&(t[e]=n),t)),{})}_=(0,T.gn)([$.autobind],_);const S=new Set(s.INSEPARABLE_TAGS);class C{constructor(t,e){this.parent=e,this.name=t.nodeName.toLowerCase(),this.type=t.nodeType,this.attributes=(t=>{const e={};if(d.i.isElement(t))for(let n=0,r=t.attributes;r.length>n;n+=1)e[r[n].name]=r[n].value;else e.nodeValue=t.nodeValue;return e})(t),this.style=new _(this.attributes.style),this.children=[],t.childNodes.forEach((t=>this.children.push(C.make(t,this))))}get isText(){return this.type===Node.TEXT_NODE}get isElement(){return this.type===Node.ELEMENT_NODE}get isComment(){return this.type===Node.COMMENT_NODE}get isSingle(){return S.has(this.name)}get length(){return this.children.length}static make(t,e=null){return new C(t,e)}wrap(t){var e;(0,c.assert)(null!=this.parent,"You can't wrap the root element");const n=C.make(document.createElement(t),this.parent),r=null!==(e=this.parent.children.indexOf(this))&&void 0!==e?e:-1;return-1===r?this.parent.append(n):this.parent.children[r]=n,n.append(this),n}append(t){return(0,c.assert)(t!==this,"Forbidden to add to yourself"),t.remove(),this.children.push(t),t.parent=this,this}get previousElement(){if(!this.parent)return null;const{children:t}=this.parent,e=t.indexOf(this);if(-1!==e)for(let n=e-1;n>=0;n-=1)if(t[n].isElement)return t[n];return null}get lastElement(){const{children:t}=this;for(let e=t.length-1;e>=0;e-=1)if(t[e].isElement)return t[e];return null}get previous(){var t,e,n;return null!==(n=null!==(t=this.sibling(!1))&&void 0!==t?t:null===(e=this.parent)||void 0===e?void 0:e.previous)&&void 0!==n?n:null}get next(){var t,e,n;return null!==(n=null!==(t=this.sibling(!0))&&void 0!==t?t:null===(e=this.parent)||void 0===e?void 0:e.next)&&void 0!==n?n:null}sibling(t){if(!this.parent)return null;const{children:e}=this.parent,n=e.indexOf(this);return-1!==n&&e[n+(t?1:-1)]?e[n+(t?1:-1)]:null}forEach(t,e=!1){const n=[...this.children];for(const r of n){if(!1===t(r))return!1;if(e&&!1===r.forEach(t,!0))return!1}}find(t,e=!0){const n=[];return this.forEach((e=>{t(e)&&n.push(e)}),e),n}map(t){return this.children.map(t)}remove(){var t,e;const n=null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this);return null!=n&&-1!==n&&(null===(e=this.parent)||void 0===e||e.children.splice(n,1)),this}textBetween(t,e){let n=!1;const r=[];return this.forEach((s=>{if(!n&&t(s)&&(n=!0),n&&s.isText&&r.push(p(s)),n&&e(s))return!1}),!0),r.join("")}}const M=["cellspacing","cellpadding","border","v:shapes","o:spid"],N=new Set(["o:p","xml","script","meta","link","v:imagedata","style"]),L={i:"em",b:"strong"};let P=0;var R=n(589);function W(t,e,n,r){const s=t.split(n);for(const t of s){const n=t.split("shplid");if(n.length>1){const t=n[1];let s="";for(let e=0;t.length>e&&!/[{ \r\n\\]/.test(t[e]);e++)s+=t[e];const i=t.split("bliptag");if(i&&2>i.length)continue;let a=null;if(i[0].indexOf("pngblip")?a="image/png":-1!==i[0].indexOf("jpegblip")&&(a="image/jpeg"),!a)continue;const l=i[1].split("}");if(l&&2>l.length)continue;let o;if(l.length>2&&l[0].includes("blipuid"))o=l[1].split(" ");else{if(o=l[0].split(" "),o&&2>o.length)continue;o.shift()}r[e+s]={hex:o.join(""),type:a}}}}const A={"text-justify":["inter-ideograph"]},F=[(t,e)=>{var n;if(e.rtf&&"#comment"===t.name&&t.attributes.nodeValue&&-1!==t.attributes.nodeValue.indexOf("<v:shape")){e.shapes||(e.shapes={});const n=e.jodit.create.fromHTML(t.attributes.nodeValue);return(0,c.toArray)(n.getElementsByTagName("v:shape")).forEach((t=>{e.shapes[t.id]=t.getAttribute("o:spid")})),t}if("img"!==t.name)return t;if(e.rtf&&t.attributes["v:shapes"]){const r=null===(n=e.shapes)||void 0===n?void 0:n[t.attributes["v:shapes"]];if(r){e.imageMap||(e.imageMap={},W(e.rtf,"i","\\shppict",e.imageMap),W(e.rtf,"s","\\shp{",e.imageMap));const n=e.imageMap[r.substring(7)];if(n){const e=[],r=n.hex.match(/[0-9a-f]{2}/gi);if(r){for(let t=0;r.length>t;t++)e.push(String.fromCharCode(parseInt(r[t],16)));t.attributes.src="data:"+n.type+";base64,"+btoa(e.join(""))}}}}return t},t=>((t.isElement&&"always"===t.style.get("page-break-before")||"page"===t.style.get("break-before"))&&(t.attributes["jd-safe"]=!0,t.style.add("page-break-before","always"),t.isSingle&&(t.name="div")),t),t=>"none"===t.style.get("display")||0===t.length&&"span"===t.name||N.has(t.name)?(t.remove(),null):t,t=>{const{name:e}=t;return e in L&&(t.name=L[e]),t},t=>{if(/^OLE_LINK\d+$/.test(t.attributes.name)&&(t.attributes.name=null,0===t.length))return t.remove(),null;"_GoBack"===t.attributes.name&&(t.attributes.name=null);for(const e of M)t.attributes[e]&&(t.attributes[e]=null);return t},t=>{var e;if(k(t)){t.name="li",t.style.set("text-indent",null);const n=(t=>t.textBetween((t=>t.isComment&&/\[if.*supportLists.*]/.test(p(t))),(t=>t.isComment&&/\[endif]/.test(p(t)))).replace(/ /g,"").replace((0,s.SPACE_REG_EXP)(),""))(t),r=/[\da-np-zA-NP-Z].?/.test(n)?"ol":"ul",i=((t,e)=>{for(const e in E)if(RegExp(e).test(t))return E[e];return"ol"===e?"decimal":"disc"})(n,r);t.attributes[b]=r,t.attributes[y]=i,(t=>{if(void 0!==t.attributes[g])return;const e=[u(t)],n=[t];let r=t.next;for(;r;){if(r.isElement&&!r.attributes[g]&&k(r)){const t=u(r);t&&(e.push(t),n.push(r))}r=r.next}const s=Math.min(...e.filter((t=>t>0)));let i=e.map((t=>Math.ceil(t/10)));-1!==i.indexOf(0)&&(i=i.map((t=>t+1))),n.forEach(((t,e)=>{t.attributes[g]=i[e],t.style.add("margin-left",Math.max(u(t)-10*i[e]/s*40,0)+"px")}))})(t),(t=>{for(;t;){const e=t.previousElement;if(!j(e)&&!x(e))break;if(j(e)){if(e.attributes[g]>t.attributes[g])break;if(t.attributes[g]===e.attributes[g]&&t.parent&&w(t,t.parent))break;e.append(t);continue}const n=e;if(n.attributes[g]>t.attributes[g])break;if(t.attributes[g]===n.attributes[g]&&!w(t,n))break;n.append(t)}})(t);const{parent:a}=t;if(!x(a)||!w(t,a)){const s=((t,e,n,r)=>{const s=t.wrap(e);return s.attributes.start=(t=>/\d.\d/.test(t)?t.split(".").pop()||null:/^\d/.test(t)?""+(parseInt(t,10)||1):null)(n),s.attributes[g]=t.attributes[g],s.attributes[y]=t.attributes[y],s.attributes["data-list-style-type"]=t.attributes[y],s.style.set(v,r),(t=>{var e;!x(t)||"li"===(null===(e=t.parent)||void 0===e?void 0:e.name)||"disc"!==t.style.get(v)&&"decimal"!==t.style.get(v)||t.style.set(v,null)})(s),s})(t,r,n,i);return x(a)&&(s.remove(),null===(e=a.lastElement)||void 0===e||e.append(s)),t}}return t},(t,e)=>{var n;const r=null!==(n=e.links)&&void 0!==n?n:{};if(t.attributes.href&&t.attributes.href.match(/#.+$/)&&(r[t.attributes.href.match(/#(.+)$/)[1]]=t),t.attributes.name&&r[t.attributes.name]){const e=r[t.attributes.name];e.attributes.href=e.attributes.href.replace(/.*#(.*)$/,"#$1")}return e.links=r,t},t=>(t.isComment&&/\[if.*(supportLists|gte vml).*]/.test(p(t))&&(P++,t.remove()),t.isComment&&P>0&&p(t).includes("[endif]")&&(P=P>0?P-1:0,t.remove()),P&&(t.isText||"img"===t.name&&(!t.attributes.src||/^file:/.test(t.attributes.src)))?(t.remove(),null):t),(t,{jodit:e})=>{if(!e.o.pasteFromWord.convertUnitsToPixel)return t;const{style:n}=t;return n.forEach((t=>{const e=n.get(t);e&&n.set(t,(""+e).replace(/\d+(\.\d+)?(pt|cm)/g,(t=>o(t)+"px")))})),t},t=>(t.attributes.class&&(t.attributes.class=t.attributes.class.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/gi,""),(0,R.f)(t.attributes.class)||(t.attributes.class=null)),t),t=>t.isElement?("img"===t.name&&(t.attributes.align&&(t.style.add("float",t.attributes.align),t.attributes.align=null),t.attributes.hspace&&(t.style.add("marginLeft",t.attributes.hspace+"px"),t.style.add("marginRight",t.attributes.hspace+"px"),t.attributes.hspace=null)),t):t,t=>(!t.attributes.width||"th"!==t.name&&"td"!==t.name||(t.attributes.width=null),t),t=>(t.isElement&&t.attributes.style&&Object.keys(A).forEach((e=>{const n=A[e];t.style.has(e)&&n.includes(""+t.style.get(e))&&t.style.set(e,null)})),t)];n(85119).D.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1,allowedStyleProps:["background","background-color","border","border-.*","color","float","font-family","font-size","font-style","font-weight","height","line-height","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","padding","text-align","text-justify","text-decoration","text-indent","vertical-align","width"]};var B=n(47036);class I extends a.L{insertFromWordByType(t,e,n,r){var a;if(!this.j.o.pasteFromWord.enable||n!==s.INSERT_AS_HTML&&n!==s.INSERT_AS_TEXT)return super.insertFromWordByType(t,e,n,r);if(e=((t,e,n,r="")=>{var s,i;const a=document.createElement("iframe");a.style.display="none",document.body.appendChild(a);try{const l=null!==(s=a.contentDocument)&&void 0!==s?s:null===(i=a.contentWindow)||void 0===i?void 0:i.document;if(!l)return e;l.open(),l.write(e),l.close();const o="jd-style";for(let t=0;l.styleSheets.length>t;t+=1)try{const e=l.styleSheets[t].cssRules;for(let t=0;e.length>t;t+=1)e[t].selectorText&&(0,c.$$)(e[t].selectorText,l.body).forEach((n=>{(0,c.attr)(n,o)||((0,c.attr)(n,o,(0,c.attr)(n,"style")||""),(0,c.attr)(n,"style","")),(0,c.attr)(n,"style",`${(0,c.attr)(n,"style")};${e[t].style.cssText}`)}))}catch(t){}return(0,c.$$)(`[${o}]`,l.body).forEach((t=>{(0,c.attr)(t,"style",`${(0,c.attr)(t,"style")};${(0,c.attr)(t,o)}`)})),((t,e,n,r)=>{const s={jodit:t,rtf:r};return e.forEach((function t(e){if(e){for(const t of F)if(null==(e=t(e,s)))break;null==e||e.forEach(t)}})),n&&e.forEach((t=>{t.style.clear()}),!0),(0,R.f)(f(e,(t=>!t.isComment),!0,t.o.pasteFromWord.allowedStyleProps))})(t,C.make(l.body),n,r)}finally{d.i.safeRemove(a)}return e})(this.j,e,n===s.INSERT_AS_TEXT,r.rtf),this.j.o.beautifyHTML){const t=null===(a=this.j.events)||void 0===a?void 0:a.fire("beautifyHTML",e);(0,i.H)(t)&&(e=t)}(0,B.kU)(t,this.j,e)}}r.Jodit.plugins.remove("pasteFromWord"),r.Jodit.plugins.add("pasteFromWordPro",I)},70655(t,e,n){function r(t,e,n,r){var s,i=arguments.length,a=3>i?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(3>i?s(a):i>3?s(e,n,a):s(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}n.d(e,{gn:()=>r})}},t=>t(t.s=51424)])}));
|