UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

8 lines 11.9 kB
/*! * 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 s=e();for(var o in s)("object"==typeof exports?exports:t)[o]=s[o]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[702],{10690:function(t){t.exports='<svg viewBox="0 0 30 29" xmlns="http://www.w3.org/2000/svg"> <path d="M15 0.5L30 15.2625H22V24H8V15.2625H0L15 0.5Z"/> <rect x="8" y="26" width="14" height="3"/> </svg>'},11699:function(t){t.exports='<svg viewBox="0 0 30 29" xmlns="http://www.w3.org/2000/svg"> <path d="M15 0.5L30 15.2625H22V29H8V15.2625H0L15 0.5Z"/> </svg>'},25241:function(t,e,s){"use strict";s.d(e,{UIKeyboard:function(){return S}});var o=s(80294),a=s(20616),n=s(67709),r=s(82749),i=s(18766),c=s(31635),u=s(82758),h=s(65478),p=s(43555),l=s(67510),y=s(27926),d=s.n(y),v=s(10690),f=s.n(v),k=s(91997),g=s.n(k),_=s(11699),b=s.n(_),w=s(98126),m=s.n(w),S=function(t){function e(t){var s;return(0,a._)(this,e),s=(0,o._)(this,e,[t]),(0,r._)(s,"state",{caps:!1,shift:!1,options:!1,currentLayout:s.j.o.keyboard.defaultLayoutSet}),(0,r._)(s,"_keys",s.getElms("key")),(0,r._)(s,"pressed",!1),(0,r._)(s,"reKeyDownTimeout",0),s.onStateChange(),s}return(0,i._)(e,t),(0,n._)(e,[{key:"className",value:function(){return"UIKeyboard"}},{key:"render",value:function(){var t=this.j.options.keyboard,e=t.layout,s=t.keySize,o=e.length;return"<div>".concat(function(){for(var t=[],a=0;o>a;a+=1){for(var n=[],r=0;r<e[a].length;r+=1)n.push('<div style="width:'.concat(s*e[a][r],"px;height:").concat(s,'px;" class="&__key"></div>'));t.push("<div class='&__row'>".concat(n.join("\n"),"</div>"))}return t.join("\n")}(),"</div>")}},{key:"onStateChange",value:function(){for(var t=this.state,s=t.currentLayout,o=t.options,a=t.shift,n=t.caps,r=this.j.o.keyboard.layoutList[s].keys,i=0,c=0;c<r.length;c+=1)for(var u=0;u<r[c].length;u+=1){var h=r[c][u].split(" "),p=h[0];a&&(p=h[1]),!a&&n&&h[1]&&e.isLetter(h[0])&&(p=h[1]),o&&(p=h[2]),this.setKeyValue(i,null!=p?p:h[0]),i+=1}}},{key:"setKeyValue",value:function(t,s){var o=this._keys[t];if(o){var a=!1,n=this.state,r=n.options,i=n.shift,c=n.caps;switch(s){case"Caps":a=c;break;case"Options":a=r;break;case"Shift":a=i}o.innerHTML=e.decorate(s),o.classList.toggle(this.getFullElName("key","active",!0),a),(0,p.attr)(o,"-key",s)}}},{key:"onKeyUp",value:function(){this.pressed&&this.stopPress()}},{key:"onReady",value:function(){this.j.e.on(this.getElms("key"),"mouseenter",this.stopPress)}},{key:"stopPress",value:function(){var t=this;this.pressed&&(this.pressed=!1,this.j.async.clearTimeout(this.reKeyDownTimeout),this._keys.forEach(function(e){e.classList.remove(t.getFullElName("key","pressed",!0))}))}},{key:"onKeyDown",value:function(t){var e=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=t.target;if(!o||!o.classList.contains(this.getFullElName("key")))return!1;this.pressed=!0,o.classList.add(this.getFullElName("key","pressed",!0));var a=(0,p.attr)(o,"-key");switch(a){case"Caps":this.state.caps=!this.state.caps;break;case"Shift":this.state.shift=!this.state.shift;break;case"Options":this.state.options=!this.state.options;break;case"Enter":case"Backspace":this.j.e.fire("keydown",{key:a,preventDefault:function(){}});break;case"Space":case"Tab":this.j.s.insertNode(this.j.createInside.text(u.NBSP_SPACE));break;default:this.state.shift&&(this.state.shift=!1),a&&this.j.s.insertNode(this.j.createInside.text(a))}var n=this.j.o.keyboard,r=n.periodKeyRepeat,i=n.delayKeyRepeat;return this.reKeyDownTimeout=this.j.async.setTimeout(function(){return e.onKeyDown(t,r)},s||i),!1}}],[{key:"isLetter",value:function(t){return t.toLowerCase()!==t.toUpperCase()}},{key:"decorate",value:function(t){switch(t){case"Space":return"";case"Enter":return l.Icon.get("enter");case"Backspace":return d();case"Shift":return b();case"Caps":return f();case"Options":return g();case"Tab":return m();default:return t}}}]),e}(l.UIElement);(0,c.__decorate)([(0,h.watch)(["state.currentLayout","state.options","state.shift","state.caps"])],S.prototype,"onStateChange",null),(0,c.__decorate)([(0,h.watch)(["ow:mouseup"])],S.prototype,"onKeyUp",null),(0,c.__decorate)([(0,h.hook)("ready")],S.prototype,"onReady",null),(0,c.__decorate)([h.autobind],S.prototype,"stopPress",null),(0,c.__decorate)([(0,h.watch)(["container:mousedown","container:touchstart"])],S.prototype,"onKeyDown",null),S=(0,c.__decorate)([h.component],S)},27926:function(t){t.exports='<?xml version="1.0" ?><svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M0 10l7-7h13v14H7l-7-7zm14.41 0l2.13-2.12-1.42-1.42L13 8.6l-2.12-2.13-1.42 1.42L11.6 10l-2.13 2.12 1.42 1.42L13 11.4l2.12 2.13 1.42-1.42L14.4 10z"/></svg>'},41113:function(t,e,s){"use strict";var o=s(63643),a=s.n(o),n=s(6441);n.Config.prototype.keyboard={defaultLayoutSet:"en",showLayoutSwitcher:!0,extraKeyGroup:"other",extraKeyButtons:[],delayKeyRepeat:350,periodKeyRepeat:100,layoutList:{en:{title:"English",keys:[["` ~ \xb1","1 ! \xa7","2 @","3 #","4 $","5 %","6 ^","7 &","8 *","9 (","0 )","- _","= +","Backspace"],["Tab","q Q","w W","e E","r R","t T","y Y","u U","i I","o O","p P","[ {","] }","\\ |"],["Caps","a A","s S","d D","f F","g G","h H","j J","k K","l L","; :","' \"","Enter"],["Shift","z Z","x X","c C","v V","b B","n N","m M",", <",". >","/ ?","Shift"],["Options","Space","Options"]]},es:{title:"Espa\xf1ol",keys:[["\xba ` ~","1 ! \xa7","2 @","3 #","4 $","5 %","6 ^","7 &","8 *","9 (","0 )","- _ |","\xa1 = +","Backspace"],["Tab","q Q","w W","e E","r R","t T","y Y","u U","i I","o O","p P","[ {","] }","\xe7 \xc7 \\"],["Caps","a A","s S","d D","f F","g G","h H","j J","k K","l L","\xf1 \xd1 ; :","' \"","Enter"],["Shift","z Z","x X","c C","v V","b B","n N","m M",", <",". >","/ ?","Shift"],["Options","Space","Options"]]},de:{title:"Deutsch",keys:[["` ~ \xb1","1 ! \xa7","2 @","3 #","4 $","5 %","6 ^","7 &","8 * :","9 ( {","0 ) }","- _","= +","Backspace"],["Tab","q Q","w W","e E","r R","t T","z Z","u U","i I","o O","p P","\xfc \xdc [","] }","\\ |"],["Caps","a A","s S","d D","f F","g G","h H","j J","k K","l L","\xf6 \xd6 ;","\xe4 \xc4 ' \"","Enter"],["Shift","y Y","x X","c C","v V","b B","n N","m M",", <",". >","/ ?","Shift"],["Options","Space","Options"]]},ru:{title:"Русский",keys:[["` ~ \xb1","1 ! \xa7",'2 @ "',"3 # :","4 $ <","5 % >","6 ^","7 &","8 *","9 (","0 )","- _","= +","Backspace"],["Tab","й Й","ц Ц","у У","к К","е Е","н Н","г Г","ш Ш","щ Щ","з З","х Х [","ъ ] {","\\ | }"],["Caps","ф Ф","ы Ы","в В","а А","п П","р Р","о О","л Л","д Д","ж Ж ;","э Э '","Enter"],["Shift","я Я","ч Ч","с С","м М","и И","т Т","ь Ь","б Б ,","ю Ю .","/ ?","Shift"],["Options","Space","Options"]]},tr:{title:"T\xfcrk\xe7e",keys:[['" \xe9` ~',"1 ! \xa7",'2 @ "',"3 # :","4 $ <","5 % >","6 ^ \xb1","7 &","8 *","9 ( {","0 ) }","- _ [","= + ]","Backspace"],["Tab","q Q","w W","e E","r R","t T","y Y","u U","ı I","o O","p P","ğ Ğ","\xfc \xdc",", \\ |"],["Caps","a A","s S","d D","f F","g G","h H","j J","k K","l L","ş Ş","i̇ İ","Enter"],["Shift","z Z","x X","c C","v V","b B","n N","m M","\xf6 \xd6 <","\xe7 \xc7 >",". / ?","Shift"],["Options","Space","Options"]]},iw:{title:"Hebrew",keys:[["` ~ \xb1","1 ! \xa7","2 @","3 #","4 $","5 %","6 ^","7 &","8 *","9 (","0 )","- _","= +","Backspace"],["Tab","/ q Q","' w W","ק e E","ר r R","א t T","ט y Y","ו u U","ן i I","ם o O","פ p P","[ {","] }","\\ |"],["Caps","ש a A","ד s S","ג d D","כ f F","ע g G","י h H","ח j J","ל k K","ך l L","ף ; :","' \"","Enter"],["Shift","ז z Z","ס x X","ב c C","ה v V","נ b B","מ n N","צ m M",", <",". >","/ ?","Shift"],["Options","Space","Options"]]},tata:{title:"Tata",keys:[["һ Һ` ~","1 ! \xa7",'2 @ "',"3 # :","4 $ <","5 % >","6 ^ \xb1","7 &","8 *","9 ( {","0 )","- _","= +","Backspace"],["Tab","й Й","ө Ө","у У","к К","е Е","н Н","г Г","ш Ш","ә Ә","з З","х Х [","ү Ү ]","\\ | }"],["Caps","ф Ф","ы Ы","в В","а А","п П","р Р","о О","л Л","д Д","ң Ң ;","э Э '","Enter"],["Shift","я Я","ч Ч","с С","м М","и И","т Т","җ Җ","б Б ,","ю Ю .","ґ Ґ /","Shift"],["Options","Space","Options"]]}},layoutSwitchList:["en","es","de","ru","tr","iw","tata"],keySize:32,layout:[[1,1,1,1,1,1,1,1,1,1,1,1,1,2],[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],[1.8,1,1,1,1,1,1,1,1,1,1,1,2.2],[2.5,1,1,1,1,1,1,1,1,1,1,2.5],[3.5,9,3.5]]},n.Config.prototype.controls.keyboard={tooltip:"Keyboard",icon:a(),isActive:function(t){return!!t.e.fire("isKeyboardOpened")},command:"toggleKeyboard"},n.Config.prototype.controls.extraKeyboardButtons={}},63643:function(t){t.exports='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <path d="M0 6c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm2 0v2h2V6H2zm1 3v2h2V9H3zm-1 3v2h2v-2H2zm3 0v2h10v-2H5zm11 0v2h2v-2h-2zM6 9v2h2V9H6zm3 0v2h2V9H9zm3 0v2h2V9h-2zm3 0v2h2V9h-2zM5 6v2h2V6H5zm3 0v2h2V6H8zm3 0v2h2V6h-2zm3 0v2h4V6h-4z"/> </svg>'},91997:function(t){t.exports='<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox="0 0 24 24" > <circle cy="12" cx="12" r="2.2"/> <circle cy="12" cx="5" r="2.2"/> <circle cy="12" cx="19" r="2.2"/> </svg>'},95618:function(t,e,s){"use strict";s.r(e),s.d(e,{keyboard:function(){return g}});var o=s(80294),a=s(20616),n=s(67709),r=s(82749),i=s(18766),c=s(23078),u=s(31635);s(41113);var h=s(25241),p=s(6441),l=s(65478),y=s(27613),d=s(50911),v=s(67510),f=s(41409),k=s(2692),g=function(t){function e(t){(0,a._)(this,e),s=(0,o._)(this,e,[t]),(0,r._)(s,"hasStyle",!k.JoditPro.fatMode),(0,r._)(s,"buttons",[{group:"insert",name:"keyboard"}]),(0,r._)(s,"__keyboard",void 0);var s,n=t.o.keyboard,i=n.extraKeyButtons,c=n.extraKeyGroup;return i.length&&i.forEach(function(e,s){var o=(0,y.isString)(e)?e:e.key,a=(0,y.isString)(e)||!e.hotkeys?["ctrl+".concat(s+1)]:e.hotkeys;t.registerButton({name:"extraKeyboardButtons.".concat(o),group:c}),p.Config.defaultOptions.controls.extraKeyboardButtons[o]={name:o,tooltip:o,args:[o],hotkeys:a,command:"insertChar"}}),s}return(0,i._)(e,t),(0,n._)(e,[{key:"afterInit",value:function(t){var e=this;t.registerCommand("toggleKeyboard",this.toggleKeyboard).registerCommand("insertChar",this.insertChar),t.e.on("isKeyboardOpened",function(){var t;return null==(t=e.__keyboard)?void 0:t.isOpened})}},{key:"insertChar",value:function(t,e,s){this.j.s.insertNode(this.j.createInside.text(s))}},{key:"toggleKeyboard",value:function(){if(!this.__keyboard){this.__keyboard=new f.Dialog({toolbarButtonSize:"tiny"});var t=new h.UIKeyboard(this.j);this.__keyboard.setMod("slim",!0).setMod("adaptive",!1).setContent(t);var e=this.j.o.keyboard,s=e.showLayoutSwitcher,o=e.layoutSwitchList,a=e.layoutList;if(s){var n=new v.UISelect(this.__keyboard,{value:t.state.currentLayout,options:o.map(function(t){var e,s;return{text:null!=(e=null==(s=a[t])?void 0:s.title)?e:t,value:t}}),onChange:function(e){t.state.currentLayout=e}});n.setMod("size","tiny").setMod("width","auto").setMod("variant","outline"),this.__keyboard.setHeader(n)}}this.__keyboard.isOpened?this.__keyboard.close():this.__keyboard.open()}},{key:"beforeDestruct",value:function(t){var e;null==(e=this.__keyboard)||e.destruct()}}]),e}((0,c._)(d.Plugin));(0,r._)(g,"requires",["license"]),(0,u.__decorate)([l.autobind],g.prototype,"insertChar",null),(0,u.__decorate)([l.autobind],g.prototype,"toggleKeyboard",null),k.JoditPro.plugins.add("keyboard",g)},98126:function(t){t.exports='<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg"> <path d="M23.17 14.83l7.17 7.17h-28.34v4h28.34l-7.17 7.17 2.83 2.83 12-12-12-12-2.83 2.83zm16.83-2.83v24h4v-24h-4z"/> </svg>'}},function(t){return t(t.s=95618)}])});