@ckeditor/ckeditor5-ai 0.0.0-nightly-20231004.0 → 40.0.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/README.md +19 -1
- package/build/ai.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/lang/contexts.json +15 -5
- package/lang/translations/ar.po +39 -39
- package/lang/translations/bg.po +39 -39
- package/lang/translations/bn.po +39 -39
- package/lang/translations/ca.po +39 -39
- package/lang/translations/cs.po +39 -39
- package/lang/translations/da.po +39 -39
- package/lang/translations/de.po +39 -39
- package/lang/translations/el.po +39 -39
- package/lang/translations/es.po +39 -39
- package/lang/translations/et.po +39 -39
- package/lang/translations/fi.po +39 -39
- package/lang/translations/fr.po +39 -39
- package/lang/translations/he.po +39 -39
- package/lang/translations/hi.po +39 -39
- package/lang/translations/hu.po +39 -39
- package/lang/translations/id.po +39 -39
- package/lang/translations/it.po +39 -39
- package/lang/translations/ja.po +39 -39
- package/lang/translations/ko.po +39 -39
- package/lang/translations/lt.po +39 -39
- package/lang/translations/lv.po +39 -39
- package/lang/translations/ms.po +39 -39
- package/lang/translations/nl.po +40 -40
- package/lang/translations/no.po +39 -39
- package/lang/translations/pl.po +39 -39
- package/lang/translations/pt-br.po +39 -39
- package/lang/translations/pt.po +39 -39
- package/lang/translations/ro.po +39 -39
- package/lang/translations/ru.po +39 -39
- package/lang/translations/sk.po +39 -39
- package/lang/translations/sr.po +39 -39
- package/lang/translations/sv.po +39 -39
- package/lang/translations/th.po +39 -39
- package/lang/translations/tr.po +39 -39
- package/lang/translations/uk.po +39 -39
- package/lang/translations/vi.po +39 -39
- package/lang/translations/zh-cn.po +39 -39
- package/lang/translations/zh.po +39 -39
- package/package.json +5 -3
- package/src/aiassistant.d.ts +419 -128
- package/src/aiassistant.js +1 -1
- package/src/aiassistantediting.d.ts +45 -44
- package/src/aiassistantediting.js +1 -1
- package/src/aiassistantui.d.ts +46 -41
- package/src/aiassistantui.js +1 -1
- package/src/aiconnector.d.ts +44 -40
- package/src/aiconnector.js +1 -1
- package/src/augmentation.d.ts +26 -26
- package/src/index.d.ts +9 -9
- package/src/ui/aiassistantcontroller.d.ts +59 -59
- package/src/ui/aiassistantcontroller.js +1 -1
- package/src/ui/dropdown/aicommandslistview.d.ts +22 -22
- package/src/ui/dropdown/aicommandslistview.js +1 -1
- package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +29 -29
- package/src/ui/dropdown/buttonlabelwithhighlightview.js +1 -1
- package/src/ui/form/aiformcontentarea.d.ts +48 -70
- package/src/ui/form/aiformcontentarea.js +1 -1
- package/src/ui/form/aiformerrorview.d.ts +26 -26
- package/src/ui/form/aiformerrorview.js +1 -1
- package/src/ui/form/aiformpromptview.d.ts +46 -46
- package/src/ui/form/aiformpromptview.js +1 -1
- package/src/ui/form/aiformtoolbarview.d.ts +41 -41
- package/src/ui/form/aiformtoolbarview.js +1 -1
- package/src/ui/form/aiformview.d.ts +131 -125
- package/src/ui/form/aiformview.js +1 -1
- package/src/ui/form/aihistorylistitemview.d.ts +18 -18
- package/src/ui/form/aihistorylistitemview.js +1 -1
- package/src/ui/form/aihistorylistview.d.ts +35 -35
- package/src/ui/form/aihistorylistview.js +1 -1
- package/src/ui/form/prompthistory.d.ts +20 -20
- package/src/ui/form/prompthistory.js +1 -1
- package/src/ui/showaiassistantcommand.d.ts +26 -26
- package/src/ui/showaiassistantcommand.js +1 -1
- package/src/utils/common-translations.d.ts +9 -0
- package/src/utils/common-translations.js +23 -0
- package/theme/ai-dropdown.css +4 -4
- package/theme/ai-form.css +2 -0
- package/theme/ai.css +15 -13
- package/theme/icons/error.svg +1 -3
- package/theme/icons/magic-wand.svg +1 -7
- package/theme/icons/robot-pencil.svg +1 -9
- package/theme/icons/submit.svg +1 -3
- package/src/ui/form/aiformtextareaview.d.ts +0 -31
- package/src/ui/form/aiformtextareaview.js +0 -23
package/src/aiconnector.d.ts
CHANGED
|
@@ -1,40 +1,44 @@
|
|
|
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
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
6
|
-
/**
|
|
7
|
-
* The AI handler plugin that is responsible for the whole communication with AI.
|
|
8
|
-
* It uses the Adapter for OpenAI by default.
|
|
9
|
-
*/
|
|
10
|
-
export default class AIConnector extends Plugin {
|
|
11
|
-
/**
|
|
12
|
-
* The adapter instance which is used to handle the communication with AI API.
|
|
13
|
-
*/
|
|
14
|
-
adapter: Adapter;
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
static get pluginName(): "AIConnector";
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
constructor(editor: Editor);
|
|
23
|
-
/**
|
|
24
|
-
* Processes a user prompt and sends it to the AI API.
|
|
25
|
-
*
|
|
26
|
-
* @param prompt The user's prompt to be processed.
|
|
27
|
-
* @param context The context on which the prompt is used.
|
|
28
|
-
* @param onDataCallback The callback that is called after receiving content from AI API.
|
|
29
|
-
* @returns A Promise that resolves with the AI-generated response.
|
|
30
|
-
* @throws If sending the prompt to the AI API fails.
|
|
31
|
-
*/
|
|
32
|
-
processPrompt(prompt: string, context: string, onDataCallback: (content: string) => any): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* The method that stops the current request and then recreates the abort controller instance.
|
|
35
|
-
*/
|
|
36
|
-
abort(): void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
sendPrompt(systemMessage: string, userMessage: string, abortSignal: AbortSignal, onDataCallback: (content: string) => any): Promise<void>;
|
|
40
|
-
}
|
|
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
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
6
|
+
/**
|
|
7
|
+
* The AI handler plugin that is responsible for the whole communication with AI.
|
|
8
|
+
* It uses the Adapter for OpenAI by default.
|
|
9
|
+
*/
|
|
10
|
+
export default class AIConnector extends Plugin {
|
|
11
|
+
/**
|
|
12
|
+
* The adapter instance which is used to handle the communication with AI API.
|
|
13
|
+
*/
|
|
14
|
+
adapter: Adapter;
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get pluginName(): "AIConnector";
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
constructor(editor: Editor);
|
|
23
|
+
/**
|
|
24
|
+
* Processes a user prompt and sends it to the AI API.
|
|
25
|
+
*
|
|
26
|
+
* @param prompt The user's prompt to be processed.
|
|
27
|
+
* @param context The context on which the prompt is used.
|
|
28
|
+
* @param onDataCallback The callback that is called after receiving content from AI API.
|
|
29
|
+
* @returns A Promise that resolves with the AI-generated response.
|
|
30
|
+
* @throws If sending the prompt to the AI API fails.
|
|
31
|
+
*/
|
|
32
|
+
processPrompt(prompt: string, context: string, onDataCallback: (content: string) => any): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* The method that stops the current request and then recreates the abort controller instance.
|
|
35
|
+
*/
|
|
36
|
+
abort(): void;
|
|
37
|
+
}
|
|
38
|
+
interface Adapter {
|
|
39
|
+
sendPrompt(systemMessage: string, userMessage: string, abortSignal: AbortSignal, onDataCallback: (content: string) => any): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export declare class AIRequestError extends Error {
|
|
42
|
+
constructor(message: string);
|
|
43
|
+
}
|
|
44
|
+
export {};
|
package/src/aiconnector.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x103a=['_cleanUpData','data:\x20','Instruction:\x0a','data','aiAssistant.requestParameters.model','Authorization','choices','user','match','aiconnector-send-prompt-failed','processor','aiAssistant.requestParameters.top_p','string','get','error','aiAssistant.requestParameters.max_tokens','authKey','_processStream','_domParser','content','body','reject','Bearer\x20','aiAssistant.requestParameters.temperature','aiAssistant.apiUrl','document','define','abort','adapter','toModel','startsWith','AI_ERROR_CONTEXT_LENGTH','text/html','filter','stringify','editing','top_p','join','processPrompt','_parseAndNormalizeContent','push','aborted','model','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','AIRequestError','https://api.openai.com/v1/chat/completions','Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','resolve','_authKey','serializeToString','_isBufferIncomplete','gpt-3.5-turbo','catch','<span>','AI_ERROR_MODERATION','toView','_apiUrl','length','includes','name','config','replace','_abortController','_requestParameters','parseFromString','_prepareMessages','[DONE]','_xmlSerializer','_normalizeResponseHeadings','signal','editor','aiAssistant.requestParameters','max_tokens','context_length_exceeded','split','getReader','AbortError','view','temperature','sendPrompt'];(function(_0x1ef6f4,_0x103aeb){const _0x214239=function(_0x50986a){while(--_0x50986a){_0x1ef6f4['push'](_0x1ef6f4['shift']());}};_0x214239(++_0x103aeb);}(_0x103a,0xe6));const _0x2142=function(_0x1ef6f4,_0x103aeb){_0x1ef6f4=_0x1ef6f4-0x0;let _0x214239=_0x103a[_0x1ef6f4];return _0x214239;};import{Matcher as _0x19670b,UpcastWriter as _0x5ea036}from'ckeditor5/src/engine';import{Plugin as _0x5dd575}from'ckeditor5/src/core';import{CKEditorError as _0x300097}from'ckeditor5/src/utils';import{getTranslation as _0x1e8118}from'./utils/common-translations';export default class o extends _0x5dd575{static get['pluginName'](){return'AIConnector';}constructor(_0x225eff){super(_0x225eff),_0x225eff[_0x2142('0x46')][_0x2142('0x24')](_0x2142('0x22'),_0x2142('0x37')),_0x225eff[_0x2142('0x46')][_0x2142('0x24')](_0x2142('0xe'),_0x2142('0x3d')),_0x225eff['config'][_0x2142('0x24')](_0x2142('0x19'),0x7d0),_0x225eff[_0x2142('0x46')][_0x2142('0x24')](_0x2142('0x21'),0x1),_0x225eff[_0x2142('0x46')]['define'](_0x2142('0x15'),0x1);const _0x46d1e2=_0x225eff[_0x2142('0x46')][_0x2142('0x17')](_0x2142('0x22')),_0x3b0781=_0x225eff['config'][_0x2142('0x17')]('aiAssistant')[_0x2142('0x1a')],_0x34da0=_0x225eff[_0x2142('0x46')][_0x2142('0x17')](_0x2142('0x1'));this[_0x2142('0x48')]=new AbortController(),this[_0x2142('0x26')]=new OpenAIAdapter(_0x225eff,_0x46d1e2,_0x34da0,_0x3b0781);}async[_0x2142('0x30')](_0x1388d7,_0x2deebb,_0x277f0f){const {systemMessage:_0xe954e4,userMessage:_0x197ede}=this[_0x2142('0x4b')](_0x1388d7,_0x2deebb);return this['adapter'][_0x2142('0x9')](_0xe954e4,_0x197ede,this[_0x2142('0x48')][_0x2142('0x4f')],_0x277f0f)[_0x2142('0x3e')](_0x4c14b1=>{if(_0x4c14b1 instanceof AIRequestError)return Promise[_0x2142('0x1f')](_0x4c14b1);if(_0x2142('0x6')==_0x4c14b1['name'])return Promise[_0x2142('0x39')]();throw console[_0x2142('0x18')](_0x4c14b1),new _0x300097(_0x2142('0x13'),null);});}[_0x2142('0x25')](){this[_0x2142('0x48')][_0x2142('0x4f')][_0x2142('0x33')]||(this[_0x2142('0x48')]['abort'](),this[_0x2142('0x48')]=new AbortController());}[_0x2142('0x4b')](_0x3d9883,_0x2c445c){let _0x23ceb6,_0x49f0ae;return _0x2c445c?(_0x23ceb6=_0x2142('0x38'),_0x49f0ae=_0x2142('0xc')+_0x3d9883+_0x2142('0x35')+(_0x2c445c[_0x2142('0x28')]('<')?_0x2c445c:_0x2142('0x3f')+_0x2c445c+'</span>')):(_0x23ceb6='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x49f0ae=_0x3d9883),{'systemMessage':_0x23ceb6,'userMessage':_0x49f0ae};}}export class OpenAIAdapter{constructor(_0x50e370,_0x518e06,_0x1ac30d,_0x4da0ab){this[_0x2142('0x0')]=_0x50e370,this['_apiUrl']=_0x518e06,this[_0x2142('0x3a')]=_0x4da0ab,this[_0x2142('0x49')]=_0x1ac30d,this[_0x2142('0x1c')]=new DOMParser(),this[_0x2142('0x4d')]=new XMLSerializer();}async[_0x2142('0x9')](_0x52614e,_0x352a8a,_0x10a71e,_0x5c2f2f){const _0x2b2d8a=this[_0x2142('0x0')]['locale'],_0x1ea3dd={'Content-Type':'application/json'};if(_0x2142('0x16')==typeof this[_0x2142('0x3a')])_0x1ea3dd[_0x2142('0xf')]='Bearer\x20'+this[_0x2142('0x3a')];else{if(this[_0x2142('0x3a')])try{const _0x4d127f=await this['_authKey']();_0x1ea3dd['Authorization']=_0x2142('0x20')+_0x4d127f;}catch(_0x29cf4f){return Promise['reject'](new AIRequestError(_0x1e8118(_0x2b2d8a,'AI_ERROR_AUTH_REQUEST')));}}const _0x20a17e={'model':this[_0x2142('0x49')][_0x2142('0x34')],'messages':[{'role':'system','content':_0x52614e},{'role':_0x2142('0x11'),'content':_0x352a8a}],'stream':!0x0,'max_tokens':this[_0x2142('0x49')][_0x2142('0x2')],'temperature':this[_0x2142('0x49')][_0x2142('0x8')],'top_p':this['_requestParameters'][_0x2142('0x2e')]};this[_0x2142('0x49')][_0x2142('0x11')]&&(_0x20a17e['user']=this['_requestParameters'][_0x2142('0x11')]);const _0x5d3232={'method':'POST','headers':_0x1ea3dd,'body':JSON[_0x2142('0x2c')](_0x20a17e),'signal':_0x10a71e},_0x425b87=await fetch(this[_0x2142('0x42')],_0x5d3232);if(_0x425b87['ok']){const _0x4dd59a=_0x425b87[_0x2142('0x1e')];return await this[_0x2142('0x1b')](_0x4dd59a,_0x5c2f2f),Promise[_0x2142('0x39')]();}{const _0x3912e6=await _0x425b87['text']();return _0x3912e6['includes'](_0x2142('0x3'))?Promise[_0x2142('0x1f')](new AIRequestError(_0x1e8118(_0x2b2d8a,_0x2142('0x29')))):_0x3912e6[_0x2142('0x44')]('Moderation')?Promise[_0x2142('0x1f')](new AIRequestError(_0x1e8118(_0x2b2d8a,_0x2142('0x40')))):Promise[_0x2142('0x1f')](new Error(_0x3912e6));}}async[_0x2142('0x1b')](_0x2a9f17,_0x5a7ba4){const _0x73ddc4=_0x2a9f17[_0x2142('0x5')](),_0x1d695b=new TextDecoder();let _0x54fa8f='',_0x167187='',_0x3569ba='',_0x239610=!0x1;for(;!_0x239610;){const {done:_0x1f3520,value:_0xbd38c7}=await _0x73ddc4['read'](),_0xdb8720=_0x54fa8f+_0x1d695b['decode'](_0xbd38c7);let _0x21d4f2='';_0x239610=_0x1f3520;try{_0x21d4f2=this[_0x2142('0xa')](_0xdb8720),_0x54fa8f='';}catch(_0x433d4f){_0x54fa8f+=_0xdb8720;continue;}_0x167187+=_0x21d4f2,!_0x1f3520&&this[_0x2142('0x3c')](_0x167187)||_0x167187&&(_0x3569ba+=_0x167187,_0x5a7ba4(this[_0x2142('0x31')](_0x3569ba)),_0x167187='');}return Promise[_0x2142('0x39')]();}[_0x2142('0x3c')](_0xa0d9e8){const _0x5131c1=_0xa0d9e8[_0x2142('0x4')]('<')[_0x2142('0x43')]!==_0xa0d9e8[_0x2142('0x4')]('>')['length'],_0x43a494=_0xa0d9e8[_0x2142('0x43')]<0x1e;return _0x5131c1&&_0x43a494;}['_parseAndNormalizeContent'](_0x1f6bea){const _0x1abe00=this[_0x2142('0x1c')][_0x2142('0x4a')](_0x1f6bea,_0x2142('0x2a')),_0x5332ad=this[_0x2142('0x0')][_0x2142('0xd')][_0x2142('0x14')][_0x2142('0x41')](this[_0x2142('0x4d')][_0x2142('0x3b')](_0x1abe00['body']));return this[_0x2142('0x4e')](_0x5332ad),this['editor']['data'][_0x2142('0x2c')](this[_0x2142('0x0')][_0x2142('0xd')][_0x2142('0x27')](_0x5332ad));}[_0x2142('0x4e')](_0x271f94){const _0x37bdb3=new _0x5ea036(this[_0x2142('0x0')][_0x2142('0x2d')][_0x2142('0x7')][_0x2142('0x23')]),_0x440035=new _0x19670b({'name':/^h[1-5]$/}),_0x1f1228=[];let _0x349e7f=!0x1;for(const _0x104f4f of _0x271f94)_0x104f4f['is']('element')&&_0x440035[_0x2142('0x12')](_0x104f4f)&&(_0x1f1228[_0x2142('0x32')](_0x104f4f),'h1'==_0x104f4f[_0x2142('0x45')]&&(_0x349e7f=!0x0));if(_0x349e7f)for(const _0x203ad3 of _0x1f1228)_0x37bdb3['rename']('h'+(parseInt(_0x203ad3[_0x2142('0x45')][0x1])+0x1),_0x203ad3);}[_0x2142('0xa')](_0x1ac8d3){return _0x1ac8d3['split']('\x0a')['map'](_0x17ec5b=>_0x17ec5b[_0x2142('0x47')](_0x2142('0xb'),''))['filter'](_0x122c73=>_0x122c73&&_0x122c73[_0x2142('0x43')]>0x0&&_0x2142('0x4c')!==_0x122c73)['map'](_0x389cb3=>JSON['parse'](_0x389cb3)[_0x2142('0x10')][0x0]['delta'][_0x2142('0x1d')])[_0x2142('0x2b')](_0x114a60=>_0x114a60)[_0x2142('0x2f')]('');}}export class AIRequestError extends Error{constructor(_0x1d0aff){super(_0x1d0aff),this[_0x2142('0x45')]=_0x2142('0x36');}}
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,26 +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
|
-
import type { default as AIAssistant, AIAssistantConfig } from './aiassistant';
|
|
6
|
-
import type ShowAIAssistantCommand from './ui/showaiassistantcommand';
|
|
7
|
-
import type AIAssistantEditing from './aiassistantediting';
|
|
8
|
-
import type AIAssistantUI from './aiassistantui';
|
|
9
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
10
|
-
interface EditorConfig {
|
|
11
|
-
/**
|
|
12
|
-
* The configuration of the {@link module:ai/aiassistant~AIAssistant AI assistant feature}.
|
|
13
|
-
*
|
|
14
|
-
* Read more in {@link module:ai/aiassistant~AIAssistantConfig}.
|
|
15
|
-
*/
|
|
16
|
-
aiAssistant?: AIAssistantConfig;
|
|
17
|
-
}
|
|
18
|
-
interface PluginsMap {
|
|
19
|
-
[AIAssistant.pluginName]: AIAssistant;
|
|
20
|
-
[AIAssistantUI.pluginName]: AIAssistantUI;
|
|
21
|
-
[AIAssistantEditing.pluginName]: AIAssistantEditing;
|
|
22
|
-
}
|
|
23
|
-
interface CommandsMap {
|
|
24
|
-
aiAssistant: ShowAIAssistantCommand;
|
|
25
|
-
}
|
|
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
|
+
import type { default as AIAssistant, AIAssistantConfig } from './aiassistant';
|
|
6
|
+
import type ShowAIAssistantCommand from './ui/showaiassistantcommand';
|
|
7
|
+
import type AIAssistantEditing from './aiassistantediting';
|
|
8
|
+
import type AIAssistantUI from './aiassistantui';
|
|
9
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
10
|
+
interface EditorConfig {
|
|
11
|
+
/**
|
|
12
|
+
* The configuration of the {@link module:ai/aiassistant~AIAssistant AI assistant feature}.
|
|
13
|
+
*
|
|
14
|
+
* Read more in {@link module:ai/aiassistant~AIAssistantConfig}.
|
|
15
|
+
*/
|
|
16
|
+
aiAssistant?: AIAssistantConfig;
|
|
17
|
+
}
|
|
18
|
+
interface PluginsMap {
|
|
19
|
+
[AIAssistant.pluginName]: AIAssistant;
|
|
20
|
+
[AIAssistantUI.pluginName]: AIAssistantUI;
|
|
21
|
+
[AIAssistantEditing.pluginName]: AIAssistantEditing;
|
|
22
|
+
}
|
|
23
|
+
interface CommandsMap {
|
|
24
|
+
aiAssistant: ShowAIAssistantCommand;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
7
|
-
*/
|
|
8
|
-
export { default as AIAssistant } from './aiassistant';
|
|
9
|
-
import './augmentation';
|
|
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
|
|
7
|
+
*/
|
|
8
|
+
export { default as AIAssistant } from './aiassistant';
|
|
9
|
+
import './augmentation';
|
|
@@ -1,59 +1,59 @@
|
|
|
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
|
-
import type AIConnector from '../aiconnector';
|
|
6
|
-
import type { default as AIFormView } from './form/aiformview';
|
|
7
|
-
declare const AIAssistantController_base: {
|
|
8
|
-
new (): import("ckeditor5/src/utils").Observable;
|
|
9
|
-
prototype: import("ckeditor5/src/utils").Observable;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Controller for the AI assistant.
|
|
13
|
-
*
|
|
14
|
-
* It takes a AI balloon view, listens to events fired by that view and based on them performs actions on an AI handler.
|
|
15
|
-
* This controller is also responsible for streaming the AI response for the UI.
|
|
16
|
-
*/
|
|
17
|
-
export default class AIAssistantController extends AIAssistantController_base {
|
|
18
|
-
/**
|
|
19
|
-
* An instance of the {@link module:ai/aiconnector~AIConnector}.
|
|
20
|
-
*/
|
|
21
|
-
readonly connector: AIConnector;
|
|
22
|
-
/**
|
|
23
|
-
* An instance of the {@link module:ai/ui/aiformview~AIFormView}.
|
|
24
|
-
*/
|
|
25
|
-
readonly view: AIFormView;
|
|
26
|
-
/**
|
|
27
|
-
* The previous value of the user prompt. It is kept to handle the try again event.
|
|
28
|
-
*
|
|
29
|
-
* @observable
|
|
30
|
-
*/
|
|
31
|
-
previousPrompt?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The previous value of the context for the AI request. It is kept to handle the try again event.
|
|
34
|
-
*
|
|
35
|
-
* Initially it is the selected HTML content from the editor. Subsequently,
|
|
36
|
-
* the context is replaced by each response from AI.
|
|
37
|
-
*
|
|
38
|
-
* @observable
|
|
39
|
-
*/
|
|
40
|
-
previousContext?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Flag that indicates if the processing is in progress.
|
|
43
|
-
*
|
|
44
|
-
* @observable
|
|
45
|
-
*/
|
|
46
|
-
isProcessing: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* @param connector AI connector instance.
|
|
49
|
-
* @param view AI form view.
|
|
50
|
-
* @param htmlContent The selected HTML content on which the AI should base.
|
|
51
|
-
* @param prompt The initial prompt that causes the processing to start.
|
|
52
|
-
*/
|
|
53
|
-
constructor(connector: AIConnector, view: AIFormView, htmlContent: string, prompt?: string);
|
|
54
|
-
/**
|
|
55
|
-
* Destroys `AIAssistantController` instance.
|
|
56
|
-
*/
|
|
57
|
-
destroy(): void;
|
|
58
|
-
}
|
|
59
|
-
export {};
|
|
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
|
+
import { type default as AIConnector } from '../aiconnector';
|
|
6
|
+
import type { default as AIFormView } from './form/aiformview';
|
|
7
|
+
declare const AIAssistantController_base: {
|
|
8
|
+
new (): import("ckeditor5/src/utils").Observable;
|
|
9
|
+
prototype: import("ckeditor5/src/utils").Observable;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Controller for the AI assistant.
|
|
13
|
+
*
|
|
14
|
+
* It takes a AI balloon view, listens to events fired by that view and based on them performs actions on an AI handler.
|
|
15
|
+
* This controller is also responsible for streaming the AI response for the UI.
|
|
16
|
+
*/
|
|
17
|
+
export default class AIAssistantController extends AIAssistantController_base {
|
|
18
|
+
/**
|
|
19
|
+
* An instance of the {@link module:ai/aiconnector~AIConnector}.
|
|
20
|
+
*/
|
|
21
|
+
readonly connector: AIConnector;
|
|
22
|
+
/**
|
|
23
|
+
* An instance of the {@link module:ai/ui/aiformview~AIFormView}.
|
|
24
|
+
*/
|
|
25
|
+
readonly view: AIFormView;
|
|
26
|
+
/**
|
|
27
|
+
* The previous value of the user prompt. It is kept to handle the try again event.
|
|
28
|
+
*
|
|
29
|
+
* @observable
|
|
30
|
+
*/
|
|
31
|
+
previousPrompt?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The previous value of the context for the AI request. It is kept to handle the try again event.
|
|
34
|
+
*
|
|
35
|
+
* Initially it is the selected HTML content from the editor. Subsequently,
|
|
36
|
+
* the context is replaced by each response from AI.
|
|
37
|
+
*
|
|
38
|
+
* @observable
|
|
39
|
+
*/
|
|
40
|
+
previousContext?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Flag that indicates if the processing is in progress.
|
|
43
|
+
*
|
|
44
|
+
* @observable
|
|
45
|
+
*/
|
|
46
|
+
isProcessing: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @param connector AI connector instance.
|
|
49
|
+
* @param view AI form view.
|
|
50
|
+
* @param htmlContent The selected HTML content on which the AI should base.
|
|
51
|
+
* @param prompt The initial prompt that causes the processing to start.
|
|
52
|
+
*/
|
|
53
|
+
constructor(connector: AIConnector, view: AIFormView, htmlContent: string, prompt?: string);
|
|
54
|
+
/**
|
|
55
|
+
* Destroys `AIAssistantController` instance.
|
|
56
|
+
*/
|
|
57
|
+
destroy(): void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2ef6=['connector','isProcessing','previousPrompt','stopProcessing','view','previousContext','_handlePrompt','startProcessing','_updateValue','finishProcessing','abort','stopListening','finally','submitPrompt','handleError','once','set','render','destroy','listenTo','catch'];(function(_0x4557ac,_0x2ef671){const _0x476276=function(_0x57a67c){while(--_0x57a67c){_0x4557ac['push'](_0x4557ac['shift']());}};_0x476276(++_0x2ef671);}(_0x2ef6,0x187));const _0x4762=function(_0x4557ac,_0x2ef671){_0x4557ac=_0x4557ac-0x0;let _0x476276=_0x2ef6[_0x4557ac];return _0x476276;};import{ObservableMixin as _0x3191af}from'ckeditor5/src/utils';import{AIRequestError as _0x20abd1}from'../aiconnector';export default class I extends _0x3191af(){constructor(_0x5a4b3e,_0x3187f8,_0x589562,_0x4bab65){super(),this['connector']=_0x5a4b3e,this['view']=_0x3187f8,this[_0x4762('0x3')]({'previousPrompt':void 0x0,'previousContext':void 0x0,'isProcessing':!0x1}),_0x4bab65&&this[_0x4762('0xc')][_0x4762('0x2')](_0x4762('0x4'),()=>{this[_0x4762('0xe')](_0x4bab65,_0x589562);}),this[_0x4762('0x6')](this[_0x4762('0xc')],_0x4762('0x0'),(_0x29a4aa,_0x3c6b48)=>{const _0x27f6aa=this['view']['value']||_0x589562;this[_0x4762('0xe')](_0x3c6b48,_0x27f6aa);}),this[_0x4762('0x6')](this['view'],'tryAgainEvent',()=>{this[_0x4762('0xe')](this[_0x4762('0xa')],this[_0x4762('0xd')]);}),this['listenTo'](this[_0x4762('0xc')],_0x4762('0xb'),()=>{this[_0x4762('0x9')]=!0x1,this[_0x4762('0x8')][_0x4762('0x12')](),this[_0x4762('0xc')]['finishProcessing']();});}[_0x4762('0x5')](){this[_0x4762('0x13')]();}async['_handlePrompt'](_0xcf87cb,_0x3537d4){return this[_0x4762('0x9')]=!0x0,this[_0x4762('0xc')][_0x4762('0xf')](),this[_0x4762('0xa')]=_0xcf87cb,this[_0x4762('0xd')]=_0x3537d4,new Promise(_0x56d5ce=>{this[_0x4762('0x8')]['processPrompt'](_0xcf87cb,_0x3537d4,_0x306969=>this[_0x4762('0x10')](_0x306969))[_0x4762('0x7')](_0x812213=>{_0x812213 instanceof _0x20abd1?this[_0x4762('0xc')]['handleError'](_0x812213['message']):this[_0x4762('0xc')][_0x4762('0x1')](),_0x56d5ce();})[_0x4762('0x14')](()=>{this[_0x4762('0x9')]=!0x1,this[_0x4762('0xc')][_0x4762('0x11')](),_0x56d5ce();});});}[_0x4762('0x10')](_0x22deb2){this[_0x4762('0xc')]['value']=''+_0x22deb2;}}
|
|
@@ -1,22 +1,22 @@
|
|
|
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/aicommandslistview
|
|
7
|
-
*/
|
|
8
|
-
import { ListView, type FilteredView } from 'ckeditor5/src/ui';
|
|
9
|
-
/**
|
|
10
|
-
* A list view that displays a list of AI commands with filtering capabilities.
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
export default class AICommandsListView extends ListView implements FilteredView {
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
filter(regExp: RegExp | null): {
|
|
19
|
-
resultsCount: number;
|
|
20
|
-
totalItemsCount: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
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/aicommandslistview
|
|
7
|
+
*/
|
|
8
|
+
import { ListView, type FilteredView } from 'ckeditor5/src/ui';
|
|
9
|
+
/**
|
|
10
|
+
* A list view that displays a list of AI commands with filtering capabilities.
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
export default class AICommandsListView extends ListView implements FilteredView {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
filter(regExp: RegExp | null): {
|
|
19
|
+
resultsCount: number;
|
|
20
|
+
totalItemsCount: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x34b7=['items','length','isVisible','filter','children','highlightText','labelView'];(function(_0x3e148b,_0x34b7a6){const _0x96013a=function(_0x134738){while(--_0x134738){_0x3e148b['push'](_0x3e148b['shift']());}};_0x96013a(++_0x34b7a6);}(_0x34b7,0x169));const _0x9601=function(_0x3e148b,_0x34b7a6){_0x3e148b=_0x3e148b-0x0;let _0x96013a=_0x34b7[_0x3e148b];return _0x96013a;};import{ListView as _0x24b8a3}from'ckeditor5/src/ui';export default class g extends _0x24b8a3{['filter'](_0x3ce949){let _0x1bf9bd=0x0,_0x3abfa3=0x0;for(const _0x1a8b42 of this[_0x9601('0x3')]){const _0x5e3f08=_0x1a8b42;for(const _0x30aced of _0x5e3f08['items']){const _0x4ca43e=_0x30aced[_0x9601('0x0')]['first'],_0x297dd2=_0x4ca43e[_0x9601('0x2')];_0x3ce949?(_0x30aced[_0x9601('0x5')]=!!_0x4ca43e['label']['match'](_0x3ce949),_0x30aced[_0x9601('0x5')]&&(_0x297dd2[_0x9601('0x1')](_0x3ce949),_0x3abfa3++)):(_0x30aced[_0x9601('0x5')]=!0x0,_0x297dd2[_0x9601('0x1')](null),_0x3abfa3++),_0x1bf9bd++;}_0x5e3f08[_0x9601('0x5')]=!!_0x5e3f08[_0x9601('0x3')][_0x9601('0x6')](_0x15708b=>_0x15708b['isVisible'])[_0x9601('0x4')];}return{'resultsCount':_0x3abfa3,'totalItemsCount':_0x1bf9bd};}}
|
|
@@ -1,29 +1,29 @@
|
|
|
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/buttonlabelwithhighlightview
|
|
7
|
-
*/
|
|
8
|
-
import { type ButtonLabel, HighlightedTextView } from 'ckeditor5/src/ui';
|
|
9
|
-
/**
|
|
10
|
-
* A button label view that can highlight a text fragment.
|
|
11
|
-
*/
|
|
12
|
-
export default class ButtonLabelWithHighlightView extends HighlightedTextView implements ButtonLabel {
|
|
13
|
-
/**
|
|
14
|
-
* @inheritDoc
|
|
15
|
-
*/
|
|
16
|
-
style: string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
text: string | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
id: string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
constructor();
|
|
29
|
-
}
|
|
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/buttonlabelwithhighlightview
|
|
7
|
+
*/
|
|
8
|
+
import { type ButtonLabel, HighlightedTextView } from 'ckeditor5/src/ui';
|
|
9
|
+
/**
|
|
10
|
+
* A button label view that can highlight a text fragment.
|
|
11
|
+
*/
|
|
12
|
+
export default class ButtonLabelWithHighlightView extends HighlightedTextView implements ButtonLabel {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
style: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
text: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
id: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x36be=['extendTemplate','set','bindTemplate','style'];(function(_0xfd1ca,_0x36bec2){const _0xda4ac1=function(_0x2d79ee){while(--_0x2d79ee){_0xfd1ca['push'](_0xfd1ca['shift']());}};_0xda4ac1(++_0x36bec2);}(_0x36be,0x68));const _0xda4a=function(_0xfd1ca,_0x36bec2){_0xfd1ca=_0xfd1ca-0x0;let _0xda4ac1=_0x36be[_0xfd1ca];return _0xda4ac1;};import{HighlightedTextView as _0x5cf719}from'ckeditor5/src/ui';export default class C extends _0x5cf719{constructor(){super(),this[_0xda4a('0x1')]({'style':void 0x0,'text':void 0x0,'id':void 0x0});const _0x456ec4=this[_0xda4a('0x2')];this[_0xda4a('0x0')]({'attributes':{'class':['ck-button__label'],'style':_0x456ec4['to'](_0xda4a('0x3')),'id':_0x456ec4['to']('id')}});}}
|
|
@@ -1,70 +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);
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
render(): void;
|
|
47
|
-
focus(): void;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* A class representing the content field view of the AI assistant.
|
|
51
|
-
*/
|
|
52
|
-
declare class ContentFieldView extends View {
|
|
53
|
-
/**
|
|
54
|
-
* A loader view that get displayed while the response is processing.
|
|
55
|
-
*/
|
|
56
|
-
loaderView: View;
|
|
57
|
-
/**
|
|
58
|
-
* @inheritDoc
|
|
59
|
-
*/
|
|
60
|
-
constructor(locale: Locale);
|
|
61
|
-
/**
|
|
62
|
-
* Sets innerHTML of the content field.
|
|
63
|
-
*/
|
|
64
|
-
setContent(value: string): void;
|
|
65
|
-
/**
|
|
66
|
-
* Appends loader to the content field.
|
|
67
|
-
*/
|
|
68
|
-
appendLoader(): void;
|
|
69
|
-
}
|
|
70
|
-
export {};
|
|
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
|
+
}
|