jodit-pro
Version:
PRO Version of Jodit Editor
10 lines • 10.9 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 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 b}});var o=s(82749),a=s(31635),r=s(82758),i=s(65478),n=s(43555),h=s(67510),c=s(27926),p=s.n(c),l=s(10690),d=s.n(l),u=s(91997),y=s.n(u),f=s(11699),g=s.n(f),k=s(98126),v=s.n(k);class b extends h.UIElement{className(){return"UIKeyboard"}render(){let{layout:t,keySize:e}=this.j.options.keyboard,s=t.length;return`<div>${(()=>{let o=[];for(let a=0;s>a;a+=1){let s=[];for(let o=0;o<t[a].length;o+=1)s.push(`<div style="width:${e*t[a][o]}px;height:${e}px;" class="&__key"></div>`);o.push(`<div class='&__row'>${s.join(`
`)}</div>`)}return o.join(`
`)})()}</div>`}onStateChange(){let{currentLayout:t,options:e,shift:s,caps:o}=this.state,{keys:a}=this.j.o.keyboard.layoutList[t],r=0;for(let t=0;t<a.length;t+=1)for(let i=0;i<a[t].length;i+=1){let n=a[t][i].split(" "),h=n[0];s&&(h=n[1]),!s&&o&&n[1]&&b.isLetter(n[0])&&(h=n[1]),e&&(h=n[2]),this.setKeyValue(r,h??n[0]),r+=1}}static isLetter(t){return t.toLowerCase()!==t.toUpperCase()}setKeyValue(t,e){let s=this._keys[t];if(!s)return;let o=!1,{options:a,shift:r,caps:i}=this.state;switch(e){case"Caps":o=i;break;case"Options":o=a;break;case"Shift":o=r}s.innerHTML=b.decorate(e),s.classList.toggle(this.getFullElName("key","active",!0),o),(0,n.attr)(s,"-key",e)}onKeyUp(){this.pressed&&this.stopPress()}onReady(){this.j.e.on(this.getElms("key"),"mouseenter",this.stopPress)}stopPress(){this.pressed&&(this.pressed=!1,this.j.async.clearTimeout(this.reKeyDownTimeout),this._keys.forEach(t=>{t.classList.remove(this.getFullElName("key","pressed",!0))}))}onKeyDown(t,e=0){let s=t.target;if(!s||!s.classList.contains(this.getFullElName("key")))return!1;this.pressed=!0,s.classList.add(this.getFullElName("key","pressed",!0));let o=(0,n.attr)(s,"-key");switch(o){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:o,preventDefault(){}});break;case"Space":case"Tab":this.j.s.insertNode(this.j.createInside.text(r.NBSP_SPACE));break;default:this.state.shift&&(this.state.shift=!1),o&&this.j.s.insertNode(this.j.createInside.text(o))}let{periodKeyRepeat:a,delayKeyRepeat:i}=this.j.o.keyboard;return this.reKeyDownTimeout=this.j.async.setTimeout(()=>this.onKeyDown(t,a),e||i),!1}static decorate(t){switch(t){case"Space":return"";case"Enter":return h.Icon.get("enter");case"Backspace":return p();case"Shift":return g();case"Caps":return d();case"Options":return y();case"Tab":return v();default:return t}}constructor(t){super(t),(0,o._)(this,"state",{caps:!1,shift:!1,options:!1,currentLayout:this.j.o.keyboard.defaultLayoutSet}),(0,o._)(this,"_keys",this.getElms("key")),(0,o._)(this,"pressed",!1),(0,o._)(this,"reKeyDownTimeout",0),this.onStateChange()}}(0,a.__decorate)([(0,i.watch)(["state.currentLayout","state.options","state.shift","state.caps"])],b.prototype,"onStateChange",null),(0,a.__decorate)([(0,i.watch)(["ow:mouseup"])],b.prototype,"onKeyUp",null),(0,a.__decorate)([(0,i.hook)("ready")],b.prototype,"onReady",null),(0,a.__decorate)([i.autobind],b.prototype,"stopPress",null),(0,a.__decorate)([(0,i.watch)(["container:mousedown","container:touchstart"])],b.prototype,"onKeyDown",null),b=(0,a.__decorate)([i.component],b)},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),r=s(6441);r.Config.prototype.keyboard={defaultLayoutSet:"en",showLayoutSwitcher:!0,extraKeyGroup:"other",extraKeyButtons:[],delayKeyRepeat:350,periodKeyRepeat:100,layoutList:{en:{title:"English",keys:[["` ~ ±","1 ! §","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ñol",keys:[["º ` ~","1 ! §","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"]]},de:{title:"Deutsch",keys:[["` ~ ±","1 ! §","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","ü Ü [","] }","\\ |"],["Caps","a A","s S","d D","f F","g G","h H","j J","k K","l L","ö Ö ;","ä Ä ' \"","Enter"],["Shift","y Y","x X","c C","v V","b B","n N","m M",", <",". >","/ ?","Shift"],["Options","Space","Options"]]},ru:{title:"Русский",keys:[["` ~ ±","1 ! §",'2 @ "',"3 # :","4 $ <","5 % >","6 ^","7 &","8 *","9 (","0 )","- _","= +","Backspace"],["Tab","й Й","ц Ц","у У","к К","е Е","н Н","г Г","ш Ш","щ Щ","з З","х Х [","ъ ] {","\\ | }"],["Caps","ф Ф","ы Ы","в В","а А","п П","р Р","о О","л Л","д Д","ж Ж ;","э Э '","Enter"],["Shift","я Я","ч Ч","с С","м М","и И","т Т","ь Ь","б Б ,","ю Ю .","/ ?","Shift"],["Options","Space","Options"]]},tr:{title:"Türkçe",keys:[['" é` ~',"1 ! §",'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","o O","p P","ğ Ğ","ü Ü",", \\ |"],["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","ö Ö <","ç Ç >",". / ?","Shift"],["Options","Space","Options"]]},iw:{title:"Hebrew",keys:[["` ~ ±","1 ! §","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 ! §",'2 @ "',"3 # :","4 $ <","5 % >","6 ^ ±","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]]},r.Config.prototype.controls.keyboard={tooltip:"Keyboard",icon:a(),isActive:t=>!!t.e.fire("isKeyboardOpened"),command:"toggleKeyboard"},r.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 u}});var o=s(82749),a=s(31635);s(41113);var r=s(25241),i=s(6441),n=s(65478),h=s(27613),c=s(50911),p=s(67510),l=s(41409),d=s(2692);class u extends c.Plugin{afterInit(t){t.registerCommand("toggleKeyboard",this.toggleKeyboard).registerCommand("insertChar",this.insertChar),t.e.on("isKeyboardOpened",()=>this.__keyboard?.isOpened)}insertChar(t,e,s){this.j.s.insertNode(this.j.createInside.text(s))}toggleKeyboard(){if(!this.__keyboard){this.__keyboard=new l.Dialog({toolbarButtonSize:"tiny"});let t=new r.UIKeyboard(this.j);this.__keyboard.setMod("slim",!0).setMod("adaptive",!1).setContent(t);let{showLayoutSwitcher:e,layoutSwitchList:s,layoutList:o}=this.j.o.keyboard;if(e){let e=new p.UISelect(this.__keyboard,{value:t.state.currentLayout,options:s.map(t=>({text:o[t]?.title??t,value:t})),onChange(e){t.state.currentLayout=e}});e.setMod("size","tiny").setMod("width","auto").setMod("variant","outline"),this.__keyboard.setHeader(e)}}this.__keyboard.isOpened?this.__keyboard.close():this.__keyboard.open()}beforeDestruct(t){this.__keyboard?.destruct()}constructor(t){super(t),(0,o._)(this,"hasStyle",!d.JoditPro.fatMode),(0,o._)(this,"buttons",[{group:"insert",name:"keyboard"}]),(0,o._)(this,"__keyboard",void 0);const{extraKeyButtons:e,extraKeyGroup:s}=t.o.keyboard;e.length&&e.forEach((e,o)=>{let a=(0,h.isString)(e)?e:e.key,r=(0,h.isString)(e)||!e.hotkeys?["ctrl+"+(o+1)]:e.hotkeys;t.registerButton({name:"extraKeyboardButtons."+a,group:s});let{extraKeyboardButtons:n}=i.Config.defaultOptions.controls;n[a]={name:a,tooltip:a,args:[a],hotkeys:r,command:"insertChar"}})}}(0,o._)(u,"requires",["license"]),(0,a.__decorate)([n.autobind],u.prototype,"insertChar",null),(0,a.__decorate)([n.autobind],u.prototype,"toggleKeyboard",null),d.JoditPro.plugins.add("keyboard",u)},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)}])});