@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
23 lines • 6.32 kB
JavaScript
/*
* Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
*
*
*
*
* +---------------------------------------------------------------------------------+
* | |
* | Hello stranger! |
* | |
* | |
* | What you're currently looking at is the source code of a legally protected, |
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
* | are forbidden and will result in legal consequences. |
* | |
* | |
* +---------------------------------------------------------------------------------+
*
*
*
*
*/
import{ListItemView as _0x16e3a2,IconView as _0x45b0d5,View as _0x1e0229,ViewCollection as _0x4c6d57,ButtonView as _0x250619,clickOutsideHandler as _0x539421}from'ckeditor5/src/ui.js';import{IconChevronRight as _0x2a68a8}from'ckeditor5/src/icons.js';import{AIReviewModeFormManagerView as _0x190a86}from'./form/aireviewmodeformmanager.js';import{AIReviewModeCustomCheckView as tc}from'./aireviewmodecustomcheckview.js';export class AIReviewModeReviewCommandListItemView extends _0x16e3a2{['_formItemsCollection']=new _0x4c6d57();['_customCheckView']=null;constructor(_0x5b93e6,_0x408ac5,_0x3fa72c){super(_0x5b93e6),this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x408ac5['isParameterized']);const _0x1f9855=this['_createIconView']();this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-review-mode__check-list-item',this['bindTemplate']['if']('isParametrizedViewOpen','ck-ai-review-mode__check-list-item_selected',_0x53c771=>_0x53c771),this['bindTemplate']['if']('isListItemRendered','ck-ai-review-mode__check-list-item_rendered',_0x641aeb=>_0x641aeb)],'style':{'--ck-ai-review-check-list-item-index':_0x3fa72c}},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai-review-mode__check-list-item-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-review-mode__check-list-item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-review-mode__check-list-item-title']},'children':[{'tag':'span','attributes':{'class':['ck-ai-review-mode__check-list-item-title-text']},'children':[{'text':_0x408ac5['title']}]},_0x1f9855]},{'tag':'div','attributes':{'class':['ck-ai-review-mode__check-list-item-description']},'children':[{'text':_0x408ac5['description']}]}]}]},..._0x408ac5['isParameterized']?[this['_createParameterizedView'](_0x408ac5)]:[],...'custom'===_0x408ac5['id']?[this['_createCustomView'](_0x408ac5)]:[]]}),this['on']('click',()=>{_0x408ac5['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x408ac5['id']});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x539421({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x4c533c=>{_0x4c533c['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x540ce4=new _0x45b0d5();return _0x540ce4['content']=_0x2a68a8,_0x540ce4['extendTemplate']({'attributes':{'class':['ck-ai-review-mode__check-list-item-title-icon']}}),_0x540ce4;}['_createParameterizedView'](_0x2a7221){const _0x420776=new _0x1e0229(),_0x17c50c=this['_createFormView'](_0x2a7221);return _0x420776['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-review-mode__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x6ad98a=>!_0x6ad98a)]},'children':[_0x17c50c]}),_0x420776;}['_createFormView'](_0x4eb1d2){const _0xd6030f=new _0x1e0229(),_0x16165e=Array['isArray'](_0x4eb1d2['options'])?_0x4eb1d2['options']:[],_0x3c3518=new _0x250619(this['locale']),t=this['locale']['t'];_0x3c3518['set']({'label':t('Submit'),'withText':!0x0,'class':'ck-ai-button-primary'}),_0x3c3518['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0xe3b107=>{_0xe3b107['stopPropagation']();})}}),_0x3c3518['on']('execute',()=>{const _0x24bd4e=[],_0x56d035={};this['_formItemsCollection']['forEach'](_0x6859b6=>{_0x24bd4e['push'](_0x6859b6['value']),_0x4eb1d2['useArgs']&&_0x4eb1d2['options']&&(_0x56d035[_0x6859b6['argsKey']]=_0x6859b6['value']);}),this['fire']('runReviewCheck',{'id':_0x4eb1d2['id'],'params':_0x24bd4e['length']?_0x24bd4e:void 0x0,'args':Object['keys'](_0x56d035)['length']?_0x56d035:void 0x0});});const _0xcb0017=_0x16165e['length'];return _0x16165e['forEach']((_0x444cbc,_0x339f5b)=>{const _0x1e5b0f=_0x339f5b===_0xcb0017-0x1;this['_formItemsCollection']['add'](new _0x190a86(this['locale'],_0x444cbc,_0x1e5b0f?_0x3c3518:null));}),_0xd6030f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-review-mode__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0xd6030f;}['_createCustomView'](_0x393612){return this['_customCheckView']=new tc(this['locale'],_0x393612),this['_customCheckView']['extendTemplate']({'attributes':{'class':['ck-ai-review-mode__check-list-item-parameterized','ck-ai-review-mode__check-list-item-parameterized_custom',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x32ac3c=>!_0x32ac3c)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x35d258,_0x168dee,_0x31a976)=>{_0x31a976||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}