jodit-pro
Version:
PRO Version of Jodit Editor
8 lines • 6.36 kB
JavaScript
/*!
* jodit-pro - PRO Version of Jodit Editor
* Author: Chupurnov Valerii <chupurnov@gmail.com>
* Version: v4.9.27
* Url: https://xdsoft.net/jodit/pro/
* License(s): SEE LICENSE IN LICENSE.md
*/
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[850],{5440:function(t,e,n){"use strict";n.d(e,{buildStylePopup:function(){return s}});var r=n(31105),o=n(8060),i=n(69341),l="jodit-style-popup";function s(t,e,n){var s=(0,o.classifyDefinitions)(e),c=(0,i.detectActiveStyle)(t,e),a=t.c.div(l),u=!0,f=!1,d=void 0;try{for(var v,y=s[Symbol.iterator]();!(u=(v=y.next()).done);u=!0){var p=v.value,m=t.c.div("".concat(l,"__group-title"));m.textContent=t.i18n(p.title),a.appendChild(m);var h=t.c.div("".concat(l,"__grid")),x=!0,S=!1,_=void 0;try{for(var g,b=p.definitions[Symbol.iterator]();!(x=(g=b.next()).done);x=!0)!function(){var o=g.value,i=t.c.element("button");i.type="button";var s=c===o;i.className="".concat(l,"__card")+(s?" ".concat(l,"__card_active_true"):"");var a=t.c.div("".concat(l,"__card-preview")),u=t.c.element(o.element),f=!0,d=!1,v=void 0;try{for(var y,p=o.classes[Symbol.iterator]();!(f=(y=p.next()).done);f=!0){var m=y.value;u.classList.add(m)}}catch(t){d=!0,v=t}finally{try{f||null==p.return||p.return()}finally{if(d)throw v}}u.textContent=o.name,a.appendChild(u),i.appendChild(a);var x=t.c.div("".concat(l,"__card-label"));x.textContent=o.name,i.appendChild(x),t.e.on(i,"click",function(){t.s.focus(),(0,r.applyStyle)(t,o,e),t.synchronizeValues(),n()}),h.appendChild(i)}()}catch(t){S=!0,_=t}finally{try{x||null==b.return||b.return()}finally{if(S)throw _}}a.appendChild(h)}}catch(t){f=!0,d=t}finally{try{u||null==y.return||y.return()}finally{if(f)throw d}}return a}},8060:function(t,e,n){"use strict";n.d(e,{classifyDefinitions:function(){return o}});var r=n(82758);function o(t){var e=[],n=[],o=!0,i=!1,l=void 0;try{for(var s,c=t[Symbol.iterator]();!(o=(s=c.next()).done);o=!0){var a=s.value;r.IS_BLOCK.test(a.element)?e.push(a):n.push(a)}}catch(t){i=!0,l=t}finally{try{o||null==c.return||c.return()}finally{if(i)throw l}}var u=[];return e.length&&u.push({title:"Block styles",definitions:e}),n.length&&u.push({title:"Text styles",definitions:n}),u}},28609:function(t,e,n){"use strict";var r=n(69341),o=n(5440),i=n(78955),l=n.n(i),s=n(6441);s.Config.prototype.customStyles={definitions:[]},s.Config.prototype.controls.style={tooltip:"Styles",icon:l(),isDisabled:function(t){return!t.o.customStyles.definitions.length},isActive:function(t){var e=t.o.customStyles.definitions;return!!e.length&&null!=(0,r.detectActiveStyle)(t,e)},update:function(t,e){var n,o=t.o.customStyles.definitions;if(o.length){var i=(0,r.detectActiveStyle)(t,o),l=(null==(n=e.control)?void 0:n.component)==="select";(t.o.textIcons||l)&&(i?e.state.text=i.name:e.state.text=l?t.i18n("Styles"):"")}},exec:function(){return!1},popup:function(t,e,n){var r=t.o.customStyles.definitions;if(!r.length)return!1;t.s.current()||t.s.focus(),t.s.save();var i=(0,o.buildStylePopup)(t,r,function(){t.s.restore(),n()});return t.e.one("beforePopupClose",function(){t.s.restore()}),i}}},31105:function(t,e,n){"use strict";n.d(e,{applyStyle:function(){return c}});var r=n(69341),o=n(82758),i=n(2748);function l(t,e){var n=t.s.current();if(!n)return null;if(o.IS_BLOCK.test(e.element))return i.Dom.closest(n,i.Dom.isBlock,t.editor);for(var r=i.Dom.isElement(n)?n:n.parentNode;r&&r!==t.editor;){if(i.Dom.isElement(r)&&r.nodeName.toLowerCase()===e.element)return r;r=r.parentNode}return null}function s(t,e){var n=!0,r=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var s=i.value;t.classList.remove(s)}}catch(t){r=!0,o=t}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}""===t.className&&t.removeAttribute("class")}function c(t,e,n){var c=(0,r.detectActiveStyle)(t,n);c&&(t.s.commitStyle({element:c.element,attributes:{class:c.classes[0]}}),!function(t,e){if(!(e.classes.length<=1)){var n=t.s.current();if(n)if(o.IS_BLOCK.test(e.element)){var r=i.Dom.closest(n,i.Dom.isBlock,t.editor);r&&s(r,e.classes.slice(1))}else{var c=l(t,e);c&&(s(c,e.classes.slice(1)),"span"!==c.nodeName.toLowerCase()||c.attributes.length||i.Dom.unwrap(c))}}}(t,c),c===e)||(t.s.commitStyle({element:e.element,attributes:{class:e.classes[0]}}),function(t,e){if(!(e.classes.length<=1)){var n=l(t,e);if(n)for(var r=1;r<e.classes.length;r++)n.classList.add(e.classes[r])}}(t,e))}},69341:function(t,e,n){"use strict";n.d(e,{detectActiveStyle:function(){return l}});var r=n(82758),o=n(2748);function i(t,e){return t.nodeName.toLowerCase()===e.element&&e.classes.every(function(e){return t.classList.contains(e)})}function l(t,e){var n=t.s.current();if(!n)return null;var l=!0,s=!1,c=void 0;try{for(var a,u=e[Symbol.iterator]();!(l=(a=u.next()).done);l=!0){var f=a.value;if(r.IS_BLOCK.test(f.element)){var d=o.Dom.closest(n,o.Dom.isBlock,t.editor);if(d&&i(d,f))return f}else for(var v=o.Dom.isElement(n)?n:n.parentNode;v&&v!==t.editor;){if(o.Dom.isElement(v)&&i(v,f))return f;v=v.parentNode}}}catch(t){s=!0,c=t}finally{try{l||null==u.return||u.return()}finally{if(s)throw c}}return null}},75554:function(t,e,n){"use strict";n.r(e),n.d(e,{style:function(){return f}});var r=n(80294),o=n(20616),i=n(67709),l=n(82749),s=n(18766),c=n(23078);n(28609);var a=n(50911),u=n(2692),f=function(t){function e(){var t;return(0,o._)(this,e),t=(0,r._)(this,e,arguments),(0,l._)(t,"buttons",[{name:"style",group:"font"}]),t}return(0,s._)(e,t),(0,i._)(e,[{key:"afterInit",value:function(t){}},{key:"beforeDestruct",value:function(t){}}]),e}((0,c._)(a.Plugin));(0,l._)(f,"requires",["license"]),u.JoditPro.plugins.add("style",f)},78955:function(t){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="1.5"> <rect x="2" y="3.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="2" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="3.5" width="9" height="9" rx="1.5" fill="currentColor" transform="rotate(45 17.5 8)"/> </svg>'}},function(t){return t(t.s=75554)}])});