jodit-pro 1.2.54 → 1.2.56
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.css +1 -1
- package/build/jodit.es5.css +2 -2
- package/build/jodit.es5.js +1 -1
- package/build/jodit.fat.css +1 -1
- package/build/jodit.fat.es5.css +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],{847:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearAttributes=void 0;var n=r(1),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}},852:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearClassName=void 0;var n=r(212);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}},851:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.convertStyleUnitToPixels=void 0;var n=r(835);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}},840:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToList=void 0;var n=r(835),i=r(841),a=r(125),o=r(844);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",l=function(e){for(var t in o.listStyleMap)if(RegExp(t).test(e))return o.listStyleMap[t];return null}(r);e.attributes[o.TYPE_KEY]=a,e.attributes[o.STYLE_KEY]=l,(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 u=e.parent;if(!(0,i.isList)(u)||!(0,i.isSameType)(e,u)){var c=function(e,t,r,a){var s=e.wrap(t);return s.attributes.start=(0,n.calcStartBySymbol)(r),s.attributes[o.LEVEL_KEY]=e.attributes[o.LEVEL_KEY],s.attributes[o.STYLE_KEY]=e.attributes[o.STYLE_KEY],s.style.set(o.STYLE_CSS_KEY,a),function(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)}(s),s}(e,a,r,l);return(0,i.isList)(u)&&(c.remove(),null===(t=u.lastElement)||void 0===t||t.append(c)),e}}return e};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)(),"")}},839:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.cases=void 0;var n=r(840),i=r(847),a=r(848),o=r(849),s=r(850),l=r(851),u=r(852),c=r(853),f=r(854),p=r(855),d=r(856),m=r(857);t.cases=[m.processImage,d.markPageBreakElements,a.removeExtraTags,o.replaceOldTags,i.clearAttributes,n.convertToList,c.processLinks,s.removeInsideComment,l.convertStyleUnitToPixels,u.clearClassName,f.normalizeImageProps,p.removeWidthFromTableCell]},856: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}},854: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}},857:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.processImage=void 0;var n=r(1),i=r(136);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],p="",d=0;f.length>d&&!/[{ \r\n\\]/.test(f[d]);d++)p+=f[d];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+p]={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}},853: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}},848: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}},850:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.removeInsideComment=void 0;var n=r(841),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}},849: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}},855: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}},859:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),r(124).Config.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1}},844:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.listStyleMap=t.STYLE_CSS_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_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"}},842:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.isSameType=t.isPseudoLeaf=t.isLeaf=t.isList=void 0;var n=r(843),i=r(844);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])}},845:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.JElement=void 0;var n=r(1),i=r(150),a=r(125),o=r(136),s=r(843),l=r(846),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,"html",{get:function(){return(0,s.html)(this)},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},841:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);n.__exportStar(r(842),t),n.__exportStar(r(845),t),n.__exportStar(r(843),t)},843:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.innerHTML=t.html=void 0;var n=r(136);function i(e,t,r){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 n=e.attributes.nodeValue;return e.isComment?"\x3c!--".concat(n,"--\x3e"):n;case e.isElement:var i=e.attributes,s=a(e,t,r);if(!e.attributes["jd-safe"]&&r&&0===s.replace(/[\n\t]/g,"").length&&!e.isSingle)return"";var l=Object.keys(i).map((function(e){return"style"===e||null==i[e]||/^jd-/.test(e)?"":"".concat(e,'="').concat(o(i[e]),'"')})).filter(Boolean),u=e.style.str;if(u&&l.push('style="'.concat(o(u),'"')),r&&0===l.length&&["span","a"].includes(e.name))return s;var c=l.length?" "+l.join(" "):"";return t(e)?e.isSingle?"<".concat(e.name).concat(c,"/>"):"<".concat(e.name).concat(c,">").concat(s,"</").concat(e.name,">"):s}return""}function a(e,t,r){void 0===t&&(t=function(){return!0}),void 0===r&&(r=!0);var a=e.map((function(e){return i(e,t,r)})).join("");return"p"===e.name&&0===(0,n.trim)(a).length&&(a=" "),a}function o(e){return e.toString().replace(/"/g,""")}t.html=i,t.innerHTML=a},846:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Style=void 0;var n=r(1),i=r(136),a=function(){function e(e){this._data=o(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=o(this.str+";"+"".concat(e,":").concat(t)),this},Object.defineProperty(e.prototype,"str",{get:function(){var e=this,t=Object.keys(this._data).filter((function(t){return t&&!/^mso-/.test(t)&&null!=e.get(t)}));return t.length?t.map((function(t){return"".concat((0,i.kebabCase)(t),":").concat(e.get(t))})).join(";"):""},enumerable:!1,configurable:!0}),e}();function o(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=a},837:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.applyStylesPro=void 0;var n=r(136),i=r(150),a=r(838),o=r(841);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 p="jd-style",d=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,p)||((0,n.attr)(r,p,(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)d(m);return(0,n.$$)("[".concat(p,"]"),f.body).forEach((function(e){(0,n.attr)(e,"style","".concat((0,n.attr)(e,"style"),";").concat((0,n.attr)(e,p)))})),(0,a.transformWordToHtml)(e,o.JElement.make(f.body),r,s)}finally{i.Dom.safeRemove(c)}return t}},858:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.calcListLevels=void 0;var n=r(1),i=r(841),a=r(844),o=r(836);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"))}))}}},836: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}},835:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);n.__exportStar(r(836),t),n.__exportStar(r(837),t),n.__exportStar(r(838),t),n.__exportStar(r(858),t)},838:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.transformWordToHtml=void 0;var n=r(1),i=r(839),a=r(212),o=r(841);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})))}},834:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.PasteFromWordPro=void 0;var n=r(1),i=r(2),a=r(434),o=r(125),s=r(130),l=r(431),u=r(835);r(859);var 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 a;if(!this.j.o.pasteFromWord.enable||n!==o.INSERT_AS_HTML&&n!==o.INSERT_AS_TEXT)return e.prototype.insertFromWordByType.call(this,t,r,n,i);if(r=(0,u.applyStylesPro)(this.j,r,n===o.INSERT_AS_TEXT,i.rtf),this.j.o.beautifyHTML){var c=null===(a=this.j.events)||void 0===a?void 0:a.fire("beautifyHTML",r);(0,s.isString)(c)&&(r=c)}(0,l.pasteInsertHtml)(t,this.j,r)},t}(a.PasteFromWord);t.PasteFromWordPro=c,i.Jodit.plugins.remove("pasteFromWord"),i.Jodit.plugins.add("pasteFromWordPro",c)}},function(e){return e(e.s=834)}])}));
|
|
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],{847:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearAttributes=void 0;var n=r(1),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}},852:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.clearClassName=void 0;var n=r(212);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}},851:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.convertStyleUnitToPixels=void 0;var n=r(835);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}},840:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.removeRedundancyStyle=t.convertToList=void 0;var n=r(835),i=r(841),a=r(125),o=r(844);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)(),"")}},839:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.cases=void 0;var n=r(840),i=r(847),a=r(848),o=r(849),s=r(850),l=r(851),u=r(852),c=r(853),f=r(854),p=r(855),d=r(856),m=r(857);t.cases=[m.processImage,d.markPageBreakElements,a.removeExtraTags,o.replaceOldTags,i.clearAttributes,n.convertToList,c.processLinks,s.removeInsideComment,l.convertStyleUnitToPixels,u.clearClassName,f.normalizeImageProps,p.removeWidthFromTableCell]},856: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}},854: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}},857:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.processImage=void 0;var n=r(1),i=r(136);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],p="",d=0;f.length>d&&!/[{ \r\n\\]/.test(f[d]);d++)p+=f[d];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+p]={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}},853: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}},848: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}},850:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.removeInsideComment=void 0;var n=r(841),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}},849: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}},855: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}},859:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),r(124).Config.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1}},844: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"}},842:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.isSameType=t.isPseudoLeaf=t.isLeaf=t.isList=void 0;var n=r(843),i=r(844);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])}},845:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.JElement=void 0;var n=r(1),i=r(150),a=r(125),o=r(136),s=r(843),l=r(846),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,"html",{get:function(){return(0,s.html)(this)},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},841:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);n.__exportStar(r(842),t),n.__exportStar(r(845),t),n.__exportStar(r(843),t)},843:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.innerHTML=t.html=void 0;var n=r(136);function i(e,t,r){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 n=e.attributes.nodeValue;return e.isComment?"\x3c!--".concat(n,"--\x3e"):n;case e.isElement:var i=e.attributes,s=a(e,t,r);if(!e.attributes["jd-safe"]&&r&&0===s.replace(/[\n\t]/g,"").length&&!e.isSingle)return"";var l=Object.keys(i).map((function(e){return"style"===e||null==i[e]||/^jd-/.test(e)?"":"".concat(e,'="').concat(o(i[e]),'"')})).filter(Boolean),u=e.style.str;if(u&&l.push('style="'.concat(o(u),'"')),r&&0===l.length&&["span","a"].includes(e.name))return s;var c=l.length?" "+l.join(" "):"";return t(e)?e.isSingle?"<".concat(e.name).concat(c,"/>"):"<".concat(e.name).concat(c,">").concat(s,"</").concat(e.name,">"):s}return""}function a(e,t,r){void 0===t&&(t=function(){return!0}),void 0===r&&(r=!0);var a=e.map((function(e){return i(e,t,r)})).join("");return"p"===e.name&&0===(0,n.trim)(a).length&&(a=" "),a}function o(e){return e.toString().replace(/"/g,""")}t.html=i,t.innerHTML=a},846:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Style=void 0;var n=r(1),i=r(136),a=function(){function e(e){this._data=o(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=o(this.str+";"+"".concat(e,":").concat(t)),this},Object.defineProperty(e.prototype,"str",{get:function(){var e=this,t=Object.keys(this._data).filter((function(t){return t&&!/^mso-/.test(t)&&null!=e.get(t)}));return t.length?t.map((function(t){return"".concat((0,i.kebabCase)(t),":").concat(e.get(t))})).join(";"):""},enumerable:!1,configurable:!0}),e}();function o(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=a},837:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.applyStylesPro=void 0;var n=r(136),i=r(150),a=r(838),o=r(841);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 p="jd-style",d=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,p)||((0,n.attr)(r,p,(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)d(m);return(0,n.$$)("[".concat(p,"]"),f.body).forEach((function(e){(0,n.attr)(e,"style","".concat((0,n.attr)(e,"style"),";").concat((0,n.attr)(e,p)))})),(0,a.transformWordToHtml)(e,o.JElement.make(f.body),r,s)}finally{i.Dom.safeRemove(c)}return t}},858:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.calcListLevels=void 0;var n=r(1),i=r(841),a=r(844),o=r(836);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"))}))}}},836: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}},835:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);n.__exportStar(r(836),t),n.__exportStar(r(837),t),n.__exportStar(r(838),t),n.__exportStar(r(858),t)},838:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.transformWordToHtml=void 0;var n=r(1),i=r(839),a=r(212),o=r(841);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})))}},834:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.PasteFromWordPro=void 0;var n=r(1),i=r(2),a=r(434),o=r(125),s=r(130),l=r(431),u=r(835);r(859);var 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 a;if(!this.j.o.pasteFromWord.enable||n!==o.INSERT_AS_HTML&&n!==o.INSERT_AS_TEXT)return e.prototype.insertFromWordByType.call(this,t,r,n,i);if(r=(0,u.applyStylesPro)(this.j,r,n===o.INSERT_AS_TEXT,i.rtf),this.j.o.beautifyHTML){var c=null===(a=this.j.events)||void 0===a?void 0:a.fire("beautifyHTML",r);(0,s.isString)(c)&&(r=c)}(0,l.pasteInsertHtml)(t,this.j,r)},t}(a.PasteFromWord);t.PasteFromWordPro=c,i.Jodit.plugins.remove("pasteFromWord"),i.Jodit.plugins.add("pasteFromWordPro",c)}},function(e){return e(e.s=834)}])}));
|
|
@@ -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 s in n)("object"==typeof exports?exports:t)[s]=n[s]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[92],{273(t,e,n){n.r(e),n.d(e,{PasteFromWordPro:()=>F});var s=n(1),r=n(103),i=n(3),a=n(7),l=n(102);let o;function u(t){if("number"==typeof t)return t;if(/%$/.test(t))return 0;o||(o=document.createElement("div"),Object.assign(o.style,{position:"absolute",left:"-9999px",top:"-9999px",margin:"0",padding:"0",border:"0"}),document.body.append(o),setTimeout((()=>{null==o||o.remove(),o=null})));const e=0>parseFloat(t);e&&(t=t.replace("-","")),o.style.width=t;const n=o.clientWidth;return e?-n:n}function c(t){const{style:e}=t;let n=[0,0,0,0];const s=e.keys.filter((t=>/margin/.test(t))),r=Math.max(s.indexOf("margin-left"),s.indexOf("margin")),i=r>0?s[r]:"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,u(a)}var p=n(11),d=n(18);function h(t,e=(()=>!0),n=!0){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,r=f(t,e,n);if(!t.attributes["jd-safe"]&&n&&0===r.replace(/[\n\t]/g,"").length&&!t.isSingle)return"";const i=Object.keys(s).map((t=>"style"===t||null==s[t]||/^jd-/.test(t)?"":`${t}="${m(s[t])}"`)).filter(Boolean),{str:a}=t.style;if(a&&i.push(`style="${m(a)}"`),n&&0===i.length&&["span","a"].includes(t.name))return r;const l=i.length?" "+i.join(" "):"";return e(t)?t.isSingle?`<${t.name}${l}/>`:`<${t.name}${l}>${r}</${t.name}>`:r}}return""}function f(t,e=(()=>!0),n=!0){let s=t.map((t=>h(t,e,n))).join("");return"p"===t.name&&0===(0,p.trim)(s).length&&(s=" "),s}function m(t){return(""+t).replace(/"/g,""")}const b="jd-list-level",g="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 T(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&&h(t).includes("supportLists"))).length}function k(t,e){return!(e.name!==t.attributes[g]||e.attributes[y]!==t.attributes[y]||t.attributes[b]!==e.attributes[b])}class ${constructor(t){this._data=w(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=w(this.str+";"+`${t}:${e}`),this}get str(){const t=Object.keys(this._data).filter((t=>t&&!/^mso-/.test(t)&&null!=this.get(t)));return t.length?t.map((t=>`${(0,p.kebabCase)(t)}:${this.get(t)}`)).join(";"):""}}function w(t){return(t=>{const e={},n=[];for(let s=t.length-1;s>=0;s-=1){const r=t[s][0];e[r]||(e[r]=!0,n.unshift(t[s]))}return n})((null!=t?t:"").replace(/"/g,'"').split(";").filter(Boolean).map((t=>(0,p.trim)(t).split(":").map(p.trim)))).reduce(((t,[e,n])=>(e&&n&&(t[e]=n),t)),{})}const _=new Set(i.INSEPARABLE_TAGS);class O{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,s=t.attributes;s.length>n;n+=1)e[s[n].name]=s[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(O.make(t,this))))}get isText(){return this.type===Node.TEXT_NODE}get html(){return h(this)}get isElement(){return this.type===Node.ELEMENT_NODE}get isComment(){return this.type===Node.COMMENT_NODE}get isSingle(){return _.has(this.name)}get length(){return this.children.length}static make(t,e=null){return new O(t,e)}wrap(t){var e;(0,p.assert)(null!=this.parent,"You can't wrap the root element");const n=O.make(document.createElement(t),this.parent),s=null!==(e=this.parent.children.indexOf(this))&&void 0!==e?e:-1;return-1===s?this.parent.append(n):this.parent.children[s]=n,n.append(this),n}append(t){return(0,p.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 s of n){if(!1===t(s))return!1;if(e&&!1===s.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 s=[];return this.forEach((r=>{if(!n&&t(r)&&(n=!0),n&&r.isText&&s.push(h(r)),n&&e(r))return!1}),!0),s.join("")}}const C=["cellspacing","cellpadding","border","v:shapes","o:spid"],S=new Set(["o:p","xml","script","meta","link","v:imagedata","style"]),N={i:"em",b:"strong"};let M=0;var L=n(39);function A(t,e,n,s){const r=t.split(n);for(const t of r){const n=t.split("shplid");if(n.length>1){const t=n[1];let r="";for(let e=0;t.length>e&&!/[{ \r\n\\]/.test(t[e]);e++)r+=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()}s[e+r]={hex:o.join(""),type:a}}}}const B=[(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,p.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 s=null===(n=e.shapes)||void 0===n?void 0:n[t.attributes["v:shapes"]];if(s){e.imageMap||(e.imageMap={},A(e.rtf,"i","\\shppict",e.imageMap),A(e.rtf,"s","\\shp{",e.imageMap));const n=e.imageMap[s.substring(7)];if(n){const e=[],s=n.hex.match(/[0-9a-f]{2}/gi);if(s){for(let t=0;s.length>t;t++)e.push(String.fromCharCode(parseInt(s[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||S.has(t.name)?(t.remove(),null):t,t=>{const{name:e}=t;return e in N&&(t.name=N[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 C)t.attributes[e]&&(t.attributes[e]=null);return t},t=>{var e;if(T(t)){t.name="li",t.style.set("text-indent",null);const n=(t=>t.textBetween((t=>t.isComment&&/\[if.*supportLists.*]/.test(h(t))),(t=>t.isComment&&/\[endif]/.test(h(t)))).replace(/ /g,"").replace((0,i.SPACE_REG_EXP)(),""))(t),s=/[\da-np-zA-NP-Z].?/.test(n)?"ol":"ul",r=(t=>{for(const e in E)if(RegExp(e).test(t))return E[e];return null})(n);t.attributes[g]=s,t.attributes[y]=r,(t=>{if(void 0!==t.attributes[b])return;const e=[c(t)],n=[t];let s=t.next;for(;s;){if(s.isElement&&!s.attributes[b]&&T(s)){const t=c(s);t&&(e.push(t),n.push(s))}s=s.next}const r=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[b]=i[e],t.style.add("margin-left",Math.max(c(t)-10*i[e]/r*40,0)+"px")}))})(t),(t=>{for(;t;){const e=t.previousElement;if(!j(e)&&!x(e))break;if(j(e)){if(e.attributes[b]>t.attributes[b])break;if(t.attributes[b]===e.attributes[b]&&t.parent&&k(t,t.parent))break;e.append(t);continue}const n=e;if(n.attributes[b]>t.attributes[b])break;if(t.attributes[b]===n.attributes[b]&&!k(t,n))break;n.append(t)}})(t);const{parent:a}=t;if(!x(a)||!k(t,a)){const i=((t,e,n,s)=>{const r=t.wrap(e);return r.attributes.start=(t=>/\d.\d/.test(t)?t.split(".").pop()||null:/^\d/.test(t)?""+(parseInt(t,10)||1):null)(n),r.attributes[b]=t.attributes[b],r.attributes[y]=t.attributes[y],r.style.set(v,s),(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)})(r),r})(t,s,n,r);return x(a)&&(i.remove(),null===(e=a.lastElement)||void 0===e||e.append(i)),t}}return t},(t,e)=>{var n;const s=null!==(n=e.links)&&void 0!==n?n:{};if(t.attributes.href&&t.attributes.href.match(/#.+$/)&&(s[t.attributes.href.match(/#(.+)$/)[1]]=t),t.attributes.name&&s[t.attributes.name]){const e=s[t.attributes.name];e.attributes.href=e.attributes.href.replace(/.*#(.*)$/,"#$1")}return e.links=s,t},t=>(t.isComment&&/\[if.*(supportLists|gte vml).*]/.test(h(t))&&(M++,t.remove()),t.isComment&&M>0&&h(t).includes("[endif]")&&(M=M>0?M-1:0,t.remove()),M&&(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=>u(t)+"px")))})),t},t=>(t.attributes.class&&(t.attributes.class=t.attributes.class.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/gi,""),(0,L.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(2).D.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1};class F extends r.B{insertFromWordByType(t,e,n,s){var r;if(!this.j.o.pasteFromWord.enable||n!==i.INSERT_AS_HTML&&n!==i.INSERT_AS_TEXT)return super.insertFromWordByType(t,e,n,s);if(e=((t,e,n,s="")=>{var r,i;const a=document.createElement("iframe");a.style.display="none",document.body.appendChild(a);try{const l=null!==(r=a.contentDocument)&&void 0!==r?r: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,p.$$)(e[t].selectorText,l.body).forEach((n=>{(0,p.attr)(n,o)||((0,p.attr)(n,o,(0,p.attr)(n,"style")||""),(0,p.attr)(n,"style","")),(0,p.attr)(n,"style",`${(0,p.attr)(n,"style")};${e[t].style.cssText}`)}))}catch(t){}return(0,p.$$)(`[${o}]`,l.body).forEach((t=>{(0,p.attr)(t,"style",`${(0,p.attr)(t,"style")};${(0,p.attr)(t,o)}`)})),((t,e,n,s)=>{const r={jodit:t,rtf:s};return e.forEach((function t(e){if(e){for(const t of B)if(null==(e=t(e,r)))break;null==e||e.forEach(t)}})),n&&e.forEach((t=>{t.style.clear()}),!0),(0,L.f)(f(e,(t=>!t.isComment)))})(t,O.make(l.body),n,s)}finally{d.i.safeRemove(a)}return e})(this.j,e,n===i.INSERT_AS_TEXT,s.rtf),this.j.o.beautifyHTML){const t=null===(r=this.j.events)||void 0===r?void 0:r.fire("beautifyHTML",e);(0,a.H)(t)&&(e=t)}(0,l.kU)(t,this.j,e)}}s.Jodit.plugins.remove("pasteFromWord"),s.Jodit.plugins.add("pasteFromWordPro",F)}},t=>t(t.s=273)])}));
|
|
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 s=e();for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[92],{273(t,e,s){s.r(e),s.d(e,{PasteFromWordPro:()=>F});var n=s(1),r=s(103),i=s(3),a=s(7),l=s(102);let o;function u(t){if("number"==typeof t)return t;if(/%$/.test(t))return 0;o||(o=document.createElement("div"),Object.assign(o.style,{position:"absolute",left:"-9999px",top:"-9999px",margin:"0",padding:"0",border:"0"}),document.body.append(o),setTimeout((()=>{null==o||o.remove(),o=null})));const e=0>parseFloat(t);e&&(t=t.replace("-","")),o.style.width=t;const s=o.clientWidth;return e?-s:s}function c(t){const{style:e}=t;let s=[0,0,0,0];const n=e.keys.filter((t=>/margin/.test(t))),r=Math.max(n.indexOf("margin-left"),n.indexOf("margin")),i=r>0?n[r]:"margin-left";let a;return"margin"===i?(s=(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=s[3]||0):a=e.get(i)||0,u(a)}var p=s(11),d=s(18);function h(t,e=(()=>!0),s=!0){switch(!0){case t.isComment:case t.isText:{if(!e(t))return"";const{nodeValue:s}=t.attributes;return t.isComment?`\x3c!--${s}--\x3e`:s}case t.isElement:{const{attributes:n}=t,r=m(t,e,s);if(!t.attributes["jd-safe"]&&s&&0===r.replace(/[\n\t]/g,"").length&&!t.isSingle)return"";const i=Object.keys(n).map((t=>"style"===t||null==n[t]||/^jd-/.test(t)?"":`${t}="${f(n[t])}"`)).filter(Boolean),{str:a}=t.style;if(a&&i.push(`style="${f(a)}"`),s&&0===i.length&&["span","a"].includes(t.name))return r;const l=i.length?" "+i.join(" "):"";return e(t)?t.isSingle?`<${t.name}${l}/>`:`<${t.name}${l}>${r}</${t.name}>`:r}}return""}function m(t,e=(()=>!0),s=!0){let n=t.map((t=>h(t,e,s))).join("");return"p"===t.name&&0===(0,p.trim)(n).length&&(n=" "),n}function f(t){return(""+t).replace(/"/g,""")}const b="jd-list-level",g="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 T(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&&h(t).includes("supportLists"))).length}function k(t,e){return!(e.name!==t.attributes[g]||e.attributes[y]!==t.attributes[y]||t.attributes[b]!==e.attributes[b])}class ${constructor(t){this._data=w(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=w(this.str+";"+`${t}:${e}`),this}get str(){const t=Object.keys(this._data).filter((t=>t&&!/^mso-/.test(t)&&null!=this.get(t)));return t.length?t.map((t=>`${(0,p.kebabCase)(t)}:${this.get(t)}`)).join(";"):""}}function w(t){return(t=>{const e={},s=[];for(let n=t.length-1;n>=0;n-=1){const r=t[n][0];e[r]||(e[r]=!0,s.unshift(t[n]))}return s})((null!=t?t:"").replace(/"/g,'"').split(";").filter(Boolean).map((t=>(0,p.trim)(t).split(":").map(p.trim)))).reduce(((t,[e,s])=>(e&&s&&(t[e]=s),t)),{})}const _=new Set(i.INSEPARABLE_TAGS);class O{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 s=0,n=t.attributes;n.length>s;s+=1)e[n[s].name]=n[s].value;else e.nodeValue=t.nodeValue;return e})(t),this.style=new $(this.attributes.style),this.children=[],t.childNodes.forEach((t=>this.children.push(O.make(t,this))))}get isText(){return this.type===Node.TEXT_NODE}get html(){return h(this)}get isElement(){return this.type===Node.ELEMENT_NODE}get isComment(){return this.type===Node.COMMENT_NODE}get isSingle(){return _.has(this.name)}get length(){return this.children.length}static make(t,e=null){return new O(t,e)}wrap(t){var e;(0,p.assert)(null!=this.parent,"You can't wrap the root element");const s=O.make(document.createElement(t),this.parent),n=null!==(e=this.parent.children.indexOf(this))&&void 0!==e?e:-1;return-1===n?this.parent.append(s):this.parent.children[n]=s,s.append(this),s}append(t){return(0,p.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 s=e-1;s>=0;s-=1)if(t[s].isElement)return t[s];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,s;return null!==(s=null!==(t=this.sibling(!1))&&void 0!==t?t:null===(e=this.parent)||void 0===e?void 0:e.previous)&&void 0!==s?s:null}get next(){var t,e,s;return null!==(s=null!==(t=this.sibling(!0))&&void 0!==t?t:null===(e=this.parent)||void 0===e?void 0:e.next)&&void 0!==s?s:null}sibling(t){if(!this.parent)return null;const{children:e}=this.parent,s=e.indexOf(this);return-1!==s&&e[s+(t?1:-1)]?e[s+(t?1:-1)]:null}forEach(t,e=!1){const s=[...this.children];for(const n of s){if(!1===t(n))return!1;if(e&&!1===n.forEach(t,!0))return!1}}find(t,e=!0){const s=[];return this.forEach((e=>{t(e)&&s.push(e)}),e),s}map(t){return this.children.map(t)}remove(){var t,e;const s=null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this);return null!=s&&-1!==s&&(null===(e=this.parent)||void 0===e||e.children.splice(s,1)),this}textBetween(t,e){let s=!1;const n=[];return this.forEach((r=>{if(!s&&t(r)&&(s=!0),s&&r.isText&&n.push(h(r)),s&&e(r))return!1}),!0),n.join("")}}const C=["cellspacing","cellpadding","border","v:shapes","o:spid"],S=new Set(["o:p","xml","script","meta","link","v:imagedata","style"]),N={i:"em",b:"strong"};let M=0;var L=s(39);function A(t,e,s,n){const r=t.split(s);for(const t of r){const s=t.split("shplid");if(s.length>1){const t=s[1];let r="";for(let e=0;t.length>e&&!/[{ \r\n\\]/.test(t[e]);e++)r+=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()}n[e+r]={hex:o.join(""),type:a}}}}const B=[(t,e)=>{var s;if(e.rtf&&"#comment"===t.name&&t.attributes.nodeValue&&-1!==t.attributes.nodeValue.indexOf("<v:shape")){e.shapes||(e.shapes={});const s=e.jodit.create.fromHTML(t.attributes.nodeValue);return(0,p.toArray)(s.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 n=null===(s=e.shapes)||void 0===s?void 0:s[t.attributes["v:shapes"]];if(n){e.imageMap||(e.imageMap={},A(e.rtf,"i","\\shppict",e.imageMap),A(e.rtf,"s","\\shp{",e.imageMap));const s=e.imageMap[n.substring(7)];if(s){const e=[],n=s.hex.match(/[0-9a-f]{2}/gi);if(n){for(let t=0;n.length>t;t++)e.push(String.fromCharCode(parseInt(n[t],16)));t.attributes.src="data:"+s.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||S.has(t.name)?(t.remove(),null):t,t=>{const{name:e}=t;return e in N&&(t.name=N[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 C)t.attributes[e]&&(t.attributes[e]=null);return t},t=>{var e;if(T(t)){t.name="li",t.style.set("text-indent",null);const s=(t=>t.textBetween((t=>t.isComment&&/\[if.*supportLists.*]/.test(h(t))),(t=>t.isComment&&/\[endif]/.test(h(t)))).replace(/ /g,"").replace((0,i.SPACE_REG_EXP)(),""))(t),n=/[\da-np-zA-NP-Z].?/.test(s)?"ol":"ul",r=((t,e)=>{for(const e in E)if(RegExp(e).test(t))return E[e];return"ol"===e?"decimal":"disc"})(s,n);t.attributes[g]=n,t.attributes[y]=r,(t=>{if(void 0!==t.attributes[b])return;const e=[c(t)],s=[t];let n=t.next;for(;n;){if(n.isElement&&!n.attributes[b]&&T(n)){const t=c(n);t&&(e.push(t),s.push(n))}n=n.next}const r=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))),s.forEach(((t,e)=>{t.attributes[b]=i[e],t.style.add("margin-left",Math.max(c(t)-10*i[e]/r*40,0)+"px")}))})(t),(t=>{for(;t;){const e=t.previousElement;if(!j(e)&&!x(e))break;if(j(e)){if(e.attributes[b]>t.attributes[b])break;if(t.attributes[b]===e.attributes[b]&&t.parent&&k(t,t.parent))break;e.append(t);continue}const s=e;if(s.attributes[b]>t.attributes[b])break;if(t.attributes[b]===s.attributes[b]&&!k(t,s))break;s.append(t)}})(t);const{parent:a}=t;if(!x(a)||!k(t,a)){const i=((t,e,s,n)=>{const r=t.wrap(e);return r.attributes.start=(t=>/\d.\d/.test(t)?t.split(".").pop()||null:/^\d/.test(t)?""+(parseInt(t,10)||1):null)(s),r.attributes[b]=t.attributes[b],r.attributes[y]=t.attributes[y],r.attributes["data-list-style-type"]=t.attributes[y],r.style.set(v,n),(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)})(r),r})(t,n,s,r);return x(a)&&(i.remove(),null===(e=a.lastElement)||void 0===e||e.append(i)),t}}return t},(t,e)=>{var s;const n=null!==(s=e.links)&&void 0!==s?s:{};if(t.attributes.href&&t.attributes.href.match(/#.+$/)&&(n[t.attributes.href.match(/#(.+)$/)[1]]=t),t.attributes.name&&n[t.attributes.name]){const e=n[t.attributes.name];e.attributes.href=e.attributes.href.replace(/.*#(.*)$/,"#$1")}return e.links=n,t},t=>(t.isComment&&/\[if.*(supportLists|gte vml).*]/.test(h(t))&&(M++,t.remove()),t.isComment&&M>0&&h(t).includes("[endif]")&&(M=M>0?M-1:0,t.remove()),M&&(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:s}=t;return s.forEach((t=>{const e=s.get(t);e&&s.set(t,(""+e).replace(/\d+(\.\d+)?(pt|cm)/g,(t=>u(t)+"px")))})),t},t=>(t.attributes.class&&(t.attributes.class=t.attributes.class.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/gi,""),(0,L.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)];s(2).D.prototype.pasteFromWord={enable:!1,convertUnitsToPixel:!1};class F extends r.B{insertFromWordByType(t,e,s,n){var r;if(!this.j.o.pasteFromWord.enable||s!==i.INSERT_AS_HTML&&s!==i.INSERT_AS_TEXT)return super.insertFromWordByType(t,e,s,n);if(e=((t,e,s,n="")=>{var r,i;const a=document.createElement("iframe");a.style.display="none",document.body.appendChild(a);try{const l=null!==(r=a.contentDocument)&&void 0!==r?r: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,p.$$)(e[t].selectorText,l.body).forEach((s=>{(0,p.attr)(s,o)||((0,p.attr)(s,o,(0,p.attr)(s,"style")||""),(0,p.attr)(s,"style","")),(0,p.attr)(s,"style",`${(0,p.attr)(s,"style")};${e[t].style.cssText}`)}))}catch(t){}return(0,p.$$)(`[${o}]`,l.body).forEach((t=>{(0,p.attr)(t,"style",`${(0,p.attr)(t,"style")};${(0,p.attr)(t,o)}`)})),((t,e,s,n)=>{const r={jodit:t,rtf:n};return e.forEach((function t(e){if(e){for(const t of B)if(null==(e=t(e,r)))break;null==e||e.forEach(t)}})),s&&e.forEach((t=>{t.style.clear()}),!0),(0,L.f)(m(e,(t=>!t.isComment)))})(t,O.make(l.body),s,n)}finally{d.i.safeRemove(a)}return e})(this.j,e,s===i.INSERT_AS_TEXT,n.rtf),this.j.o.beautifyHTML){const t=null===(r=this.j.events)||void 0===r?void 0:r.fire("beautifyHTML",e);(0,a.H)(t)&&(e=t)}(0,l.kU)(t,this.j,e)}}n.Jodit.plugins.remove("pasteFromWord"),n.Jodit.plugins.add("pasteFromWordPro",F)}},t=>t(t.s=273)])}));
|