@ckeditor/ckeditor5-format-painter 48.5.0-alpha.4 → 48.5.0-alpha.5

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -20,5 +20,5 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x269e7f,Plugin as _0x2b80dc}from'@ckeditor/ckeditor5-core';import{RemoveFormatCommand as _0x35c01a}from'@ckeditor/ckeditor5-remove-format';import{SplitButtonView as _0x3fb5ca,UIModel as _0x41070b,addListToDropdown as _0x5e84db,createDropdown as _0x35843e}from'@ckeditor/ckeditor5-ui';import{Collection as _0x2e9ec7,DomEmitterMixin as _0x1ddc8e,global as _0x5bed2c,uid as _0x1e6a3e}from'@ckeditor/ckeditor5-utils';import{ClickObserver as _0x10d55e}from'@ckeditor/ckeditor5-engine';import{IconPaintRoller as _0x11f764}from'@ckeditor/ckeditor5-icons';const w='copyFormat',g='pasteFormat',h='ck-format-painter-active';var y=class extends _0x269e7f{constructor(_0x5575ca){super(_0x5575ca),this['value']=void 0x0,this['on']('change:isEnabled',(_0x4ffc07,_0x1e448e,_0x403579)=>{_0x403579||this['reset']();}),this['on']('change:value',()=>_0x5575ca['commands']['get'](g)['refresh']());}execute(){this['value']=this['_getFormattingAttributes']();}reset(){this['value']=void 0x0;}_getFormattingAttributes(){const _0x217979=this['editor']['model'],_0x58a285=_0x217979['document']['selection'];return Object['fromEntries'](Array['from'](_0x58a285['getAttributes']())['filter'](([_0x10bad7])=>_0x217979['schema']['getAttributeProperties'](_0x10bad7)['isFormatting']));}},p=class extends _0x269e7f{constructor(_0x459338){super(_0x459338),this['_removeFormatCommand']=new _0x35c01a(_0x459338);}execute(_0x4657b0={}){const _0x50e903=this['editor']['model'],_0x1c7dae=_0x50e903['document']['selection'],_0x21155b=Array['from'](_0x1c7dae['getRanges']()),_0x4ade88=_0x1c7dae['isCollapsed']?[this['_createRangeOnEntireWord'](_0x50e903,_0x1c7dae)]:_0x21155b;_0x50e903['change'](_0x28e8b0=>{_0x28e8b0['setSelection'](_0x4ade88),this['_removeFormatCommand']['execute']();for(const _0x8fe8e9 in _0x4657b0)for(const _0x2f12e3 of _0x50e903['schema']['getValidRanges'](_0x4ade88,_0x8fe8e9))_0x28e8b0['setAttribute'](_0x8fe8e9,_0x4657b0[_0x8fe8e9],_0x2f12e3);_0x28e8b0['setSelection'](_0x21155b);});}_createRangeOnEntireWord(_0x281c6c,_0x824d9a){const _0x18944b=_0x281c6c['createSelection'](_0x824d9a);_0x281c6c['modifySelection'](_0x18944b,{'unit':'word','direction':'backward'});const _0x1dcd82=_0x18944b['getFirstPosition']();_0x281c6c['modifySelection'](_0x18944b,{'unit':'word','direction':'forward'});const _0x5d8349=_0x18944b['getLastPosition']();return _0x281c6c['createRange'](_0x1dcd82,_0x5d8349);}},P=class extends _0x2b80dc{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'FormatPainterEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0xd105ce=this['editor'];_0xd105ce['commands']['add'](w,new y(_0xd105ce)),_0xd105ce['commands']['add'](g,new p(_0xd105ce)),this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x3bbacc=[this['editor']];for(const _0x28755f of _0x3bbacc){let _0x429840;for(const _0x187e25 in _0x28755f){const _0x18a81f=_0x187e25,_0x5557aa=_0x28755f[_0x18a81f];if('formatPainterLicenseKeyValid'==_0x5557aa||'formatPainterLicenseKeyInvalid'==_0x5557aa||'formatPainterLicenseKeyExpired'==_0x5557aa||'formatPainterLicenseKeyDomainLimit'==_0x5557aa||'formatPainterLicenseKeyNotAllowed'==_0x5557aa||'formatPainterLicenseKeyEvaluationLimit'==_0x5557aa||'formatPainterLicenseKeyUsageLimit'==_0x5557aa){delete _0x28755f[_0x18a81f],_0x429840=_0x5557aa,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'formatPainterLicenseKeyInvalid'==_0x429840&&_0x28755f['_showLicenseError']('invalid'),'formatPainterLicenseKeyExpired'==_0x429840&&_0x28755f['_showLicenseError']('expired'),'formatPainterLicenseKeyDomainLimit'==_0x429840&&_0x28755f['_showLicenseError']('domainLimit'),'formatPainterLicenseKeyNotAllowed'==_0x429840&&_0x28755f['_showLicenseError']('featureNotAllowed','FormatPainter'),'formatPainterLicenseKeyEvaluationLimit'==_0x429840&&_0x28755f['_showLicenseError']('evaluationLimit'),'formatPainterLicenseKeyUsageLimit'==_0x429840&&_0x28755f['_showLicenseError']('usageLimit');}},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}};function L(_0xc7cb41,_0x1297b0){const t=_0xc7cb41['t'];switch(_0x1297b0){case'Paint\x20formatting':return t('Paint\x20formatting');case'Copy\x20text\x20formatting':return t('Copy\x20text\x20formatting');case'Paste\x20text\x20formatting':return t('Paste\x20text\x20formatting');case'Continuous\x20painting':return t('Continuous\x20painting');case'Keeps\x20the\x20painter\x20on\x20after\x20setting\x20the\x20formatting.':return t('Keeps\x20the\x20painter\x20on\x20after\x20setting\x20the\x20formatting.');case'Formatting\x20copied.':return t('Formatting\x20copied.');case'Pasted\x20formatting.':return t('Pasted\x20formatting.');case'Painting\x20cancelled.':return t('Painting\x20cancelled.');default:return _0x1297b0;}}const v=/* #__PURE__ -- @preserve */
24
- _0x1ddc8e(_0x2b80dc);var k=class extends v{static get['pluginName'](){return'FormatPainterUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x19eeae=this['editor'];_0x19eeae['editing']['view']['addObserver'](_0x10d55e),_0x19eeae['accessibility']['addKeystrokeInfos']({'keystrokes':[{'label':L(_0x19eeae['locale'],'Copy\x20text\x20formatting'),'keystroke':'Ctrl+Alt+C'},{'label':L(_0x19eeae['locale'],'Paste\x20text\x20formatting'),'keystroke':'Ctrl+Alt+V'}]}),_0x19eeae['ui']['componentFactory']['add']('formatPainter',_0x3ed039=>{const _0x3a2ec9=_0x35843e(_0x3ed039,_0x3fb5ca),_0x2d44b8=_0x19eeae['commands']['get'](w);_0x3a2ec9['buttonView']['set']({'label':L(_0x19eeae['locale'],'Paint\x20formatting'),'icon':_0x11f764,'keystroke':'Ctrl+Alt+C','tooltip':!0x0}),_0x3a2ec9['class']='ck-format-painter-dropdown',_0x2d44b8&&(_0x3a2ec9['bind']('isEnabled')['to'](_0x2d44b8,'isEnabled'),this['listenTo'](_0x2d44b8,'change:isEnabled',(_0x27e7a5,_0x4c69b8,_0x454c35)=>{_0x454c35||this['_finishPainting']();}),_0x3a2ec9['buttonView']['bind']('isOn')['to'](_0x2d44b8,'value',_0x5d9cb3=>!!_0x5d9cb3),this['listenTo'](_0x19eeae,'destroy',()=>this['_toggleSpecialCursor'](!0x1)),this['listenTo'](_0x2d44b8,'change:value',(_0x763c95,_0x252b56,_0x857acd)=>{this['_toggleSpecialCursor'](!!_0x857acd);}));const _0x283de3=new _0x41070b({'withText':!0x0,'label':L(_0x19eeae['locale'],'Continuous\x20painting'),'tooltip':L(_0x19eeae['locale'],'Keeps\x20the\x20painter\x20on\x20after\x20setting\x20the\x20formatting.'),'isOn':!0x1,'role':'menuitemcheckbox'});_0x5e84db(_0x3a2ec9,new _0x2e9ec7([{'type':'switchbutton','model':_0x283de3}]),{'role':'menu'});const _0x43d641=()=>{this['_copyFormatting'](),this['listenTo'](_0x5bed2c['window']['document'],'mouseup',()=>{this['_pasteFormatting'](),_0x283de3['isOn']||this['_finishPainting']();});};return this['listenTo'](_0x3a2ec9,'execute',()=>{_0x283de3['isOn']=!_0x283de3['isOn'];}),this['listenTo'](_0x3a2ec9['buttonView'],'execute',()=>{_0x19eeae['editing']['view']['focus'](),_0x3a2ec9['buttonView']['isOn']?this['_finishPainting']():_0x43d641();}),_0x19eeae['keystrokes']['set']('Ctrl+Alt+C',(_0x5cf7e1,_0x5e145e)=>{_0x43d641(),_0x283de3['isOn']=!0x0,_0x5e145e();},{'priority':'high'}),_0x19eeae['keystrokes']['set']('Ctrl+Alt+V',(_0x191375,_0x5586c9)=>{_0x3a2ec9['buttonView']['isOn']&&(this['_pasteFormatting'](),_0x283de3['isOn']||this['_finishPainting'](),_0x5586c9());},{'priority':'high'}),_0x19eeae['keystrokes']['set']('Esc',(_0x4f749d,_0x219087)=>{_0x3a2ec9['buttonView']['isOn']&&(_0x283de3['isOn']=!0x1,this['_finishPainting'](),_0x19eeae['ui']['ariaLiveAnnouncer']['announce'](L(_0x19eeae['locale'],'Painting\x20cancelled.')),_0x219087());}),_0x3a2ec9;});}afterInit(){!async function(_0x1d0847){const _0x5c2140='un0NFQUoX1evzk3yMEfwl7TxbDrisOZaWtKq52P98dchBVpjS4mYLC6gJIHGRA',_0x159e31=0x79428,_0x3d4718={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x17707c(_0x293d5d){const _0xbd56b3=new window['Promise'](_0x3e0dcf=>{_0x293d5d['once']('ready',_0x3e0dcf);}),_0x19263a=window['Date']['now'](),_0x5346d8=_0x293d5d['config']['get']('licenseKey');async function _0x55d9ef(){let _0x14a40b,_0x3a84f9=null,_0x17bac7=null;try{return'GPL'==_0x5346d8?'NotAllowed':(_0x14a40b=_0x538f31(),_0x14a40b?(_0x14a40b['usageEndpoint']&&(_0x17bac7=_0x2f6c48(_0x14a40b['usageEndpoint'],_0x14a40b['jti'])),await _0x39dd81()?_0x3cbe77()?_0x310651()?'Expired':_0x570133()?('evaluation'==_0x14a40b['licenseType']&&(_0x3a84f9=_0x4f1511('EvaluationLimit')),await _0x2bbe68()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x310651(){const _0x497cbf=['evaluation','trial']['includes'](_0x14a40b['licenseType'])?_0x19263a/0x3e8:0xe10*_0x159e31;return _0x14a40b['exp']<_0x497cbf;}function _0x3cbe77(){const _0x2150e7=_0x14a40b['features'];return!!_0x2150e7&&(!!_0x2150e7['includes']('*')||(!!_0x2150e7['includes']('FP')||(!!_0x2150e7['includes']('PP')||!(!_0x2150e7['includes']('TRILIUM')||!_0x5ee485()))));}function _0x570133(){const _0x5d0477=_0x14a40b['licensedHosts'];if(!_0x5d0477||0x0==_0x5d0477['length'])return!0x0;const {hostname:_0x2e4736}=new URL(window['location']['href']);if(_0x5d0477['includes'](_0x2e4736))return!0x0;const _0x5b7529=_0x2e4736['split']('.');return _0x5d0477['filter'](_0x46fb87=>_0x46fb87['includes']('*'))['map'](_0x307116=>_0x307116['split']('.'))['filter'](_0x1fcddf=>_0x1fcddf['length']<=_0x5b7529['length'])['map'](_0x51bee2=>Array(_0x5b7529['length']-_0x51bee2['length'])['fill']('*'===_0x51bee2[0x0]?'*':'')['concat'](_0x51bee2))['some'](_0x28c756=>_0x5b7529['every']((_0x2dcd14,_0x319cf6)=>_0x28c756[_0x319cf6]===_0x2dcd14||'*'===_0x28c756[_0x319cf6]));}function _0x2bbe68(){return _0x3a84f9&&_0x17bac7?new window['Promise']((_0x2f34b1,_0x28f883)=>{_0x3a84f9['then'](_0x2f34b1,_0x28f883),_0x17bac7['then'](_0x54d164=>{'Valid'!=_0x54d164&&_0x2f34b1(_0x54d164);},_0x28f883);}):_0x3a84f9||_0x17bac7||'Valid';}}function _0x2f6c48(_0x15e9aa,_0x550570){return new window['Promise'](_0x3c6e04=>{if(_0x2c538a())return _0x3c6e04('Valid');_0xaa79ba(),_0x293d5d['decorate']('_sendUsageRequest');let _0x1a5442=!0x1;const _0x318ae0=_0x1e6a3e();function _0x3c6afb(_0x2d8a52){return!!_0x2d8a52&&('object'==typeof _0x2d8a52||'function'==typeof _0x2d8a52)&&'function'==typeof _0x2d8a52['then']&&'function'==typeof _0x2d8a52['catch'];}function _0x28f619(_0x4e5a00){_0xabe95e(_0x4e5a00)['then'](_0x27555d=>_0x27555d&&'ok'==_0x27555d['status']?_0x23036d(_0x174600(_0x318ae0+_0x550570))!=_0x27555d['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x109441=>(_0x5d5173(),_0x109441),()=>{const _0x4dbf6d=_0x29a82b();return null==_0x4dbf6d?(_0x5d5173(),'Valid'):_0x19263a-_0x4dbf6d>0x240c8400?'UsageLimit':'Valid';})['then'](_0x3c6e04)['catch'](()=>{_0x3c6e04('UsageLimit');});const _0x5e2925=0x36ee80;function _0x5d5173(){const _0x4ef360='llct-'+_0x23036d(_0x174600(_0x15e9aa)),_0xfeb63f=_0xf5ad3c(_0x23036d(window['Math']['ceil'](_0x19263a/_0x5e2925)));window['localStorage']['setItem'](_0x4ef360,_0xfeb63f);}function _0x29a82b(){const _0x3b8f45='llct-'+_0x23036d(_0x174600(_0x15e9aa)),_0x4afb5d=window['localStorage']['getItem'](_0x3b8f45);return _0x4afb5d?window['parseInt'](_0xf5ad3c(_0x4afb5d),0x10)*_0x5e2925:null;}function _0xabe95e(_0x3ce109){return new window['Promise']((_0x4efbdb,_0x415ffc)=>{_0x3ce109['then'](_0x4efbdb,_0x415ffc),window['setTimeout'](_0x415ffc,0x1d4c0);});}}_0x293d5d['on']('_sendUsageRequest',(_0x2470c5,_0x369dc7)=>{if(_0x369dc7[0x0]!=_0x15e9aa)return _0x3c6e04('UsageLimit');_0x369dc7[0x1]={..._0x369dc7[0x1],'requestId':_0x318ae0};},{'priority':'high'}),_0x293d5d['on']('_sendUsageRequest',_0xd0974f=>{_0x3c6afb(_0xd0974f['return'])&&(_0x1a5442=!0x0,_0x28f619(_0xd0974f['return']));},{'priority':'low'}),_0xbd56b3['then'](()=>{_0x1a5442||_0x3c6e04('UsageLimit');});});function _0x2c538a(){return'auto'==_0x293d5d['editing']['view']['_overlayModeHint'];}function _0xaa79ba(){_0x293d5d['editing']['view']['_overlayModeHint']='auto';}}function _0x4f1511(_0x1f14ca){const _0x32b8e3=[new window['Promise'](_0x226dda=>setTimeout(_0x226dda,0x93ecc)),_0xbd56b3['then'](()=>new window['Promise'](_0x5b12a2=>{let _0x268483=0x0;_0x293d5d['model']['on']('applyOperation',(_0x3e7707,_0x44e4bc)=>{_0x44e4bc[0x0]['isDocumentOperation']&&_0x268483++,0x5e8==_0x268483&&(_0x5b12a2(),_0x3e7707['off']());});}))];return window['Promise']['race'](_0x32b8e3)['then'](()=>_0x1f14ca);}async function _0x1c0d0b(){await _0xbd56b3,_0x293d5d['model']['change']=_0x3541ad,_0x293d5d['model']['enqueueChange']=_0x3541ad,_0x293d5d['enableReadOnlyMode']('model');}function _0x5ee485(){return window['glob']&&window['glob']['triliumVersion'];}function _0x95030d(_0x1dd2d7){const _0x445863=_0x1cd2ae();_0x293d5d[_0x445863]='formatPainterLicenseKey'+_0x1dd2d7,'Valid'!=_0x1dd2d7&&_0x1c0d0b();}function _0x1cd2ae(){const _0x5e97da=window['String'](window['performance']['now']())['replace']('.','');let _0x22337e='u';for(let _0x1b6df2=0x0;_0x1b6df2<_0x5e97da['length'];_0x1b6df2+=0x2){let _0x10c85b=window['parseInt'](_0x5e97da['substring'](_0x1b6df2,_0x1b6df2+0x2));_0x10c85b>=0x3e&&(_0x10c85b-=0x3e),_0x22337e+=_0x5c2140[_0x10c85b];}return _0x22337e;}function _0x538f31(){const _0x392bf8=_0x5346d8['split']('.');if(0x3!=_0x392bf8['length'])return null;return _0x288395(_0x392bf8[0x1]);function _0x288395(_0x23b276){const _0x364a60=_0x3497d1(_0x23b276);return _0x364a60&&_0x2a845d()?_0x364a60:null;function _0x2a845d(){const _0x372f33=_0x364a60['jti'],_0x505f80=window['parseInt'](_0x372f33['substring'](_0x372f33['length']-0x8),0x10),_0x335667={..._0x364a60,'jti':_0x372f33['substring'](0x0,_0x372f33['length']-0x8)};return delete _0x335667['vc'],_0x174600(_0x335667)==_0x505f80;}}}async function _0x39dd81(){let _0x4ef29a=!0x0;try{const [_0xe2fb16,_0x2d9c7a,_0x324171]=_0x5346d8['split']('.');return _0x17df63(_0xe2fb16),await _0x1a98c9(_0xe2fb16,_0x2d9c7a,_0x324171),_0x4ef29a;}catch{return!0x1;}function _0x17df63(_0x17ec5b){const _0x48bf7f=_0x3497d1(_0x17ec5b);_0x48bf7f&&'ES256'==_0x48bf7f['alg']||(_0x4ef29a=!0x1);}async function _0x1a98c9(_0x2e4844,_0x399334,_0x2f9aa6){const _0x2c8e75=window['Uint8Array']['from'](_0x529b45(_0x2f9aa6),_0x4cac31=>_0x4cac31['charCodeAt'](0x0)),_0x5521a3=new window['TextEncoder']()['encode'](_0x2e4844+'.'+_0x399334),_0x2c0c26=window['crypto']['subtle'];if(!_0x2c0c26)return;const _0x14ad22=await _0x2c0c26['importKey']('jwk',_0x3d4718,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x2c0c26['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x14ad22,_0x2c8e75,_0x5521a3)||(_0x4ef29a=!0x1);}}function _0x3497d1(_0x3a23fd){return _0x3a23fd['startsWith']('ey')?JSON['parse'](_0x529b45(_0x3a23fd)):null;}function _0x529b45(_0x533431){return window['atob'](_0x533431['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x174600(_0xfb406){let _0x3f0288=0x1505;function _0x36cc9d(_0xdf7585){for(let _0x5dc15f=0x0;_0x5dc15f<_0xdf7585['length'];_0x5dc15f++){const _0xd7bd07=_0xdf7585['charCodeAt'](_0x5dc15f);_0x3f0288=(_0x3f0288<<0x5)+_0x3f0288+_0xd7bd07,_0x3f0288&=_0x3f0288;}}function _0x9cc4da(_0x775698){Array['isArray'](_0x775698)?_0x775698['forEach'](_0x9cc4da):_0x775698&&'object'==typeof _0x775698?Object['entries'](_0x775698)['sort']()['forEach'](([_0x43dfc8,_0x1819fc])=>{_0x36cc9d(_0x43dfc8),_0x9cc4da(_0x1819fc);}):_0x36cc9d(window['String'](_0x775698));}return _0x9cc4da(_0xfb406),_0x3f0288>>>0x0;}function _0x23036d(_0x444f5f){return _0x444f5f['toString'](0x10)['padStart'](0x8,'0');}function _0xf5ad3c(_0x45788d){return _0x45788d['split']('')['reverse']()['join']('');}function _0x3541ad(){}_0x95030d(await _0x55d9ef());}_0x17707c(_0x1d0847['editor']);}(this);}_toggleSpecialCursor(_0x1b9d6a){this['editor']['editing']['view']['change'](_0xa295d7=>{for(const _0xde3812 of this['editor']['editing']['view']['document']['roots'])_0x1b9d6a?_0xa295d7['addClass'](h,_0xde3812):_0xa295d7['removeClass'](h,_0xde3812);});}_copyFormatting(){const {editor:_0xf1f8e9}=this;_0xf1f8e9['execute'](w),_0xf1f8e9['ui']['ariaLiveAnnouncer']['announce'](L(_0xf1f8e9['locale'],'Formatting\x20copied.'));}_pasteFormatting(){const {editor:_0xde8e3e}=this,_0x505a45=_0xde8e3e['commands']['get'](w)['value'];_0xde8e3e['execute'](g,_0x505a45),_0xde8e3e['ui']['ariaLiveAnnouncer']['announce'](L(_0xde8e3e['locale'],'Pasted\x20formatting.'));}_finishPainting(){this['editor']['commands']['get'](w)['reset'](),this['stopListening'](_0x5bed2c['window']['document'],'mouseup');}},x=class extends _0x2b80dc{static get requires(){return[P,k];}static get['pluginName'](){return'FormatPainter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{y as CopyFormatCommand,x as FormatPainter,P as FormatPainterEditing,k as FormatPainterUI,p as PasteFormatCommand};
23
+ import{Command as _0x16a113,Plugin as _0xec8b73}from'@ckeditor/ckeditor5-core';import{RemoveFormatCommand as _0x1b8e09}from'@ckeditor/ckeditor5-remove-format';import{SplitButtonView as _0x5cde4c,UIModel as _0x1b253a,addListToDropdown as _0x5824c1,createDropdown as _0x22f27a}from'@ckeditor/ckeditor5-ui';import{Collection as _0x48744e,DomEmitterMixin as _0x1b575b,global as _0x258616,uid as _0x1057c5}from'@ckeditor/ckeditor5-utils';import{ClickObserver as _0x4ed0ce}from'@ckeditor/ckeditor5-engine';import{IconPaintRoller as _0x4cc0b7}from'@ckeditor/ckeditor5-icons';const w='copyFormat',g='pasteFormat',h='ck-format-painter-active';var y=class extends _0x16a113{constructor(_0x5ba964){super(_0x5ba964),this['value']=void 0x0,this['on']('change:isEnabled',(_0xef98fb,_0x39a4bb,_0x52bd4e)=>{_0x52bd4e||this['reset']();}),this['on']('change:value',()=>_0x5ba964['commands']['get'](g)['refresh']());}execute(){this['value']=this['_getFormattingAttributes']();}reset(){this['value']=void 0x0;}_getFormattingAttributes(){const _0x59250f=this['editor']['model'],_0x46da99=_0x59250f['document']['selection'];return Object['fromEntries'](Array['from'](_0x46da99['getAttributes']())['filter'](([_0xaec84f])=>_0x59250f['schema']['getAttributeProperties'](_0xaec84f)['isFormatting']));}},p=class extends _0x16a113{constructor(_0x1f0cba){super(_0x1f0cba),this['_removeFormatCommand']=new _0x1b8e09(_0x1f0cba);}execute(_0x187fbe={}){const _0x416c64=this['editor']['model'],_0x2c2521=_0x416c64['document']['selection'],_0x2d3522=Array['from'](_0x2c2521['getRanges']()),_0x36ee96=_0x2c2521['isCollapsed']?[this['_createRangeOnEntireWord'](_0x416c64,_0x2c2521)]:_0x2d3522;_0x416c64['change'](_0x4ab115=>{_0x4ab115['setSelection'](_0x36ee96),this['_removeFormatCommand']['execute']();for(const _0x2f5cfa in _0x187fbe)for(const _0x8ca604 of _0x416c64['schema']['getValidRanges'](_0x36ee96,_0x2f5cfa))_0x4ab115['setAttribute'](_0x2f5cfa,_0x187fbe[_0x2f5cfa],_0x8ca604);_0x4ab115['setSelection'](_0x2d3522);});}_createRangeOnEntireWord(_0x521ce9,_0x65da84){const _0xba3ab6=_0x521ce9['createSelection'](_0x65da84);_0x521ce9['modifySelection'](_0xba3ab6,{'unit':'word','direction':'backward'});const _0x32b7b2=_0xba3ab6['getFirstPosition']();_0x521ce9['modifySelection'](_0xba3ab6,{'unit':'word','direction':'forward'});const _0x5c84e0=_0xba3ab6['getLastPosition']();return _0x521ce9['createRange'](_0x32b7b2,_0x5c84e0);}},P=class extends _0xec8b73{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'FormatPainterEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3f1177=this['editor'];_0x3f1177['commands']['add'](w,new y(_0x3f1177)),_0x3f1177['commands']['add'](g,new p(_0x3f1177)),this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x136354=[this['editor']];for(const _0x215a90 of _0x136354){let _0x27efb4;for(const _0x32e9f0 in _0x215a90){const _0x4bf768=_0x32e9f0,_0x121463=_0x215a90[_0x4bf768];if('formatPainterLicenseKeyValid'==_0x121463||'formatPainterLicenseKeyInvalid'==_0x121463||'formatPainterLicenseKeyExpired'==_0x121463||'formatPainterLicenseKeyDomainLimit'==_0x121463||'formatPainterLicenseKeyNotAllowed'==_0x121463||'formatPainterLicenseKeyEvaluationLimit'==_0x121463||'formatPainterLicenseKeyUsageLimit'==_0x121463){delete _0x215a90[_0x4bf768],_0x27efb4=_0x121463,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'formatPainterLicenseKeyInvalid'==_0x27efb4&&_0x215a90['_showLicenseError']('invalid'),'formatPainterLicenseKeyExpired'==_0x27efb4&&_0x215a90['_showLicenseError']('expired'),'formatPainterLicenseKeyDomainLimit'==_0x27efb4&&_0x215a90['_showLicenseError']('domainLimit'),'formatPainterLicenseKeyNotAllowed'==_0x27efb4&&_0x215a90['_showLicenseError']('featureNotAllowed','FormatPainter'),'formatPainterLicenseKeyEvaluationLimit'==_0x27efb4&&_0x215a90['_showLicenseError']('evaluationLimit'),'formatPainterLicenseKeyUsageLimit'==_0x27efb4&&_0x215a90['_showLicenseError']('usageLimit');}},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}};function L(_0x405176,_0x54cf0d){const t=_0x405176['t'];switch(_0x54cf0d){case'Paint\x20formatting':return t('Paint\x20formatting');case'Copy\x20text\x20formatting':return t('Copy\x20text\x20formatting');case'Paste\x20text\x20formatting':return t('Paste\x20text\x20formatting');case'Continuous\x20painting':return t('Continuous\x20painting');case'Keeps\x20the\x20painter\x20on\x20after\x20setting\x20the\x20formatting.':return t('Keeps\x20the\x20painter\x20on\x20after\x20setting\x20the\x20formatting.');case'Formatting\x20copied.':return t('Formatting\x20copied.');case'Pasted\x20formatting.':return t('Pasted\x20formatting.');case'Painting\x20cancelled.':return t('Painting\x20cancelled.');default:return _0x54cf0d;}}const v=/* #__PURE__ -- @preserve */
24
+ _0x1b575b(_0xec8b73);var k=class extends v{static get['pluginName'](){return'FormatPainterUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3b37c0=this['editor'];_0x3b37c0['editing']['view']['addObserver'](_0x4ed0ce),_0x3b37c0['accessibility']['addKeystrokeInfos']({'keystrokes':[{'label':L(_0x3b37c0['locale'],'Copy\x20text\x20formatting'),'keystroke':'Ctrl+Alt+C'},{'label':L(_0x3b37c0['locale'],'Paste\x20text\x20formatting'),'keystroke':'Ctrl+Alt+V'}]}),_0x3b37c0['ui']['componentFactory']['add']('formatPainter',_0x350401=>{const _0x26ecb3=_0x22f27a(_0x350401,_0x5cde4c),_0x1dfcb1=_0x3b37c0['commands']['get'](w);_0x26ecb3['buttonView']['set']({'label':L(_0x3b37c0['locale'],'Paint\x20formatting'),'icon':_0x4cc0b7,'keystroke':'Ctrl+Alt+C','tooltip':!0x0}),_0x26ecb3['class']='ck-format-painter-dropdown',_0x1dfcb1&&(_0x26ecb3['bind']('isEnabled')['to'](_0x1dfcb1,'isEnabled'),this['listenTo'](_0x1dfcb1,'change:isEnabled',(_0x2bec4c,_0x29b9ee,_0x256ae6)=>{_0x256ae6||this['_finishPainting']();}),_0x26ecb3['buttonView']['bind']('isOn')['to'](_0x1dfcb1,'value',_0x30a007=>!!_0x30a007),this['listenTo'](_0x3b37c0,'destroy',()=>this['_toggleSpecialCursor'](!0x1)),this['listenTo'](_0x1dfcb1,'change:value',(_0x4fbeef,_0x442581,_0x1679ad)=>{this['_toggleSpecialCursor'](!!_0x1679ad);}));const _0x258803=new _0x1b253a({'withText':!0x0,'label':L(_0x3b37c0['locale'],'Continuous\x20painting'),'tooltip':L(_0x3b37c0['locale'],'Keeps\x20the\x20painter\x20on\x20after\x20setting\x20the\x20formatting.'),'isOn':!0x1,'role':'menuitemcheckbox'});_0x5824c1(_0x26ecb3,new _0x48744e([{'type':'switchbutton','model':_0x258803}]),{'role':'menu'});const _0x576c62=()=>{this['_copyFormatting'](),this['listenTo'](_0x258616['window']['document'],'mouseup',()=>{this['_pasteFormatting'](),_0x258803['isOn']||this['_finishPainting']();});};return this['listenTo'](_0x26ecb3,'execute',()=>{_0x258803['isOn']=!_0x258803['isOn'];}),this['listenTo'](_0x26ecb3['buttonView'],'execute',()=>{_0x3b37c0['editing']['view']['focus'](),_0x26ecb3['buttonView']['isOn']?this['_finishPainting']():_0x576c62();}),_0x3b37c0['keystrokes']['set']('Ctrl+Alt+C',(_0x1030e7,_0xb7bd83)=>{_0x576c62(),_0x258803['isOn']=!0x0,_0xb7bd83();},{'priority':'high'}),_0x3b37c0['keystrokes']['set']('Ctrl+Alt+V',(_0x3a6fef,_0x9c04c2)=>{_0x26ecb3['buttonView']['isOn']&&(this['_pasteFormatting'](),_0x258803['isOn']||this['_finishPainting'](),_0x9c04c2());},{'priority':'high'}),_0x3b37c0['keystrokes']['set']('Esc',(_0x33e60e,_0x2eafce)=>{_0x26ecb3['buttonView']['isOn']&&(_0x258803['isOn']=!0x1,this['_finishPainting'](),_0x3b37c0['ui']['ariaLiveAnnouncer']['announce'](L(_0x3b37c0['locale'],'Painting\x20cancelled.')),_0x2eafce());}),_0x26ecb3;});}afterInit(){!async function(_0x16e9b5){const _0x4db100='un0NFQUoX1evzk3yMEfwl7TxbDrisOZaWtKq52P98dchBVpjS4mYLC6gJIHGRA',_0x418065=0x79440,_0x31bd28={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x2ecabb(_0x560431){const _0x1fedb3=new window['Promise'](_0xdd2cb2=>{_0x560431['once']('ready',_0xdd2cb2);}),_0x17066c=window['Date']['now'](),_0x16aa92=_0x560431['config']['get']('licenseKey');async function _0x44febc(){let _0x587e19,_0x2de406=null,_0x51de88=null;try{return'GPL'==_0x16aa92?'NotAllowed':(_0x587e19=_0x3ffc80(),_0x587e19?(_0x587e19['usageEndpoint']&&(_0x51de88=_0x384480(_0x587e19['usageEndpoint'],_0x587e19['jti'])),await _0x1634bd()?_0x2b1816()?_0x2a1e26()?'Expired':_0x4b3fa5()?('evaluation'==_0x587e19['licenseType']&&(_0x2de406=_0x1f9d0a('EvaluationLimit')),await _0x4248fe()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x2a1e26(){const _0x31c69a=['evaluation','trial']['includes'](_0x587e19['licenseType'])?_0x17066c/0x3e8:0xe10*_0x418065;return _0x587e19['exp']<_0x31c69a;}function _0x2b1816(){const _0x4b470d=_0x587e19['features'];return!!_0x4b470d&&(!!_0x4b470d['includes']('*')||(!!_0x4b470d['includes']('FP')||(!!_0x4b470d['includes']('PP')||!(!_0x4b470d['includes']('TRILIUM')||!_0x3ccb00()))));}function _0x4b3fa5(){const _0xa45e27=_0x587e19['licensedHosts'];if(!_0xa45e27||0x0==_0xa45e27['length'])return!0x0;const {hostname:_0xde66f5}=new URL(window['location']['href']);if(_0xa45e27['includes'](_0xde66f5))return!0x0;const _0x47c7a8=_0xde66f5['split']('.');return _0xa45e27['filter'](_0x4e6498=>_0x4e6498['includes']('*'))['map'](_0x34a5f8=>_0x34a5f8['split']('.'))['filter'](_0x4272ad=>_0x4272ad['length']<=_0x47c7a8['length'])['map'](_0xd20b1a=>Array(_0x47c7a8['length']-_0xd20b1a['length'])['fill']('*'===_0xd20b1a[0x0]?'*':'')['concat'](_0xd20b1a))['some'](_0x333c08=>_0x47c7a8['every']((_0x2f1149,_0x2cd0c9)=>_0x333c08[_0x2cd0c9]===_0x2f1149||'*'===_0x333c08[_0x2cd0c9]));}function _0x4248fe(){return _0x2de406&&_0x51de88?new window['Promise']((_0x3bb896,_0x563643)=>{_0x2de406['then'](_0x3bb896,_0x563643),_0x51de88['then'](_0x23f750=>{'Valid'!=_0x23f750&&_0x3bb896(_0x23f750);},_0x563643);}):_0x2de406||_0x51de88||'Valid';}}function _0x384480(_0x4c2913,_0x83bd60){return new window['Promise'](_0x325ed2=>{if(_0x496103())return _0x325ed2('Valid');_0x392369(),_0x560431['decorate']('_sendUsageRequest');let _0x18aed8=!0x1;const _0x1f285a=_0x1057c5();function _0x17b82a(_0x476694){return!!_0x476694&&('object'==typeof _0x476694||'function'==typeof _0x476694)&&'function'==typeof _0x476694['then']&&'function'==typeof _0x476694['catch'];}function _0x5e1fea(_0x120183){_0x1daff9(_0x120183)['then'](_0x1711b5=>_0x1711b5&&'ok'==_0x1711b5['status']?_0x5b0532(_0x48c509(_0x1f285a+_0x83bd60))!=_0x1711b5['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x3cfc9b=>(_0x351b96(),_0x3cfc9b),()=>{const _0x17f38c=_0x15dd82();return null==_0x17f38c?(_0x351b96(),'Valid'):_0x17066c-_0x17f38c>0x240c8400?'UsageLimit':'Valid';})['then'](_0x325ed2)['catch'](()=>{_0x325ed2('UsageLimit');});const _0x46952c=0x36ee80;function _0x351b96(){const _0x26bebd='llct-'+_0x5b0532(_0x48c509(_0x4c2913)),_0x514657=_0x1fd7e9(_0x5b0532(window['Math']['ceil'](_0x17066c/_0x46952c)));window['localStorage']['setItem'](_0x26bebd,_0x514657);}function _0x15dd82(){const _0x516ba1='llct-'+_0x5b0532(_0x48c509(_0x4c2913)),_0xddebd7=window['localStorage']['getItem'](_0x516ba1);return _0xddebd7?window['parseInt'](_0x1fd7e9(_0xddebd7),0x10)*_0x46952c:null;}function _0x1daff9(_0x4dd31c){return new window['Promise']((_0x2d39d2,_0x43881b)=>{_0x4dd31c['then'](_0x2d39d2,_0x43881b),window['setTimeout'](_0x43881b,0x1d4c0);});}}_0x560431['on']('_sendUsageRequest',(_0xba28c1,_0x5df64c)=>{if(_0x5df64c[0x0]!=_0x4c2913)return _0x325ed2('UsageLimit');_0x5df64c[0x1]={..._0x5df64c[0x1],'requestId':_0x1f285a};},{'priority':'high'}),_0x560431['on']('_sendUsageRequest',_0x45b889=>{_0x17b82a(_0x45b889['return'])&&(_0x18aed8=!0x0,_0x5e1fea(_0x45b889['return']));},{'priority':'low'}),_0x1fedb3['then'](()=>{_0x18aed8||_0x325ed2('UsageLimit');});});function _0x496103(){return'auto'==_0x560431['editing']['view']['_overlayModeHint'];}function _0x392369(){_0x560431['editing']['view']['_overlayModeHint']='auto';}}function _0x1f9d0a(_0x580a20){const _0x21ef1f=[new window['Promise'](_0x1db7d2=>setTimeout(_0x1db7d2,0x93ecc)),_0x1fedb3['then'](()=>new window['Promise'](_0x24040a=>{let _0x81c470=0x0;_0x560431['model']['on']('applyOperation',(_0x131788,_0x1942e5)=>{_0x1942e5[0x0]['isDocumentOperation']&&_0x81c470++,0x5e8==_0x81c470&&(_0x24040a(),_0x131788['off']());});}))];return window['Promise']['race'](_0x21ef1f)['then'](()=>_0x580a20);}async function _0x2aca13(){await _0x1fedb3,_0x560431['model']['change']=_0x383db4,_0x560431['model']['enqueueChange']=_0x383db4,_0x560431['enableReadOnlyMode']('model');}function _0x3ccb00(){return window['glob']&&window['glob']['triliumVersion'];}function _0x4c51f0(_0x21e283){const _0x544dbf=_0x70a0bf();_0x560431[_0x544dbf]='formatPainterLicenseKey'+_0x21e283,'Valid'!=_0x21e283&&_0x2aca13();}function _0x70a0bf(){const _0x19c360=window['String'](window['performance']['now']())['replace']('.','');let _0xe021c4='u';for(let _0x2c31b9=0x0;_0x2c31b9<_0x19c360['length'];_0x2c31b9+=0x2){let _0x5419b6=window['parseInt'](_0x19c360['substring'](_0x2c31b9,_0x2c31b9+0x2));_0x5419b6>=0x3e&&(_0x5419b6-=0x3e),_0xe021c4+=_0x4db100[_0x5419b6];}return _0xe021c4;}function _0x3ffc80(){const _0x2d66c8=_0x16aa92['split']('.');if(0x3!=_0x2d66c8['length'])return null;return _0x156923(_0x2d66c8[0x1]);function _0x156923(_0xafeee6){const _0x2a1b30=_0x1988f0(_0xafeee6);return _0x2a1b30&&_0x989bee()?_0x2a1b30:null;function _0x989bee(){const _0x1ca07a=_0x2a1b30['jti'],_0x5d2be4=window['parseInt'](_0x1ca07a['substring'](_0x1ca07a['length']-0x8),0x10),_0x3b9506={..._0x2a1b30,'jti':_0x1ca07a['substring'](0x0,_0x1ca07a['length']-0x8)};return delete _0x3b9506['vc'],_0x48c509(_0x3b9506)==_0x5d2be4;}}}async function _0x1634bd(){let _0x3fe101=!0x0;try{const [_0x31f2a7,_0x1de097,_0x12dcea]=_0x16aa92['split']('.');return _0x4c62b0(_0x31f2a7),await _0x338920(_0x31f2a7,_0x1de097,_0x12dcea),_0x3fe101;}catch{return!0x1;}function _0x4c62b0(_0x45aa50){const _0x239229=_0x1988f0(_0x45aa50);_0x239229&&'ES256'==_0x239229['alg']||(_0x3fe101=!0x1);}async function _0x338920(_0x32818c,_0x3f6304,_0x57e84e){const _0x32dc4c=window['Uint8Array']['from'](_0xe18a5a(_0x57e84e),_0x5aed5e=>_0x5aed5e['charCodeAt'](0x0)),_0x498240=new window['TextEncoder']()['encode'](_0x32818c+'.'+_0x3f6304),_0x1104e9=window['crypto']['subtle'];if(!_0x1104e9)return;const _0x136559=await _0x1104e9['importKey']('jwk',_0x31bd28,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x1104e9['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x136559,_0x32dc4c,_0x498240)||(_0x3fe101=!0x1);}}function _0x1988f0(_0x17459f){return _0x17459f['startsWith']('ey')?JSON['parse'](_0xe18a5a(_0x17459f)):null;}function _0xe18a5a(_0x22bdff){return window['atob'](_0x22bdff['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x48c509(_0x37112b){let _0x32fa2f=0x1505;function _0x467b8d(_0x336243){for(let _0x216356=0x0;_0x216356<_0x336243['length'];_0x216356++){const _0x4de188=_0x336243['charCodeAt'](_0x216356);_0x32fa2f=(_0x32fa2f<<0x5)+_0x32fa2f+_0x4de188,_0x32fa2f&=_0x32fa2f;}}function _0x5450fb(_0x3c1c8c){Array['isArray'](_0x3c1c8c)?_0x3c1c8c['forEach'](_0x5450fb):_0x3c1c8c&&'object'==typeof _0x3c1c8c?Object['entries'](_0x3c1c8c)['sort']()['forEach'](([_0xc9f806,_0x9ca512])=>{_0x467b8d(_0xc9f806),_0x5450fb(_0x9ca512);}):_0x467b8d(window['String'](_0x3c1c8c));}return _0x5450fb(_0x37112b),_0x32fa2f>>>0x0;}function _0x5b0532(_0x1e0cd1){return _0x1e0cd1['toString'](0x10)['padStart'](0x8,'0');}function _0x1fd7e9(_0x1873ae){return _0x1873ae['split']('')['reverse']()['join']('');}function _0x383db4(){}_0x4c51f0(await _0x44febc());}_0x2ecabb(_0x16e9b5['editor']);}(this);}_toggleSpecialCursor(_0x371585){this['editor']['editing']['view']['change'](_0x8aa7d6=>{for(const _0x19f252 of this['editor']['editing']['view']['document']['roots'])_0x371585?_0x8aa7d6['addClass'](h,_0x19f252):_0x8aa7d6['removeClass'](h,_0x19f252);});}_copyFormatting(){const {editor:_0x43246e}=this;_0x43246e['execute'](w),_0x43246e['ui']['ariaLiveAnnouncer']['announce'](L(_0x43246e['locale'],'Formatting\x20copied.'));}_pasteFormatting(){const {editor:_0x37e673}=this,_0x525ac2=_0x37e673['commands']['get'](w)['value'];_0x37e673['execute'](g,_0x525ac2),_0x37e673['ui']['ariaLiveAnnouncer']['announce'](L(_0x37e673['locale'],'Pasted\x20formatting.'));}_finishPainting(){this['editor']['commands']['get'](w)['reset'](),this['stopListening'](_0x258616['window']['document'],'mouseup');}},x=class extends _0xec8b73{static get requires(){return[P,k];}static get['pluginName'](){return'FormatPainter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{y as CopyFormatCommand,x as FormatPainter,P as FormatPainterEditing,k as FormatPainterUI,p as PasteFormatCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-format-painter",
3
- "version": "48.5.0-alpha.4",
3
+ "version": "48.5.0-alpha.5",
4
4
  "description": "Format painter feature for CKEditor 5.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -21,12 +21,12 @@
21
21
  "./package.json": "./package.json"
22
22
  },
23
23
  "dependencies": {
24
- "@ckeditor/ckeditor5-core": "48.5.0-alpha.4",
25
- "@ckeditor/ckeditor5-engine": "48.5.0-alpha.4",
26
- "@ckeditor/ckeditor5-icons": "48.5.0-alpha.4",
27
- "@ckeditor/ckeditor5-remove-format": "48.5.0-alpha.4",
28
- "@ckeditor/ckeditor5-ui": "48.5.0-alpha.4",
29
- "@ckeditor/ckeditor5-utils": "48.5.0-alpha.4"
24
+ "@ckeditor/ckeditor5-core": "48.5.0-alpha.5",
25
+ "@ckeditor/ckeditor5-engine": "48.5.0-alpha.5",
26
+ "@ckeditor/ckeditor5-icons": "48.5.0-alpha.5",
27
+ "@ckeditor/ckeditor5-remove-format": "48.5.0-alpha.5",
28
+ "@ckeditor/ckeditor5-ui": "48.5.0-alpha.5",
29
+ "@ckeditor/ckeditor5-utils": "48.5.0-alpha.5"
30
30
  },
31
31
  "files": [
32
32
  "dist",