@ckeditor/ckeditor5-ai 0.0.1 → 40.1.0
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.
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +7 -7
- package/README.md +32 -3
- package/build/ai.js +5 -0
- package/build/translations/af.js +1 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/bs.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/es-co.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/jv.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +23 -0
- package/lang/contexts.json +54 -0
- package/lang/translations/af.po +226 -0
- package/lang/translations/ar.po +226 -0
- package/lang/translations/bg.po +226 -0
- package/lang/translations/bn.po +226 -0
- package/lang/translations/bs.po +226 -0
- package/lang/translations/ca.po +226 -0
- package/lang/translations/cs.po +226 -0
- package/lang/translations/da.po +226 -0
- package/lang/translations/de-ch.po +226 -0
- package/lang/translations/de.po +226 -0
- package/lang/translations/el.po +226 -0
- package/lang/translations/en-au.po +226 -0
- package/lang/translations/en.po +226 -0
- package/lang/translations/es-co.po +226 -0
- package/lang/translations/es.po +226 -0
- package/lang/translations/et.po +226 -0
- package/lang/translations/fa.po +226 -0
- package/lang/translations/fi.po +226 -0
- package/lang/translations/fr.po +226 -0
- package/lang/translations/gl.po +226 -0
- package/lang/translations/he.po +226 -0
- package/lang/translations/hi.po +226 -0
- package/lang/translations/hr.po +226 -0
- package/lang/translations/hu.po +226 -0
- package/lang/translations/id.po +226 -0
- package/lang/translations/it.po +226 -0
- package/lang/translations/ja.po +226 -0
- package/lang/translations/jv.po +226 -0
- package/lang/translations/ko.po +226 -0
- package/lang/translations/lt.po +226 -0
- package/lang/translations/lv.po +226 -0
- package/lang/translations/ms.po +226 -0
- package/lang/translations/nl.po +226 -0
- package/lang/translations/no.po +226 -0
- package/lang/translations/pl.po +226 -0
- package/lang/translations/pt-br.po +226 -0
- package/lang/translations/pt.po +226 -0
- package/lang/translations/ro.po +226 -0
- package/lang/translations/ru.po +226 -0
- package/lang/translations/sk.po +226 -0
- package/lang/translations/sr-latn.po +226 -0
- package/lang/translations/sr.po +226 -0
- package/lang/translations/sv.po +226 -0
- package/lang/translations/th.po +226 -0
- package/lang/translations/tk.po +226 -0
- package/lang/translations/tr.po +226 -0
- package/lang/translations/ug.po +226 -0
- package/lang/translations/uk.po +226 -0
- package/lang/translations/ur.po +226 -0
- package/lang/translations/uz.po +226 -0
- package/lang/translations/vi.po +226 -0
- package/lang/translations/zh-cn.po +226 -0
- package/lang/translations/zh.po +226 -0
- package/package.json +38 -7
- package/src/aiassistant.d.ts +458 -0
- package/src/aiassistant.js +23 -0
- package/src/aiassistantediting.d.ts +45 -0
- package/src/aiassistantediting.js +23 -0
- package/src/aiassistantui.d.ts +44 -0
- package/src/aiassistantui.js +23 -0
- package/src/aiconnector.d.ts +45 -0
- package/src/aiconnector.js +23 -0
- package/src/augmentation.d.ts +26 -0
- package/src/augmentation.js +23 -0
- package/src/index.d.ts +9 -0
- package/src/index.js +23 -0
- package/src/ui/aiassistantcontroller.d.ts +96 -0
- package/src/ui/aiassistantcontroller.js +23 -0
- package/src/ui/dropdown/aicommandslistview.d.ts +22 -0
- package/src/ui/dropdown/aicommandslistview.js +23 -0
- package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +29 -0
- package/src/ui/dropdown/buttonlabelwithhighlightview.js +23 -0
- package/src/ui/dropdown/labelwithhighlightview.d.ts +25 -0
- package/src/ui/dropdown/labelwithhighlightview.js +23 -0
- package/src/ui/form/aiformcontentarea.d.ts +48 -0
- package/src/ui/form/aiformcontentarea.js +23 -0
- package/src/ui/form/aiformerrorview.d.ts +26 -0
- package/src/ui/form/aiformerrorview.js +23 -0
- package/src/ui/form/aiformpromptview.d.ts +46 -0
- package/src/ui/form/aiformpromptview.js +23 -0
- package/src/ui/form/aiformtoolbarview.d.ts +54 -0
- package/src/ui/form/aiformtoolbarview.js +23 -0
- package/src/ui/form/aiformview.d.ts +142 -0
- package/src/ui/form/aiformview.js +23 -0
- package/src/ui/form/aihistorylistitemview.d.ts +18 -0
- package/src/ui/form/aihistorylistitemview.js +23 -0
- package/src/ui/form/aihistorylistview.d.ts +35 -0
- package/src/ui/form/aihistorylistview.js +23 -0
- package/src/ui/form/prompthistory.d.ts +20 -0
- package/src/ui/form/prompthistory.js +23 -0
- package/src/ui/showaiassistantcommand.d.ts +26 -0
- package/src/ui/showaiassistantcommand.js +23 -0
- package/src/utils/common-translations.d.ts +9 -0
- package/src/utils/common-translations.js +23 -0
- package/theme/ai-dropdown.css +37 -0
- package/theme/ai-form.css +250 -0
- package/theme/ai.css +103 -0
- package/theme/icons/copy.svg +1 -0
- package/theme/icons/error.svg +1 -0
- package/theme/icons/magic-wand.svg +1 -0
- package/theme/icons/robot-pencil.svg +1 -0
- package/theme/icons/submit.svg +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/labelwithhighlightview
|
|
7
|
+
*/
|
|
8
|
+
import { type LabelView, HighlightedTextView } from 'ckeditor5/src/ui';
|
|
9
|
+
/**
|
|
10
|
+
* A label view that can highlight a text fragment.
|
|
11
|
+
*/
|
|
12
|
+
export default class LabelWithHighlightView extends HighlightedTextView implements LabelView {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
for: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x4e24=['for','set','bindTemplate','ck-label','ck-editor__label_'];(function(_0x46b2ac,_0x4e2413){const _0x567911=function(_0xff3b0c){while(--_0xff3b0c){_0x46b2ac['push'](_0x46b2ac['shift']());}};_0x567911(++_0x4e2413);}(_0x4e24,0x76));const _0x5679=function(_0x46b2ac,_0x4e2413){_0x46b2ac=_0x46b2ac-0x0;let _0x567911=_0x4e24[_0x46b2ac];return _0x567911;};import{HighlightedTextView as _0x2492ab}from'ckeditor5/src/ui';import{uid as _0x4ca17f}from'ckeditor5/src/utils';export default class k extends _0x2492ab{constructor(){super(),this[_0x5679('0x3')](_0x5679('0x2'),void 0x0);const _0x1c6f91=this[_0x5679('0x4')];this['id']=_0x5679('0x1')+_0x4ca17f(),this['extendTemplate']({'attributes':{'class':['ck',_0x5679('0x0')],'id':this['id'],'for':_0x1c6f91['to'](_0x5679('0x2'))}});}}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/aiformcontentarea
|
|
7
|
+
*/
|
|
8
|
+
import { type Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { View, ButtonView } from 'ckeditor5/src/ui';
|
|
10
|
+
/**
|
|
11
|
+
* A class representing the text area view of the AI assistant.
|
|
12
|
+
*/
|
|
13
|
+
export default class AIFormContentArea extends View {
|
|
14
|
+
/**
|
|
15
|
+
* The value which is displayed in the content field.
|
|
16
|
+
*
|
|
17
|
+
* @observable
|
|
18
|
+
*/
|
|
19
|
+
value: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Controls whether the content area is visible.
|
|
22
|
+
*
|
|
23
|
+
* @observable
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
isVisible: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Indicates if the content area is during processing which can change inner values.
|
|
29
|
+
*/
|
|
30
|
+
isProcessing: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The textarea view.
|
|
33
|
+
*/
|
|
34
|
+
contentFieldView: ContentFieldView;
|
|
35
|
+
/**
|
|
36
|
+
* The copy button displayed in the bottom-right corner of text area.
|
|
37
|
+
*/
|
|
38
|
+
copyButtonView: ButtonView;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
constructor(locale: Locale, extraCssClass?: string);
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
render(): void;
|
|
47
|
+
focus(): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x37da=['left','focus','write','locale','.ck-ai-form__loader','copy','createRange','firstElementChild','listenTo','div','ck-ai-form__content-area--processing','ck-ai-form__content-area-wrapper','render','ck-ai-form__copy-button','appendChild','lastElementChild','remove','contentFieldView','_createLoader','-9999px','_createCopyButton','<span>]</span>','ck-ai-form__copy-button-wrapper','wheel','AI\x20is\x20writing...','scrollHeight','text/html','bind','value','bindTemplate','execute','setTemplate','ck-reset_all-excluded','absolute','isVisible','setContent','isProcessing','_copyHTMLToClipboard','body','ClipboardItem','change:isProcessing','class','Copy','execCommand','getSelection','isEnabled','ck-ai-form__loader','loaderView','element','text/plain','copyButtonView','addRange','textContent','style','\x20ck-ai-form__copy-button--copied','<span>[</span>','ck-ai-form__content-field','ck-ai-form__content-area','innerHTML','set','appendLoader','ck-hidden','mousedown','querySelector','createElement','ck-content'];(function(_0x1ef129,_0x37da3b){const _0x2d5b3f=function(_0xd91507){while(--_0xd91507){_0x1ef129['push'](_0x1ef129['shift']());}};_0x2d5b3f(++_0x37da3b);}(_0x37da,0xe6));const _0x2d5b=function(_0x1ef129,_0x37da3b){_0x1ef129=_0x1ef129-0x0;let _0x2d5b3f=_0x37da[_0x1ef129];return _0x2d5b3f;};import{global as _0x1881ef}from'ckeditor5/src/utils';import{View as _0x1a3271,ButtonView as _0x2837dc,SpinnerView as _0x46bf30}from'ckeditor5/src/ui';import _0x438ad8 from'../../../theme/icons/copy.svg';import{getTranslation as _0x3c0cad}from'../../utils/common-translations';import{icons as _0x257af4}from'ckeditor5/src/core';export default class J extends _0x1a3271{constructor(_0x406bcb,_0x3ee16e=''){super(_0x406bcb),this[_0x2d5b('0x1b')]({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x2d0334=this[_0x2d5b('0x3f')];this[_0x2d5b('0x33')]=new ContentFieldView(_0x406bcb,_0x3ee16e),this['copyButtonView']=this[_0x2d5b('0x36')](),this[_0x2d5b('0x41')]({'tag':_0x2d5b('0x2b'),'attributes':{'class':['ck',_0x2d5b('0x2d'),_0x2d0334['if']('isVisible',_0x2d5b('0x1d'),_0x3aabae=>!_0x3aabae)],'tabindex':'-1'},'children':[{'tag':_0x2d5b('0x2b'),'attributes':{'class':['ck',_0x2d5b('0x19'),_0x2d0334['if']('isProcessing',_0x2d5b('0x2c'))]},'children':[this[_0x2d5b('0x33')],{'tag':_0x2d5b('0x2b'),'attributes':{'class':['ck',_0x2d5b('0x38')]},'children':[this[_0x2d5b('0x12')]]}]}]});}[_0x2d5b('0x2e')](){super[_0x2d5b('0x2e')](),this[_0x2d5b('0x3e')]&&this['contentFieldView'][_0x2d5b('0x3')](this[_0x2d5b('0x3e')]);let _0x369a77=!0x1;this['on']('change:value',(_0x72c91e,_0x386ac2,_0x756b60)=>{const _0x7c885c=!this[_0x2d5b('0x33')][_0x2d5b('0x10')][_0x2d5b('0x1f')](_0x2d5b('0x26'));this[_0x2d5b('0x33')][_0x2d5b('0x3')](_0x756b60),this[_0x2d5b('0x4')]&&_0x7c885c&&!_0x369a77&&this[_0x2d5b('0x10')]['scrollTo']({'top':this[_0x2d5b('0x10')][_0x2d5b('0x3b')],'behavior':'smooth'});}),this['on'](_0x2d5b('0x8'),(_0x4156ab,_0x58f4f1,_0x38a753)=>{_0x369a77=!0x1,_0x38a753?(this[_0x2d5b('0x3e')]=null,this[_0x2d5b('0x33')][_0x2d5b('0x1c')]()):this[_0x2d5b('0x3e')]||this[_0x2d5b('0x33')][_0x2d5b('0x3')]('');}),this[_0x2d5b('0x2a')](this[_0x2d5b('0x10')],_0x2d5b('0x39'),()=>{_0x369a77=!0x0;}),this[_0x2d5b('0x2a')](this[_0x2d5b('0x10')],_0x2d5b('0x1e'),()=>{_0x369a77=!0x0;});}[_0x2d5b('0x23')](){this[_0x2d5b('0x10')]['focus']();}['_createCopyButton'](){const _0x423e8b=this['locale'],_0x44edf4=new _0x2837dc(this['locale']),_0x4b8c20=_0x2d5b('0x2f');return _0x44edf4[_0x2d5b('0x1b')]({'label':_0x3c0cad(_0x423e8b,_0x2d5b('0xa')),'icon':_0x438ad8,'class':_0x4b8c20,'tooltip':!0x0}),_0x44edf4['bind'](_0x2d5b('0x2'))['to'](this,'value',_0xa08e7e=>!!_0xa08e7e),_0x44edf4[_0x2d5b('0x3d')](_0x2d5b('0xd'))['to'](this,_0x2d5b('0x4'),_0x3824c8=>!_0x3824c8),_0x44edf4['on'](_0x2d5b('0x40'),()=>{this['_copyHTMLToClipboard'](this[_0x2d5b('0x33')][_0x2d5b('0x10')]),_0x44edf4['icon']=_0x257af4['check'],_0x44edf4[_0x2d5b('0x9')]=_0x4b8c20+_0x2d5b('0x16'),this[_0x2d5b('0x23')](),setTimeout(()=>{_0x44edf4['icon']=_0x438ad8,_0x44edf4['class']=_0x4b8c20;},0x3e8);}),_0x44edf4;}[_0x2d5b('0x5')](_0x2ae24e){const {window:_0x5a7dd7,document:_0x1a87b6}=_0x1881ef;if(_0x5a7dd7[_0x2d5b('0x7')]){const {Blob:_0x490df0,ClipboardItem:_0x3cc060}=_0x5a7dd7,_0x118cd8=[new _0x3cc060({'text/html':new _0x490df0([_0x2ae24e[_0x2d5b('0x1a')]],{'type':_0x2d5b('0x3c')}),'text/plain':new _0x490df0([_0x2ae24e[_0x2d5b('0x14')]||''],{'type':_0x2d5b('0x11')})})];navigator['clipboard'][_0x2d5b('0x24')](_0x118cd8);}else{const _0x56f4e0=_0x1a87b6[_0x2d5b('0x20')](_0x2d5b('0x2b'));_0x56f4e0[_0x2d5b('0x15')]['position']=_0x2d5b('0x1'),_0x56f4e0['style'][_0x2d5b('0x22')]=_0x2d5b('0x35'),_0x56f4e0[_0x2d5b('0x1a')]=_0x2d5b('0x17')+_0x2ae24e['innerHTML']+_0x2d5b('0x37'),_0x1a87b6[_0x2d5b('0x6')]['appendChild'](_0x56f4e0);const _0x322151=_0x1a87b6[_0x2d5b('0x28')]();_0x322151['setStartAfter'](_0x56f4e0[_0x2d5b('0x29')]),_0x322151['setEndBefore'](_0x56f4e0[_0x2d5b('0x31')]);const _0x583f1e=_0x5a7dd7[_0x2d5b('0xc')]();_0x583f1e['removeAllRanges'](),_0x583f1e[_0x2d5b('0x13')](_0x322151),_0x1a87b6[_0x2d5b('0xb')](_0x2d5b('0x27')),_0x56f4e0[_0x2d5b('0x32')]();}}}export class ContentFieldView extends _0x1a3271{constructor(_0xbdc529,_0x4efc61=''){super(_0xbdc529),this[_0x2d5b('0xf')]=this[_0x2d5b('0x34')](),this[_0x2d5b('0x41')]({'tag':'div','attributes':{'class':['ck',_0x2d5b('0x21'),_0x4efc61,_0x2d5b('0x0'),_0x2d5b('0x18')]}});}[_0x2d5b('0x3')](_0x5012f6){this[_0x2d5b('0x10')][_0x2d5b('0x1a')]=_0x5012f6;}[_0x2d5b('0x1c')](){this[_0x2d5b('0x10')][_0x2d5b('0x30')](this[_0x2d5b('0xf')][_0x2d5b('0x10')]);}[_0x2d5b('0x34')](){const _0x59fc02=new _0x1a3271(),_0x51a3f4=this[_0x2d5b('0x25')],_0x43144d=new _0x46bf30();return _0x43144d['isVisible']=!0x0,_0x59fc02[_0x2d5b('0x41')]({'tag':'div','attributes':{'class':['ck',_0x2d5b('0xe')]},'children':[_0x43144d,{'text':_0x3c0cad(_0x51a3f4,_0x2d5b('0x3a'))}]}),_0x59fc02[_0x2d5b('0x2e')](),_0x59fc02;}}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/aiformerrorview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { View } from 'ckeditor5/src/ui';
|
|
10
|
+
/**
|
|
11
|
+
* A class representing the error view of the AI assistant.
|
|
12
|
+
*/
|
|
13
|
+
export default class AIFormErrorView extends View {
|
|
14
|
+
/**
|
|
15
|
+
* The text of the error.
|
|
16
|
+
*
|
|
17
|
+
* @observable
|
|
18
|
+
*/
|
|
19
|
+
text: string;
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of the {@link module:ai/ui/aiformerrorview~AIFormErrorView} class.
|
|
22
|
+
*
|
|
23
|
+
* @param locale The localization services instance.
|
|
24
|
+
*/
|
|
25
|
+
constructor(locale: Locale, text?: string);
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x2199=['text','ck-ai-form__error','div','content','bindTemplate'];(function(_0x4ed82f,_0x2199a1){const _0xcf369a=function(_0x31f5d0){while(--_0x31f5d0){_0x4ed82f['push'](_0x4ed82f['shift']());}};_0xcf369a(++_0x2199a1);}(_0x2199,0x1af));const _0xcf36=function(_0x4ed82f,_0x2199a1){_0x4ed82f=_0x4ed82f-0x0;let _0xcf369a=_0x2199[_0x4ed82f];return _0xcf369a;};import{View as _0x3defb9,IconView as _0x641722}from'ckeditor5/src/ui';import _0x1e9c05 from'../../../theme/icons/error.svg';export default class Q extends _0x3defb9{constructor(_0x36e729,_0x5621a4=''){super(_0x36e729);const _0x4f2bbd=new _0x641722(),_0x32e241=this[_0xcf36('0x3')];this['set'](_0xcf36('0x4'),_0x5621a4),_0x4f2bbd[_0xcf36('0x2')]=_0x1e9c05,this['setTemplate']({'tag':_0xcf36('0x1'),'attributes':{'class':['ck',_0xcf36('0x0')]},'children':[_0x4f2bbd,{'text':_0x32e241['to'](_0xcf36('0x4'))}]});}}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/aiformpromptview
|
|
7
|
+
*/
|
|
8
|
+
import { type Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { AutocompleteView, ButtonView, type TextareaView, type AutocompleteViewConfig } from 'ckeditor5/src/ui';
|
|
10
|
+
/**
|
|
11
|
+
* A textarea field allowing to ask AI.
|
|
12
|
+
*/
|
|
13
|
+
export default class AIFormPromptView extends AutocompleteView<TextareaView> {
|
|
14
|
+
/**
|
|
15
|
+
* The submit button view.
|
|
16
|
+
*/
|
|
17
|
+
submitButtonView: ButtonView;
|
|
18
|
+
/**
|
|
19
|
+
* The button that shows and hides the history autocomplete panel.
|
|
20
|
+
*/
|
|
21
|
+
showHistoryButtonView: ButtonView;
|
|
22
|
+
/**
|
|
23
|
+
* Creates `AIFormPromptView` instance.
|
|
24
|
+
*
|
|
25
|
+
* @param locale The localization services instance.
|
|
26
|
+
* @param config Autocomplete config.
|
|
27
|
+
*/
|
|
28
|
+
constructor(locale: Locale, config: AutocompleteViewConfig<TextareaView>);
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
render(): void;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
focus(direction?: 1 | -1): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Fired when the query is submitted by the user.
|
|
40
|
+
*
|
|
41
|
+
* @eventName ~AIFormPromptView#submit
|
|
42
|
+
*/
|
|
43
|
+
export type AIFormPromptViewSubmitEvent = {
|
|
44
|
+
name: 'submit';
|
|
45
|
+
args: [query: string];
|
|
46
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x4894=['width','locale','_createShowHistoryButton','resultsView','left','minRows','fieldView','queryView','value','focusCycler','uiLanguageDirection','add','excludeScrollbarsAndBorders','isEnabled','submitButtonView','ck-ai-form__toggle-history','style','bind','focus','right','_createSubmitButton','enter','execute','isVisible','focusLast','fire','window','showHistoryButtonView','submit','filteredView','set','history','render','keystrokes','focusableChildren','fieldWrapperChildren','update','rtl','isOn','element','focusFirst','ck-ai-form__submit'];(function(_0x551fda,_0x48948b){const _0x21646c=function(_0x47268c){while(--_0x47268c){_0x551fda['push'](_0x551fda['shift']());}};_0x21646c(++_0x48948b);}(_0x4894,0x1c9));const _0x2164=function(_0x551fda,_0x48948b){_0x551fda=_0x551fda-0x0;let _0x21646c=_0x4894[_0x551fda];return _0x21646c;};import{Rect as _0x3749bf,global as _0x455126,isVisible as _0x21dfb4}from'ckeditor5/src/utils';import{AutocompleteView as _0x1e9f0c,ButtonView as _0x2bbd04}from'ckeditor5/src/ui';import{icons as _0x5597ac}from'ckeditor5/src/core';import{escape as _0x4b24d0}from'lodash-es';import{getTranslation as _0x1b8e72}from'../../utils/common-translations';import _0x3884a5 from'../../../theme/icons/submit.svg';export default class tt extends _0x1e9f0c{constructor(_0x53cf65,_0x11f8b2){super(_0x53cf65,_0x11f8b2),this['queryView']['fieldView'][_0x2164('0xa')]=0x1,this['queryView']['fieldView']['maxRows']=0x3,this[_0x2164('0x13')]=this[_0x2164('0x19')](),this[_0x2164('0x20')]=this[_0x2164('0x7')](),this[_0x2164('0x27')][_0x2164('0x10')](this[_0x2164('0x20')],0x1),this[_0x2164('0x27')]['add'](this['submitButtonView']);}[_0x2164('0x25')](){super[_0x2164('0x25')](),this[_0x2164('0xc')][_0x2164('0x28')][_0x2164('0x10')](this['showHistoryButtonView']),this['children'][_0x2164('0x10')](this['submitButtonView']),this[_0x2164('0x26')][_0x2164('0x23')](_0x2164('0x1a'),(_0x492274,_0x256922)=>{_0x492274['target']==this[_0x2164('0xc')][_0x2164('0xb')][_0x2164('0x2')]&&(this[_0x2164('0x21')](),_0x256922());});}['_createSubmitButton'](){const _0x37df3f=new _0x2bbd04(this['locale']),_0x4e9f87=this[_0x2164('0x6')];return _0x37df3f[_0x2164('0x23')]({'icon':_0x3884a5,'label':_0x1b8e72(_0x4e9f87,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':_0x2164('0x4')}),_0x37df3f['on'](_0x2164('0x1b'),()=>{this[_0x2164('0x21')]();}),_0x37df3f[_0x2164('0x16')](_0x2164('0x12'))['to'](this[_0x2164('0xc')][_0x2164('0xb')],'isEmpty',this,_0x2164('0x12'),(_0xb3bb7c,_0x4b13e1)=>!_0xb3bb7c&&_0x4b13e1),_0x37df3f;}['_createShowHistoryButton'](){const _0x566d1f=new _0x2bbd04(this['locale']),_0x41b3fb=this[_0x2164('0x8')],_0xe11ff0=this['locale'];_0x566d1f[_0x2164('0x23')]({'label':_0x1b8e72(_0xe11ff0,'History'),'withText':!0x1,'icon':_0x5597ac[_0x2164('0x24')],'tooltip':!0x0,'tooltipPosition':'sw','class':_0x2164('0x14')}),_0x566d1f[_0x2164('0x16')](_0x2164('0x1'))['to'](_0x41b3fb,_0x2164('0x1c')),_0x566d1f[_0x2164('0x16')](_0x2164('0x12'))['to'](this,_0x2164('0x12')),_0x566d1f['on'](_0x2164('0x1b'),()=>{_0x41b3fb[_0x2164('0x1c')]=!_0x41b3fb[_0x2164('0x1c')],_0x41b3fb['isVisible']?this[_0x2164('0x22')][_0x2164('0x17')]():this['focus']();});const _0x1a4e11=()=>{_0x455126[_0x2164('0x1f')]['requestAnimationFrame'](()=>{if(_0x21dfb4(this[_0x2164('0x2')])){const _0x44dc56=new _0x3749bf(this['queryView']['fieldView'][_0x2164('0x2')]),_0x1d16aa=_0x44dc56[_0x2164('0x5')],_0x7dcde9=_0x2164('0x0')===_0xe11ff0[_0x2164('0xf')]?_0x2164('0x9'):_0x2164('0x18');_0x44dc56[_0x2164('0x11')](),_0x566d1f[_0x2164('0x2')][_0x2164('0x15')][_0x7dcde9]=_0x1d16aa-_0x44dc56[_0x2164('0x5')]+0x1+'px';}});};return this['queryView'][_0x2164('0xb')]['on'](_0x2164('0x29'),_0x1a4e11),this['on'](_0x2164('0x25'),_0x1a4e11),_0x566d1f;}['submit'](){const _0x5a30c2=this[_0x2164('0xc')][_0x2164('0xb')][_0x2164('0x2')][_0x2164('0xd')];this[_0x2164('0x1e')]('submit',_0x4b24d0(_0x5a30c2));}[_0x2164('0x17')](_0xcf91a8){-0x1===_0xcf91a8?this[_0x2164('0xe')][_0x2164('0x1d')]():this[_0x2164('0xe')][_0x2164('0x3')]();}}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/aiformtoolbarview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { ToolbarView, ButtonView } from 'ckeditor5/src/ui';
|
|
10
|
+
/**
|
|
11
|
+
* The action name affecting the label of {@link ~AIFormToolbarView#replaceButton}.
|
|
12
|
+
*/
|
|
13
|
+
export declare enum AIFormToolbarViewMainAction {
|
|
14
|
+
REPLACE = "replace",
|
|
15
|
+
INSERT = "insert"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A class representing the text area view of the AI assistant.
|
|
19
|
+
*/
|
|
20
|
+
export default class AIFormToolbarView extends ToolbarView {
|
|
21
|
+
/**
|
|
22
|
+
* Controls whether the toolbar is visible.
|
|
23
|
+
*
|
|
24
|
+
* @observable
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
isVisible: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Button that is used to replace the selected content by the generated one.
|
|
30
|
+
*/
|
|
31
|
+
replaceButton: ButtonView;
|
|
32
|
+
/**
|
|
33
|
+
* Button that is used to insert the generated content below the selection.
|
|
34
|
+
*/
|
|
35
|
+
insertButton: ButtonView;
|
|
36
|
+
/**
|
|
37
|
+
* Button that is used to regenerate the response.
|
|
38
|
+
*/
|
|
39
|
+
tryAgainButton: ButtonView;
|
|
40
|
+
/**
|
|
41
|
+
* Button that is used to stop the processing of the request.
|
|
42
|
+
*/
|
|
43
|
+
stopButton: ButtonView;
|
|
44
|
+
/**
|
|
45
|
+
* The action name affecting the label of {@link #replaceButton}.
|
|
46
|
+
*
|
|
47
|
+
* @default 'replace'
|
|
48
|
+
*/
|
|
49
|
+
mainAction: AIFormToolbarViewMainAction;
|
|
50
|
+
/**
|
|
51
|
+
* @inheritDoc
|
|
52
|
+
*/
|
|
53
|
+
constructor(locale: Locale);
|
|
54
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x48b8=['stopButton','insert','items','AI_','_createButton','Try\x20again','insertButton','tryAgainButton','locale','replaceButton','set','toUpperCase','isVisible','bindTemplate','ck-button-action','bind','Insert\x20below','REPLACE','mainAction','addMany','_CONTENT'];(function(_0x47e8d6,_0x48b88b){const _0x62d03=function(_0x5c84c0){while(--_0x5c84c0){_0x47e8d6['push'](_0x47e8d6['shift']());}};_0x62d03(++_0x48b88b);}(_0x48b8,0x192));const _0x62d0=function(_0x47e8d6,_0x48b88b){_0x47e8d6=_0x47e8d6-0x0;let _0x62d03=_0x48b8[_0x47e8d6];return _0x62d03;};import{ToolbarView as _0x52f42f,ButtonView as _0x34f683}from'ckeditor5/src/ui';import{getTranslation as _0x1db11e}from'../../utils/common-translations';export var AIFormToolbarViewMainAction;!function(_0x1dfb7d){_0x1dfb7d[_0x62d0('0xe')]='replace',_0x1dfb7d['INSERT']=_0x62d0('0x13');}(AIFormToolbarViewMainAction||(AIFormToolbarViewMainAction={}));export default class ti extends _0x52f42f{constructor(_0x194ad9){super(_0x194ad9),this[_0x62d0('0x7')](_0x62d0('0x9'),!0x1),this[_0x62d0('0x7')](_0x62d0('0xf'),AIFormToolbarViewMainAction[_0x62d0('0xe')]),this[_0x62d0('0x6')]=this[_0x62d0('0x1')]('',_0x62d0('0xb')),this['replaceButton'][_0x62d0('0xc')]('label')['to'](this,_0x62d0('0xf'),_0x683105=>_0x1db11e(_0x194ad9,_0x62d0('0x0')+_0x683105[_0x62d0('0x8')]()+_0x62d0('0x11'))),this[_0x62d0('0x3')]=this['_createButton'](_0x1db11e(_0x194ad9,_0x62d0('0xd'))),this[_0x62d0('0x4')]=this['_createButton'](_0x1db11e(_0x194ad9,_0x62d0('0x2'))),this[_0x62d0('0x12')]=this[_0x62d0('0x1')](_0x1db11e(_0x194ad9,'Stop'));const _0x5038a1=this[_0x62d0('0xa')];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x5038a1['if'](_0x62d0('0x9'),'ck-hidden',_0x5b0eca=>!_0x5b0eca)]}}),this[_0x62d0('0x14')][_0x62d0('0x10')]([this[_0x62d0('0x6')],this[_0x62d0('0x3')],this[_0x62d0('0x4')],this[_0x62d0('0x12')]]);}['_createButton'](_0x32fc28,_0x285a7b){const _0x2de9a0=new _0x34f683(this[_0x62d0('0x5')]);return _0x2de9a0['set']({'label':_0x32fc28,'class':_0x285a7b||'','isVisible':!0x0,'withText':!0x0}),_0x2de9a0;}}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/aiformview
|
|
7
|
+
*/
|
|
8
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { View, FormHeaderView } from 'ckeditor5/src/ui';
|
|
10
|
+
import AIFormToolbarView, { AIFormToolbarViewMainAction } from './aiformtoolbarview';
|
|
11
|
+
import AIFormContentArea from './aiformcontentarea';
|
|
12
|
+
import AIFormErrorView from './aiformerrorview';
|
|
13
|
+
import AIFormPromptView from './aiformpromptview';
|
|
14
|
+
/**
|
|
15
|
+
* A class representing the form view of the AI assistant.
|
|
16
|
+
*/
|
|
17
|
+
export default class AIFormView extends View {
|
|
18
|
+
/**
|
|
19
|
+
* Tracks information about the DOM focus in the form.
|
|
20
|
+
*
|
|
21
|
+
* @readonly
|
|
22
|
+
*/
|
|
23
|
+
focusTracker: FocusTracker;
|
|
24
|
+
/**
|
|
25
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
26
|
+
*
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
keystrokes: KeystrokeHandler;
|
|
30
|
+
/**
|
|
31
|
+
* The view that represent the header of the form.
|
|
32
|
+
*/
|
|
33
|
+
header: FormHeaderView;
|
|
34
|
+
/**
|
|
35
|
+
* The text area view that is used to display AI response.
|
|
36
|
+
*/
|
|
37
|
+
contentArea: AIFormContentArea;
|
|
38
|
+
/**
|
|
39
|
+
* Toolbar view containing button views that manage the AI response and this form itself.
|
|
40
|
+
*/
|
|
41
|
+
toolbar: AIFormToolbarView;
|
|
42
|
+
/**
|
|
43
|
+
* The component used for handling the user's query, including history and submit buttons.
|
|
44
|
+
*/
|
|
45
|
+
promptView: AIFormPromptView;
|
|
46
|
+
/**
|
|
47
|
+
* View that is used to display the error message.
|
|
48
|
+
*/
|
|
49
|
+
errorView: AIFormErrorView;
|
|
50
|
+
/**
|
|
51
|
+
* The prompt text can be configured either during construction when the AI command has been selected,
|
|
52
|
+
* or later by submitting the {@link #labeledInput}, if it hasn't been previously initialized.
|
|
53
|
+
* After setting this value the AI request is triggered.
|
|
54
|
+
*/
|
|
55
|
+
prompt: string;
|
|
56
|
+
/**
|
|
57
|
+
* The value that is generated after user submitting the user prompt.
|
|
58
|
+
*/
|
|
59
|
+
value: string;
|
|
60
|
+
/**
|
|
61
|
+
* Flag that indicates if the AI assistant form view is enabled or disabled.
|
|
62
|
+
*
|
|
63
|
+
* If it is disabled, all interactive elements of this view are disabled as well.
|
|
64
|
+
*/
|
|
65
|
+
isEnabled: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates if the AI request is processing.
|
|
68
|
+
*/
|
|
69
|
+
isProcessing: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Indicates if the AI request failed.
|
|
72
|
+
*/
|
|
73
|
+
isError: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The action name for the main insertion button in the {@link #toolbar}.
|
|
76
|
+
*
|
|
77
|
+
* See {@link module:ai/ui/aiformtoolbarview~AIFormToolbarView#replaceButton}.
|
|
78
|
+
*
|
|
79
|
+
* @default 'replace'
|
|
80
|
+
*/
|
|
81
|
+
mainAction: AIFormToolbarViewMainAction;
|
|
82
|
+
/**
|
|
83
|
+
* Creates an instance of the {@link module:ai/ui/aiformview~AIFormView} class.
|
|
84
|
+
*
|
|
85
|
+
* @param locale The localization services instance.
|
|
86
|
+
*/
|
|
87
|
+
constructor(locale: Locale, uiClasses: string, contentAreaCssClass?: string);
|
|
88
|
+
/**
|
|
89
|
+
* @inheritDoc
|
|
90
|
+
*/
|
|
91
|
+
render(): void;
|
|
92
|
+
focus(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Resets the form to the initial values.
|
|
95
|
+
*/
|
|
96
|
+
reset(): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Fired when a user performed an action that should lead to replace the current selection by generated content.
|
|
100
|
+
*
|
|
101
|
+
* @eventName ~AIFormView#replaceContent
|
|
102
|
+
*/
|
|
103
|
+
export type ReplaceContentEvent = {
|
|
104
|
+
name: 'replaceContent';
|
|
105
|
+
args: [];
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Fired when a user performed an action that should lead to insert generated content below the current selection.
|
|
109
|
+
*
|
|
110
|
+
* @eventName ~AIFormView#insertContentBelow
|
|
111
|
+
*/
|
|
112
|
+
export type InsertContentBelowEvent = {
|
|
113
|
+
name: 'insertContentBelow';
|
|
114
|
+
args: [];
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Fired when a user performed an action that should lead to retry the previous request to AI.
|
|
118
|
+
*
|
|
119
|
+
* @eventName ~AIFormView#tryAgainEvent
|
|
120
|
+
*/
|
|
121
|
+
export type TryAgainEvent = {
|
|
122
|
+
name: 'tryAgainEvent';
|
|
123
|
+
args: [];
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Fired when a user performed an action that should lead to stop the processing of AI.
|
|
127
|
+
*
|
|
128
|
+
* @eventName ~AIFormView#stopProcessing
|
|
129
|
+
*/
|
|
130
|
+
export type StopProcessingEvent = {
|
|
131
|
+
name: 'stopProcessing';
|
|
132
|
+
args: [];
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Fired when a user performed an action that should lead to ask AI.
|
|
136
|
+
*
|
|
137
|
+
* @eventName ~AIFormView#submitPrompt
|
|
138
|
+
*/
|
|
139
|
+
export type SubmitPromptEvent = {
|
|
140
|
+
name: 'submitPrompt';
|
|
141
|
+
args: [prompt: string];
|
|
142
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0xa281=['replaceButton','copyButtonView','focus','execute','div','locale','isEnabled','prompt','isProcessing','backwardCycle','trim','tryAgainEvent','clear','forwardCycle','Ask\x20AI\x20to\x20improve\x20generated\x20text','_focusCycler','createCollection','tryAgainButton','shift\x20+\x20tab','submitPrompt','header','clearHistory','tab','AI_ERROR_FAILED','focusFirst','isVisible','mainAction','isError','focusCycler','items','_promptHistory','keystrokes','_createToolbar','reset','stopButton','toolbar','focusPrevious','fieldView','insertButton','_focusables','errorView','label','promptView','bindTemplate','handleError','_createHistoryView','listenTo','search','high','focusTracker','Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.','stop','value','element','add','delegate','bindTo','bind','insertContentBelow','contentArea','set','finishProcessing','setTemplate','Ask\x20AI\x20to\x20edit\x20or\x20generate','AI\x20Assistant','queryView','render'];(function(_0x450a90,_0xa28152){const _0x50fe49=function(_0x3c64e5){while(--_0x3c64e5){_0x450a90['push'](_0x450a90['shift']());}};_0x50fe49(++_0xa28152);}(_0xa281,0x186));const _0x50fe=function(_0x450a90,_0xa28152){_0x450a90=_0x450a90-0x0;let _0x50fe49=_0xa281[_0x450a90];return _0x50fe49;};import{FocusTracker as _0x24a234,KeystrokeHandler as _0x58ee63}from'ckeditor5/src/utils';import{View as _0x4886d6,FocusCycler as _0x35aec3,createLabeledTextarea as _0x25b4b0,FormHeaderView as _0x419d54}from'ckeditor5/src/ui';import _0x10fe6c,{AIFormToolbarViewMainAction as _0x2dcd77}from'./aiformtoolbarview';import _0x181bb8 from'./aiformcontentarea';import _0x1de56c from'./aiformerrorview';import _0x1a8634 from'./aiformpromptview';import _0x194eed from'./aihistorylistview';import _0x36ed0f from'./aihistorylistitemview';import _0x216e55 from'./prompthistory';import{getTranslation as _0x5205d6}from'../../utils/common-translations';import _0x52871c from'../../../theme/icons/robot-pencil.svg';export default class v extends _0x4886d6{constructor(_0x16ef1b,_0xfae830,_0x38736b=''){super(_0x16ef1b),this[_0x50fe('0x5')](_0x50fe('0x12'),!0x0),this[_0x50fe('0x5')](_0x50fe('0x14'),!0x1),this[_0x50fe('0x5')](_0x50fe('0x13'),''),this[_0x50fe('0x5')]('value',''),this[_0x50fe('0x5')]('isError',!0x1),this[_0x50fe('0x5')](_0x50fe('0x26'),_0x2dcd77['REPLACE']),this[_0x50fe('0x2a')]=new _0x216e55(),this[_0x50fe('0x34')]=new _0x1de56c(_0x16ef1b),this['header']=new _0x419d54(_0x16ef1b,{'label':_0x5205d6(_0x16ef1b,_0x50fe('0x9')),'icon':_0x52871c}),this['contentArea']=new _0x181bb8(_0x16ef1b,_0x38736b),this[_0x50fe('0x4')][_0x50fe('0x2')](_0x50fe('0x14'))['to'](this),this[_0x50fe('0x4')]['bind'](_0x50fe('0x40'))['to'](this),this[_0x50fe('0x2f')]=this['_createToolbar'](),this[_0x50fe('0x2f')][_0x50fe('0x2')](_0x50fe('0x26'))['to'](this),this[_0x50fe('0x36')]=this['_createPromptView'](),this[_0x50fe('0x3d')]=new _0x24a234(),this['keystrokes']=new _0x58ee63(),this[_0x50fe('0x33')]=this[_0x50fe('0x1c')]([this[_0x50fe('0x4')],this[_0x50fe('0x4')][_0x50fe('0xd')],this[_0x50fe('0x2f')],this[_0x50fe('0x36')]]),this[_0x50fe('0x1b')]=new _0x35aec3({'focusables':this[_0x50fe('0x33')],'focusTracker':this[_0x50fe('0x3d')],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':_0x50fe('0x1e'),'focusNext':_0x50fe('0x22')}}),this[_0x50fe('0x36')][_0x50fe('0x28')]['on'](_0x50fe('0x19'),_0x10cc63=>{this[_0x50fe('0x1b')]['focusNext'](),_0x10cc63[_0x50fe('0x3f')]();}),this[_0x50fe('0x36')][_0x50fe('0x28')]['on'](_0x50fe('0x15'),_0x1301b4=>{this['_focusCycler'][_0x50fe('0x30')](),_0x1301b4[_0x50fe('0x3f')]();}),this[_0x50fe('0x36')]['queryView'][_0x50fe('0x31')][_0x50fe('0x2')]('value')['to'](this,_0x50fe('0x13'));const _0x1cbedf=this[_0x50fe('0x37')];this[_0x50fe('0x7')]({'tag':_0x50fe('0x10'),'attributes':{'class':['ck','ck-ai-form',_0xfae830],'tabindex':'-1'},'children':[this[_0x50fe('0x20')],{'tag':_0x50fe('0x10'),'attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':_0x50fe('0x10'),'attributes':{'class':[_0x1cbedf['if']('isError','ck-hidden',_0x292036=>!_0x292036)]},'children':[this[_0x50fe('0x34')]]},this[_0x50fe('0x4')],this[_0x50fe('0x2f')],this[_0x50fe('0x36')]]}]});}[_0x50fe('0xb')](){super[_0x50fe('0xb')](),this[_0x50fe('0x3d')][_0x50fe('0x42')](this['contentArea'][_0x50fe('0x41')]),this[_0x50fe('0x3d')][_0x50fe('0x42')](this['contentArea']['copyButtonView'][_0x50fe('0x41')]),this[_0x50fe('0x3d')][_0x50fe('0x42')](this[_0x50fe('0x2f')]['element']),this[_0x50fe('0x3d')][_0x50fe('0x42')](this[_0x50fe('0x36')][_0x50fe('0x41')]),this[_0x50fe('0x2b')][_0x50fe('0x3a')](this[_0x50fe('0x41')]);}['focus'](){this[_0x50fe('0x1b')][_0x50fe('0x24')]();}[_0x50fe('0x2d')](){this[_0x50fe('0x13')]='',this[_0x50fe('0x40')]='',this[_0x50fe('0x36')][_0x50fe('0x2d')](),this[_0x50fe('0x4')][_0x50fe('0x25')]=!0x1,this[_0x50fe('0x2f')][_0x50fe('0x25')]=!0x1;}['_createPromptView'](){const _0x2ebf7e=this[_0x50fe('0x11')],_0x5bfc56=new _0x1a8634(_0x2ebf7e,{'queryView':{'label':_0x5205d6(_0x2ebf7e,_0x50fe('0x8')),'creator':_0x25b4b0,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':_0x5205d6(_0x2ebf7e,'Empty\x20history'),'secondary':_0x5205d6(_0x2ebf7e,_0x50fe('0x3e'))}}},'filteredView':this[_0x50fe('0x39')](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x5bfc56['bind'](_0x50fe('0x12'))['to'](this,'isEnabled',this,'isProcessing',(_0x186aba,_0x2ca2c3)=>_0x186aba&&!_0x2ca2c3),this[_0x50fe('0x3a')](_0x5bfc56,'submit',(_0x15b251,_0x59841a)=>{this[_0x50fe('0x13')]=_0x59841a,this['fire'](_0x50fe('0x1f'),this[_0x50fe('0x13')]),_0x59841a[_0x50fe('0x16')]()&&this[_0x50fe('0x2a')][_0x50fe('0x42')]({'prompt':_0x59841a[_0x50fe('0x16')]()},0x0);},{'priority':_0x50fe('0x3c')}),_0x5bfc56;}['_createHistoryView'](){const _0x1c055f=new _0x194eed(this[_0x50fe('0x11')]);return _0x1c055f['historyGroupView'][_0x50fe('0x29')][_0x50fe('0x1')](this[_0x50fe('0x2a')])['as'](_0x36ed0f),_0x1c055f['on'](_0x50fe('0x21'),()=>{this['_promptHistory'][_0x50fe('0x18')](),this[_0x50fe('0x36')][_0x50fe('0x3b')](''),this[_0x50fe('0x36')][_0x50fe('0xe')]();}),_0x1c055f;}[_0x50fe('0x2c')](){const _0x421df2=new _0x10fe6c(this[_0x50fe('0x11')]);return _0x421df2[_0x50fe('0xc')]['bind'](_0x50fe('0x12'))['to'](this,_0x50fe('0x12'),this,_0x50fe('0x14'),this,'value',(_0x5a503e,_0x268654,_0x45ed25)=>_0x5a503e&&!_0x268654&&!!_0x45ed25),_0x421df2[_0x50fe('0xc')][_0x50fe('0x0')](_0x50fe('0xf'))['to'](this,'replaceContent'),_0x421df2[_0x50fe('0x32')]['bind']('isEnabled')['to'](this,'isEnabled',this,_0x50fe('0x14'),this,_0x50fe('0x40'),(_0x347cb0,_0x15cdb1,_0x429280)=>_0x347cb0&&!_0x15cdb1&&!!_0x429280),_0x421df2[_0x50fe('0x32')]['delegate']('execute')['to'](this,_0x50fe('0x3')),_0x421df2[_0x50fe('0x1d')][_0x50fe('0x2')](_0x50fe('0x12'))['to'](this,_0x50fe('0x12'),this,_0x50fe('0x14'),(_0x13e098,_0x1a18d7)=>_0x13e098&&!_0x1a18d7),_0x421df2[_0x50fe('0x1d')][_0x50fe('0x0')](_0x50fe('0xf'))['to'](this,_0x50fe('0x17')),_0x421df2['stopButton'][_0x50fe('0x2')](_0x50fe('0x12'))['to'](this,_0x50fe('0x14')),_0x421df2[_0x50fe('0x2e')][_0x50fe('0x0')](_0x50fe('0xf'))['to'](this,'stopProcessing'),_0x421df2;}['startProcessing'](){this[_0x50fe('0x40')]='',this[_0x50fe('0x27')]=!0x1,this['isProcessing']=!0x0,this[_0x50fe('0x4')]['isVisible']=!0x0,this['toolbar'][_0x50fe('0x25')]=!0x0,this[_0x50fe('0x4')][_0x50fe('0xe')]();}[_0x50fe('0x6')](){const _0x35cda0=this[_0x50fe('0x11')];this[_0x50fe('0x14')]=!0x1,this[_0x50fe('0x13')]='',this[_0x50fe('0x36')]['reset'](),this[_0x50fe('0x40')]&&(this[_0x50fe('0x36')][_0x50fe('0xa')][_0x50fe('0x35')]=_0x5205d6(_0x35cda0,_0x50fe('0x1a')));}[_0x50fe('0x38')](_0x21537b){const _0x4272a0=this['locale'];this[_0x50fe('0x6')](),this['isError']=!0x0,this[_0x50fe('0x34')]['text']=_0x21537b||_0x5205d6(_0x4272a0,_0x50fe('0x23')),this[_0x50fe('0x40')]||(this[_0x50fe('0x4')][_0x50fe('0x25')]=!0x1);}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/aihistorylistitemview
|
|
7
|
+
*/
|
|
8
|
+
import { ListItemView } from 'ckeditor5/src/ui';
|
|
9
|
+
import type { PromptHistoryEntry } from './prompthistory';
|
|
10
|
+
/**
|
|
11
|
+
* A list item view that displays a historical prompt
|
|
12
|
+
*/
|
|
13
|
+
export default class AIHistoryListItemView extends ListItemView {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
constructor(promptHistoryEntry: PromptHistoryEntry);
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x5889=['prompt','add','fire','execute'];(function(_0x24ebea,_0x5889f4){const _0x31fa98=function(_0x3b64dc){while(--_0x3b64dc){_0x24ebea['push'](_0x24ebea['shift']());}};_0x31fa98(++_0x5889f4);}(_0x5889,0xff));const _0x31fa=function(_0x24ebea,_0x5889f4){_0x24ebea=_0x24ebea-0x0;let _0x31fa98=_0x5889[_0x24ebea];return _0x31fa98;};import{ListItemView as _0x1a0eb7,ButtonView as _0x107702}from'ckeditor5/src/ui';import _0x2a6888 from'../dropdown/buttonlabelwithhighlightview';import{unescape as _0x47b238}from'lodash-es';export default class nt extends _0x1a0eb7{constructor(_0x1131a3){super();const _0x5d2606=new _0x2a6888(),_0x2a8095=new _0x107702(this['locale'],_0x5d2606);this['children'][_0x31fa('0x2')](_0x2a8095),_0x2a8095['set']({'label':_0x1131a3[_0x31fa('0x1')],'withText':!0x0}),_0x2a8095['on'](_0x31fa('0x0'),()=>{this[_0x31fa('0x3')](_0x31fa('0x0'),{'value':_0x47b238(_0x1131a3[_0x31fa('0x1')])});});}}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/ui/aihistorylistview
|
|
7
|
+
*/
|
|
8
|
+
import { ListView, ListItemGroupView, ButtonView, type FilteredView } from 'ckeditor5/src/ui';
|
|
9
|
+
import type { Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
/**
|
|
11
|
+
* A list view that displays a list of AI prompts with filter pass-through.
|
|
12
|
+
*
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export default class AIHistoryListView extends ListView implements FilteredView {
|
|
16
|
+
historyGroupView: ListItemGroupView;
|
|
17
|
+
clearHistoryButton: ButtonView;
|
|
18
|
+
constructor(locale: Locale);
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
filter(): {
|
|
23
|
+
resultsCount: number;
|
|
24
|
+
totalItemsCount: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fired when the clear history button was executed by the user.
|
|
29
|
+
*
|
|
30
|
+
* @eventName ~AIHistoryListView#clearHistory
|
|
31
|
+
*/
|
|
32
|
+
export type AIHistoryListViewClearHistoryEvent = {
|
|
33
|
+
name: 'clearHistory';
|
|
34
|
+
args: [];
|
|
35
|
+
};
|