@ibiz-template/vue3-components 0.7.41-alpha.37 → 0.7.41-alpha.38
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/dist/ibiz-markdown-editor-qRaayafj.js +1 -0
- package/dist/index-BiYphJ2f.js +11 -0
- package/dist/{index-BFGNWF-0.js → index-C28lnh2e.js} +1 -1
- package/dist/{index-BiFsbM1Y.js → index-Dp8ExwuL.js} +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-DDVqSnRX.js +1 -0
- package/dist/{xlsx-util-DZ5-cWNj.js → xlsx-util-BMANxyk-.js} +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.mjs +10 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.mjs +309 -0
- package/es/editor/code/code-editor.controller.mjs +176 -1
- package/es/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/es/editor/code/monaco-editor/monaco-editor.mjs +116 -6
- package/es/editor/html/html-editor.controller.mjs +77 -2
- package/es/editor/html/wang-editor/index.mjs +1 -0
- package/es/editor/html/wang-editor/module/index.mjs +1 -0
- package/es/editor/html/wang-editor/module/inline-ai-module.mjs +95 -0
- package/es/editor/html/wang-editor/wang-editor.css +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +35 -4
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +45 -0
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +109 -13
- package/es/editor/markdown/markdown-editor.controller.mjs +113 -1
- package/es/index.mjs +1 -0
- package/es/locale/en/index.mjs +15 -2
- package/es/locale/zh-CN/index.mjs +15 -2
- package/es/util/ai-util/ai-util.mjs +6 -2
- package/es/util/app-util/app-util.mjs +41 -2
- package/es/util/index.mjs +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/icon.mjs +142 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +162 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +205 -0
- package/es/util/inline-ai-util/inline-ai-util.mjs +145 -0
- package/es/web-app/main.mjs +2 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs +10 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.cjs +311 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/lib/editor/code/code-editor.controller.cjs +175 -0
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +116 -6
- package/lib/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/lib/editor/html/html-editor.controller.cjs +75 -0
- package/lib/editor/html/wang-editor/index.cjs +3 -0
- package/lib/editor/html/wang-editor/module/index.cjs +3 -0
- package/lib/editor/html/wang-editor/module/inline-ai-module.cjs +98 -0
- package/lib/editor/html/wang-editor/wang-editor.cjs +35 -4
- package/lib/editor/html/wang-editor/wang-editor.css +1 -1
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +47 -0
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +109 -13
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/markdown/markdown-editor.controller.cjs +112 -0
- package/lib/index.cjs +2 -0
- package/lib/locale/en/index.cjs +15 -2
- package/lib/locale/zh-CN/index.cjs +15 -2
- package/lib/util/ai-util/ai-util.cjs +6 -2
- package/lib/util/app-util/app-util.cjs +40 -1
- package/lib/util/index.cjs +2 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/icon.cjs +151 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +207 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +167 -0
- package/lib/util/inline-ai-util/inline-ai-util.cjs +147 -0
- package/lib/web-app/main.cjs +2 -0
- package/package.json +5 -5
- package/dist/ibiz-markdown-editor-Cs1m7gKI.js +0 -1
- package/dist/index-Dds3BDDF.js +0 -11
- package/dist/wang-editor-4cJ6X_hb.js +0 -1
|
@@ -3,6 +3,7 @@ import { useNamespace, useUIStore, getEditorEmits, getMarkDownProps } from '@ibi
|
|
|
3
3
|
import { createUUID } from 'qx-util';
|
|
4
4
|
import Cherry from 'cherry-markdown';
|
|
5
5
|
import './ibiz-markdown-editor.css';
|
|
6
|
+
import { initCustomMenu } from './custom-menu.mjs';
|
|
6
7
|
|
|
7
8
|
"use strict";
|
|
8
9
|
const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
@@ -12,12 +13,13 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
12
13
|
setup(props, {
|
|
13
14
|
emit
|
|
14
15
|
}) {
|
|
15
|
-
var _a, _b;
|
|
16
|
+
var _a, _b, _c;
|
|
16
17
|
const ns = useNamespace("markdown");
|
|
17
18
|
const c = props.controller;
|
|
18
19
|
const currentVal = ref("");
|
|
19
20
|
let editor = null;
|
|
20
21
|
const id = createUUID();
|
|
22
|
+
const [AIMenu] = initCustomMenu(c);
|
|
21
23
|
const uploadHeaders = ibiz.util.file.getUploadHeaders();
|
|
22
24
|
const headers = ref({
|
|
23
25
|
...uploadHeaders
|
|
@@ -28,6 +30,12 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
28
30
|
UIStore
|
|
29
31
|
} = useUIStore();
|
|
30
32
|
const theme = ref(customTheme || UIStore.theme);
|
|
33
|
+
const isEditing = ref(false);
|
|
34
|
+
let showmode = "default";
|
|
35
|
+
if (c && ((_c = c.editorParams) == null ? void 0 : _c.showmode)) {
|
|
36
|
+
showmode = c.editorParams.showmode;
|
|
37
|
+
}
|
|
38
|
+
const isFullScreen = ref(false);
|
|
31
39
|
const defaultModel = ref("editOnly");
|
|
32
40
|
let resizeObserver = null;
|
|
33
41
|
let lastMarkDownWidth = 0;
|
|
@@ -91,7 +99,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
91
99
|
};
|
|
92
100
|
const setCherryContent = (val) => {
|
|
93
101
|
isIgnoreChange = true;
|
|
94
|
-
editor == null ? void 0 : editor.setMarkdown(val,
|
|
102
|
+
editor == null ? void 0 : editor.setMarkdown(val, true);
|
|
95
103
|
};
|
|
96
104
|
watch(() => props.value, (newVal, oldVal) => {
|
|
97
105
|
if (newVal !== oldVal) {
|
|
@@ -111,6 +119,9 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
111
119
|
}
|
|
112
120
|
});
|
|
113
121
|
const afterChange = (_e) => {
|
|
122
|
+
if (showmode === "manual") {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
114
125
|
emit("change", getCherryContent(), c == null ? void 0 : c.model.id, isIgnoreChange);
|
|
115
126
|
isIgnoreChange = false;
|
|
116
127
|
};
|
|
@@ -190,8 +201,10 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
190
201
|
if (editor && markDownBox.value) {
|
|
191
202
|
if (isFullscreen()) {
|
|
192
203
|
closeFullscreen();
|
|
204
|
+
isFullScreen.value = false;
|
|
193
205
|
} else {
|
|
194
206
|
openFullscreen();
|
|
207
|
+
isFullScreen.value = true;
|
|
195
208
|
}
|
|
196
209
|
}
|
|
197
210
|
};
|
|
@@ -200,15 +213,20 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
200
213
|
if (_e.key === "Escape") {
|
|
201
214
|
if (isFullscreen()) {
|
|
202
215
|
closeFullscreen();
|
|
216
|
+
isFullScreen.value = false;
|
|
203
217
|
}
|
|
204
218
|
}
|
|
205
219
|
};
|
|
206
220
|
const editorInit = () => {
|
|
207
|
-
if (props.disabled || props.readonly) {
|
|
221
|
+
if (props.disabled || props.readonly || showmode === "manual") {
|
|
208
222
|
defaultModel.value = "previewOnly";
|
|
209
223
|
}
|
|
210
224
|
nextTick(() => {
|
|
211
225
|
var _a2;
|
|
226
|
+
const bubble = ["bold", "italic", "underline", "strikethrough", "sub", "sup", "|", "size", "color"];
|
|
227
|
+
if (c.editorParams.ac && c.deACMode) {
|
|
228
|
+
bubble.unshift("AI");
|
|
229
|
+
}
|
|
212
230
|
editor = new Cherry({
|
|
213
231
|
id,
|
|
214
232
|
value: currentVal.value,
|
|
@@ -245,10 +263,28 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
245
263
|
toolbar: ["bold", "italic", "underline", "strikethrough", "|", "color", "header", "|", "list", "image", {
|
|
246
264
|
insert: ["link", "hr", "br", "code", "formula", "toc", "table", "line-table", "bar-table"]
|
|
247
265
|
}, "settings", "togglePreview"],
|
|
248
|
-
bubble
|
|
266
|
+
bubble,
|
|
249
267
|
float: ["h1", "h2", "h3", "|", "checklist", "quote", "quickTable", "code"],
|
|
250
|
-
customMenu:
|
|
251
|
-
|
|
268
|
+
customMenu: {
|
|
269
|
+
AI: AIMenu
|
|
270
|
+
},
|
|
271
|
+
// 定义侧边栏,默认为空
|
|
272
|
+
sidebar: ["theme", "copy"],
|
|
273
|
+
// 定义顶部右侧工具栏,默认为空
|
|
274
|
+
toolbarRight: [],
|
|
275
|
+
// 目录
|
|
276
|
+
toc: {
|
|
277
|
+
updateLocationHash: false,
|
|
278
|
+
// 要不要更新URL的hash
|
|
279
|
+
defaultModel: "pure",
|
|
280
|
+
// pure: 精简模式/缩略模式,只有一排小点; full: 完整模式,会展示所有标题
|
|
281
|
+
showAutoNumber: true,
|
|
282
|
+
// 是否显示自增序号
|
|
283
|
+
position: "absolute",
|
|
284
|
+
// 悬浮目录的悬浮方式。当滚动条在cherry内部时,用absolute;当滚动条在cherry外部时,用fixed
|
|
285
|
+
cssText: ""
|
|
286
|
+
// 自定义样式
|
|
287
|
+
}
|
|
252
288
|
},
|
|
253
289
|
callback: {
|
|
254
290
|
afterChange,
|
|
@@ -274,6 +310,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
274
310
|
span.appendChild(createCherryIcon("fullscreen"));
|
|
275
311
|
const parentElement = props.disabled ? editor.editor.options.editorDom.parentElement : (_a2 = editor.editor.options.editorDom.parentElement) == null ? void 0 : _a2.querySelector(".cherry-toolbar>.toolbar-right");
|
|
276
312
|
parentElement == null ? void 0 : parentElement.appendChild(span);
|
|
313
|
+
c.setMDEditor(editor);
|
|
277
314
|
});
|
|
278
315
|
};
|
|
279
316
|
watch(() => UIStore.theme, (newVal) => {
|
|
@@ -310,15 +347,70 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
310
347
|
resizeObserver.observe(markDownBox.value);
|
|
311
348
|
}
|
|
312
349
|
};
|
|
350
|
+
const onEnableEdit = () => {
|
|
351
|
+
isEditing.value = true;
|
|
352
|
+
defaultModel.value = "editOnly";
|
|
353
|
+
editor == null ? void 0 : editor.switchModel(defaultModel.value);
|
|
354
|
+
};
|
|
355
|
+
const onResetEditState = () => {
|
|
356
|
+
isEditing.value = false;
|
|
357
|
+
defaultModel.value = "previewOnly";
|
|
358
|
+
editor == null ? void 0 : editor.switchModel(defaultModel.value);
|
|
359
|
+
};
|
|
360
|
+
const onEditCancel = () => {
|
|
361
|
+
setCherryContent(currentVal.value);
|
|
362
|
+
onResetEditState();
|
|
363
|
+
};
|
|
364
|
+
const onEditConfirm = () => {
|
|
365
|
+
emit("change", getCherryContent(), c == null ? void 0 : c.model.id, isIgnoreChange);
|
|
366
|
+
isIgnoreChange = false;
|
|
367
|
+
onResetEditState();
|
|
368
|
+
};
|
|
369
|
+
const renderHeader = () => {
|
|
370
|
+
if (showmode === "manual" && !isEditing.value) {
|
|
371
|
+
return createVNode("div", {
|
|
372
|
+
"class": [ns.e("header"), ns.is("fullscreen", isFullScreen.value)]
|
|
373
|
+
}, [!props.disabled && !props.readonly && createVNode("div", {
|
|
374
|
+
"class": ns.em("header", "edit"),
|
|
375
|
+
"onClick": onEnableEdit,
|
|
376
|
+
"title": ibiz.i18n.t("editor.markdown.edit")
|
|
377
|
+
}, [createVNode("i", {
|
|
378
|
+
"class": "fa fa-edit",
|
|
379
|
+
"aria-hidden": "true"
|
|
380
|
+
}, null)]), createVNode("div", {
|
|
381
|
+
"class": ns.em("header", "full"),
|
|
382
|
+
"onClick": onSwitchFullscreen
|
|
383
|
+
}, [isFullScreen.value ? createVNode("i", {
|
|
384
|
+
"class": "fa fa-compress",
|
|
385
|
+
"aria-hidden": "true",
|
|
386
|
+
"title": ibiz.i18n.t("editor.html.reduce")
|
|
387
|
+
}, null) : createVNode("i", {
|
|
388
|
+
"class": "fa fa-expand",
|
|
389
|
+
"aria-hidden": "true",
|
|
390
|
+
"title": ibiz.i18n.t("editor.common.fullscreen")
|
|
391
|
+
}, null)])]);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
const renderFooter = () => {
|
|
395
|
+
if (showmode === "manual" && isEditing.value && !props.disabled && !props.readonly) {
|
|
396
|
+
return createVNode("div", {
|
|
397
|
+
"class": [ns.e("footer"), ns.is("fullscreen", isFullScreen.value)]
|
|
398
|
+
}, [createVNode("div", {
|
|
399
|
+
"class": ns.em("footer", "cancel"),
|
|
400
|
+
"onClick": onEditCancel
|
|
401
|
+
}, [ibiz.i18n.t("editor.common.cancel")]), createVNode("div", {
|
|
402
|
+
"class": ns.em("footer", "save"),
|
|
403
|
+
"onClick": onEditConfirm
|
|
404
|
+
}, [ibiz.i18n.t("editor.common.confirm")])]);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
313
407
|
onMounted(() => {
|
|
314
|
-
var _a2;
|
|
315
408
|
editorInit();
|
|
316
409
|
calcMarkDownStyle();
|
|
317
|
-
|
|
410
|
+
document.addEventListener("keydown", handleKeyDown.bind(this));
|
|
318
411
|
});
|
|
319
412
|
onBeforeUnmount(() => {
|
|
320
|
-
|
|
321
|
-
(_a2 = markDownBox.value) == null ? void 0 : _a2.removeEventListener("keydown", handleKeyDown.bind(this));
|
|
413
|
+
document.removeEventListener("keydown", handleKeyDown.bind(this));
|
|
322
414
|
});
|
|
323
415
|
onUnmounted(() => {
|
|
324
416
|
editor = null;
|
|
@@ -336,16 +428,20 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
336
428
|
theme,
|
|
337
429
|
defaultModel,
|
|
338
430
|
cssVars,
|
|
431
|
+
isEditing,
|
|
432
|
+
showmode,
|
|
339
433
|
getCherryHtml,
|
|
340
434
|
getCherryContent,
|
|
341
|
-
setCherryContent
|
|
435
|
+
setCherryContent,
|
|
436
|
+
renderHeader,
|
|
437
|
+
renderFooter
|
|
342
438
|
};
|
|
343
439
|
},
|
|
344
440
|
render() {
|
|
345
441
|
return createVNode("div", {
|
|
346
442
|
"ref": "markDownBox",
|
|
347
|
-
"class": [this.ns.b(), this.ns.is("disabled", this.disabled)]
|
|
348
|
-
}, [createVNode("div", {
|
|
443
|
+
"class": [this.ns.b(), this.ns.is("disabled", this.disabled), this.ns.is("manual", this.showmode === "manual"), this.ns.is("editing", this.isEditing)]
|
|
444
|
+
}, [this.renderHeader(), this.renderFooter(), createVNode("div", {
|
|
349
445
|
"id": this.id,
|
|
350
446
|
"style": this.cssVars,
|
|
351
447
|
"class": this.ns.b("cherry")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeModelError } from '@ibiz-template/core';
|
|
2
|
-
import { EditorController, getDeACMode } from '@ibiz-template/runtime';
|
|
2
|
+
import { EditorController, getDeACMode, UIActionUtil } from '@ibiz-template/runtime';
|
|
3
3
|
|
|
4
4
|
"use strict";
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -75,6 +75,20 @@ class MarkDownEditorController extends EditorController {
|
|
|
75
75
|
* @type {boolean}
|
|
76
76
|
*/
|
|
77
77
|
__publicField(this, "chatCompletion", false);
|
|
78
|
+
/**
|
|
79
|
+
* 编辑器实例
|
|
80
|
+
*
|
|
81
|
+
* @type {IData}
|
|
82
|
+
* @memberof MarkDownEditorController
|
|
83
|
+
*/
|
|
84
|
+
__publicField(this, "mdeditor", null);
|
|
85
|
+
/**
|
|
86
|
+
* 选区位置缓存
|
|
87
|
+
*
|
|
88
|
+
* @type {(IData | null)}
|
|
89
|
+
* @memberof MarkDownEditorController
|
|
90
|
+
*/
|
|
91
|
+
__publicField(this, "selectionAreaPosition", null);
|
|
78
92
|
}
|
|
79
93
|
async onInit() {
|
|
80
94
|
await super.onInit();
|
|
@@ -141,6 +155,104 @@ class MarkDownEditorController extends EditorController {
|
|
|
141
155
|
}
|
|
142
156
|
}
|
|
143
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* 设置编辑器实例
|
|
160
|
+
*
|
|
161
|
+
* @param {IData} mdeditor
|
|
162
|
+
* @memberof MarkDownEditorController
|
|
163
|
+
*/
|
|
164
|
+
setMDEditor(mdeditor) {
|
|
165
|
+
this.mdeditor = mdeditor;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 设置保存当前选区位置
|
|
169
|
+
*
|
|
170
|
+
* @param {IData} start
|
|
171
|
+
* @param {IData} end
|
|
172
|
+
* @memberof MarkDownEditorController
|
|
173
|
+
*/
|
|
174
|
+
setCursorPos(start, end) {
|
|
175
|
+
this.selectionAreaPosition = { start, end };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 获取选中文本
|
|
179
|
+
*
|
|
180
|
+
* @return {*} {string}
|
|
181
|
+
* @memberof MarkDownEditorController
|
|
182
|
+
*/
|
|
183
|
+
getSelectionText() {
|
|
184
|
+
var _a;
|
|
185
|
+
return (_a = this.mdeditor) == null ? void 0 : _a.editor.editor.getSelection();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 插入文本
|
|
189
|
+
*
|
|
190
|
+
* @param {string} text
|
|
191
|
+
* @memberof MarkDownEditorController
|
|
192
|
+
*/
|
|
193
|
+
insertText(text) {
|
|
194
|
+
var _a;
|
|
195
|
+
(_a = this.mdeditor) == null ? void 0 : _a.insert(text);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* 替换选中文本
|
|
199
|
+
*
|
|
200
|
+
* @param {string} text
|
|
201
|
+
* @memberof MarkDownEditorController
|
|
202
|
+
*/
|
|
203
|
+
replaceSelectionText(text) {
|
|
204
|
+
var _a;
|
|
205
|
+
(_a = this.mdeditor) == null ? void 0 : _a.editor.editor.replaceSelection(text);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* 恢复选区
|
|
209
|
+
*
|
|
210
|
+
* @memberof MarkDownEditorController
|
|
211
|
+
*/
|
|
212
|
+
restoreSelection() {
|
|
213
|
+
var _a, _b, _c;
|
|
214
|
+
(_c = this.mdeditor) == null ? void 0 : _c.editor.editor.setSelection(
|
|
215
|
+
(_a = this.selectionAreaPosition) == null ? void 0 : _a.start,
|
|
216
|
+
(_b = this.selectionAreaPosition) == null ? void 0 : _b.end
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* 获取内联AI参数
|
|
221
|
+
*
|
|
222
|
+
* @return {*} {IData}
|
|
223
|
+
* @memberof MarkDownEditorController
|
|
224
|
+
*/
|
|
225
|
+
getInLineAiChatOptions() {
|
|
226
|
+
var _a;
|
|
227
|
+
const editorRect = (_a = this.mdeditor) == null ? void 0 : _a.wrapperDom.getBoundingClientRect();
|
|
228
|
+
return {
|
|
229
|
+
left: editorRect == null ? void 0 : editorRect.left,
|
|
230
|
+
top: editorRect == null ? void 0 : editorRect.top,
|
|
231
|
+
width: editorRect == null ? void 0 : editorRect.width
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* 执行内联AIUI操作
|
|
236
|
+
*
|
|
237
|
+
* @param {string} _uiAction
|
|
238
|
+
* @param {string} _appId
|
|
239
|
+
* @return {*} {Promise<void>}
|
|
240
|
+
* @memberof MarkDownEditorController
|
|
241
|
+
*/
|
|
242
|
+
async doInLineAIUIAction(uiActionId, appId) {
|
|
243
|
+
const eventArgs = this.ctrl.getEventArgs();
|
|
244
|
+
eventArgs.params.editor = this;
|
|
245
|
+
if (this.editorParams.srfaiappendcurdata && this.editorParams.srfaiappendcurdata === "true") {
|
|
246
|
+
eventArgs.context.srfaiappendcurdata = true;
|
|
247
|
+
}
|
|
248
|
+
await UIActionUtil.exec(
|
|
249
|
+
uiActionId,
|
|
250
|
+
{
|
|
251
|
+
...eventArgs
|
|
252
|
+
},
|
|
253
|
+
appId
|
|
254
|
+
);
|
|
255
|
+
}
|
|
144
256
|
}
|
|
145
257
|
|
|
146
258
|
export { MarkDownEditorController };
|
package/es/index.mjs
CHANGED
|
@@ -180,6 +180,7 @@ export { FullscreenUtil } from './util/fullscreen/fullscreen-util.mjs';
|
|
|
180
180
|
export { useFocusByEnter } from './util/keydown-util/keydown-util.mjs';
|
|
181
181
|
export { calcAiToolbarItemsByAc } from './util/ai-util/ai-util.mjs';
|
|
182
182
|
export { convertBtnType } from './util/button-util/button-util.mjs';
|
|
183
|
+
export { InLineAIUtil } from './util/inline-ai-util/inline-ai-util.mjs';
|
|
183
184
|
export { parseHtml } from './util/wang-editor-util/wang-editor-util.mjs';
|
|
184
185
|
export { ArrowLeftBold, ArrowRightBold } from './util/icon/icon.mjs';
|
|
185
186
|
export { AuthGuard } from './web-app/guard/auth-guard/auth-guard.mjs';
|
package/es/locale/en/index.mjs
CHANGED
|
@@ -621,7 +621,11 @@ var index = {
|
|
|
621
621
|
}
|
|
622
622
|
},
|
|
623
623
|
code: {
|
|
624
|
-
readOnlyPrompt: "Currently in read-only mode, not editable"
|
|
624
|
+
readOnlyPrompt: "Currently in read-only mode, not editable",
|
|
625
|
+
noEditorArea: "Editor content area not found",
|
|
626
|
+
noSelStart: "No start position of current selection",
|
|
627
|
+
noEditorRect: "No editor DOM node position info",
|
|
628
|
+
noSelCoords: "No scroll coordinates of selection"
|
|
625
629
|
},
|
|
626
630
|
dateRange: {
|
|
627
631
|
rangeSeparator: "To"
|
|
@@ -657,7 +661,8 @@ var index = {
|
|
|
657
661
|
},
|
|
658
662
|
markdown: {
|
|
659
663
|
uploadJsonFormatErr: "The configuration of uploadparams did not follow the standard JSON format",
|
|
660
|
-
exportJsonFormatErr: "The configuration of exportparams did not follow the standard JSON format"
|
|
664
|
+
exportJsonFormatErr: "The configuration of exportparams did not follow the standard JSON format",
|
|
665
|
+
edit: "Edit"
|
|
661
666
|
},
|
|
662
667
|
notSupportedEditor: {
|
|
663
668
|
unsupportedType: "Unsupported editor types - {editorType}"
|
|
@@ -830,6 +835,14 @@ var index = {
|
|
|
830
835
|
appModal: {
|
|
831
836
|
prev: "Previous record",
|
|
832
837
|
next: "Next record"
|
|
838
|
+
},
|
|
839
|
+
inlineAiUtil: {
|
|
840
|
+
regenerate: "Regenerate",
|
|
841
|
+
insertText: "Insert Text",
|
|
842
|
+
replaceText: "Replace Text",
|
|
843
|
+
copyText: "Copy Text",
|
|
844
|
+
info: "The content is generated by AI, please carefully discern.",
|
|
845
|
+
stopEdit: "Terminate editing"
|
|
833
846
|
}
|
|
834
847
|
},
|
|
835
848
|
// runTime
|
|
@@ -617,7 +617,11 @@ var index = {
|
|
|
617
617
|
}
|
|
618
618
|
},
|
|
619
619
|
code: {
|
|
620
|
-
readOnlyPrompt: "\u5F53\u524D\u4E3A\u53EA\u8BFB\u6A21\u5F0F\uFF0C\u4E0D\u53EF\u7F16\u8F91"
|
|
620
|
+
readOnlyPrompt: "\u5F53\u524D\u4E3A\u53EA\u8BFB\u6A21\u5F0F\uFF0C\u4E0D\u53EF\u7F16\u8F91",
|
|
621
|
+
noEditorArea: "\u672A\u627E\u5230\u7F16\u8F91\u5668\u5185\u5BB9\u533A\u57DF",
|
|
622
|
+
noSelStart: "\u672A\u83B7\u53D6\u5230\u5F53\u524D\u9009\u4E2D\u533A\u57DF\u7684\u8D77\u59CB\u4F4D\u7F6E",
|
|
623
|
+
noEditorRect: "\u672A\u83B7\u53D6\u5230\u7F16\u8F91\u5668DOM\u8282\u70B9\u7684\u4F4D\u7F6E\u4FE1\u606F",
|
|
624
|
+
noSelCoords: "\u672A\u8BA1\u7B97\u51FA\u9009\u4E2D\u4F4D\u7F6E\u7684\u6EDA\u52A8\u53EF\u89C6\u5750\u6807"
|
|
621
625
|
},
|
|
622
626
|
dateRange: {
|
|
623
627
|
rangeSeparator: "\u81F3"
|
|
@@ -653,7 +657,8 @@ var index = {
|
|
|
653
657
|
},
|
|
654
658
|
markdown: {
|
|
655
659
|
uploadJsonFormatErr: "\u914D\u7F6Euploadparams\u6CA1\u6709\u6309\u6807\u51C6JSON\u683C\u5F0F",
|
|
656
|
-
exportJsonFormatErr: "\u914D\u7F6Eexportparams\u6CA1\u6709\u6309\u6807\u51C6JSON\u683C\u5F0F"
|
|
660
|
+
exportJsonFormatErr: "\u914D\u7F6Eexportparams\u6CA1\u6709\u6309\u6807\u51C6JSON\u683C\u5F0F",
|
|
661
|
+
edit: "\u7F16\u8F91"
|
|
657
662
|
},
|
|
658
663
|
notSupportedEditor: {
|
|
659
664
|
unsupportedType: "\u672A\u652F\u6301\u7684\u7F16\u8F91\u5668\u7C7B\u578B - {type}"
|
|
@@ -826,6 +831,14 @@ var index = {
|
|
|
826
831
|
appModal: {
|
|
827
832
|
prev: "\u4E0A\u4E00\u4E2A\u8BB0\u5F55",
|
|
828
833
|
next: "\u4E0B\u4E00\u4E2A\u8BB0\u5F55"
|
|
834
|
+
},
|
|
835
|
+
inlineAiUtil: {
|
|
836
|
+
regenerate: "\u91CD\u65B0\u751F\u6210",
|
|
837
|
+
insertText: "\u63D2\u5165\u6587\u672C",
|
|
838
|
+
replaceText: "\u66FF\u6362\u6587\u672C",
|
|
839
|
+
copyText: "\u590D\u5236\u6587\u672C",
|
|
840
|
+
info: "\u5185\u5BB9\u7531 AI \u751F\u6210\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B\u3002",
|
|
841
|
+
stopEdit: "\u7EC8\u6B62\u7F16\u8F91"
|
|
829
842
|
}
|
|
830
843
|
},
|
|
831
844
|
// runTime
|
|
@@ -5,10 +5,11 @@ function calcAiToolbarItemsByAc(deACMode) {
|
|
|
5
5
|
const footerToolbarItems = [];
|
|
6
6
|
const questionToolbarItems = [];
|
|
7
7
|
const functionToolbarItems = [];
|
|
8
|
+
const inlineToolbarItems = [];
|
|
8
9
|
const otherToolbarItems = [];
|
|
9
10
|
(_b = (_a = deACMode.deuiactionGroup) == null ? void 0 : _a.uiactionGroupDetails) == null ? void 0 : _b.forEach(
|
|
10
11
|
(item) => {
|
|
11
|
-
var _a2, _b2, _c, _d, _e, _f;
|
|
12
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
12
13
|
const toolbarItem = {
|
|
13
14
|
appId: item.appId,
|
|
14
15
|
id: item.uiactionId,
|
|
@@ -31,6 +32,8 @@ function calcAiToolbarItemsByAc(deACMode) {
|
|
|
31
32
|
questionToolbarItems.push(toolbarItem);
|
|
32
33
|
} else if ((_f = item.uiactionId) == null ? void 0 : _f.startsWith("function_")) {
|
|
33
34
|
functionToolbarItems.push(toolbarItem);
|
|
35
|
+
} else if (((_g = item.uiactionId) == null ? void 0 : _g.startsWith("inline")) || item.refUIActionGroup && ((_h = item.refUIActionGroup.id) == null ? void 0 : _h.startsWith("inline"))) {
|
|
36
|
+
inlineToolbarItems.push(toolbarItem);
|
|
34
37
|
} else {
|
|
35
38
|
otherToolbarItems.push(toolbarItem);
|
|
36
39
|
}
|
|
@@ -41,7 +44,8 @@ function calcAiToolbarItemsByAc(deACMode) {
|
|
|
41
44
|
footerToolbarItems,
|
|
42
45
|
questionToolbarItems,
|
|
43
46
|
otherToolbarItems,
|
|
44
|
-
functionToolbarItems
|
|
47
|
+
functionToolbarItems,
|
|
48
|
+
inlineToolbarItems
|
|
45
49
|
};
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getDeACMode, calcDeCodeNameById, UIActionUtil, SysUIActionTag, ConfigService } from '@ibiz-template/runtime';
|
|
2
2
|
import { createUUID } from 'qx-util';
|
|
3
|
-
import { IBizContext } from '@ibiz-template/core';
|
|
3
|
+
import { StringUtil, IBizContext } from '@ibiz-template/core';
|
|
4
4
|
import { route2routePath, useUIStore, routePath2string } from '@ibiz-template/vue3-util';
|
|
5
5
|
import { calcAiToolbarItemsByAc } from '../ai-util/ai-util.mjs';
|
|
6
6
|
|
|
@@ -184,6 +184,42 @@ class AppUtil {
|
|
|
184
184
|
}
|
|
185
185
|
return true;
|
|
186
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* 计算AI扩展参数
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
* @param {IData} params
|
|
192
|
+
* @return {*} {IData}
|
|
193
|
+
*/
|
|
194
|
+
computeAiExParams(context, params, data) {
|
|
195
|
+
const exParams = {};
|
|
196
|
+
if (params.hasOwnProperty("autoquestion")) {
|
|
197
|
+
exParams.autoQuestion = params.autoquestion !== "false";
|
|
198
|
+
delete params.autoquestion;
|
|
199
|
+
}
|
|
200
|
+
if (params.hasOwnProperty("openmode")) {
|
|
201
|
+
exParams.openMode = params.openmode;
|
|
202
|
+
delete params.openmode;
|
|
203
|
+
}
|
|
204
|
+
if (params.hasOwnProperty("autoclose")) {
|
|
205
|
+
try {
|
|
206
|
+
exParams.autoClose = JSON.parse(params.autoclose);
|
|
207
|
+
delete params.autoclose;
|
|
208
|
+
} catch (error) {
|
|
209
|
+
ibiz.log.error(error);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (params.hasOwnProperty("srfaiappendcurcontent")) {
|
|
213
|
+
exParams.appendCurContent = StringUtil.fill(
|
|
214
|
+
params.srfaiappendcurcontent,
|
|
215
|
+
context,
|
|
216
|
+
params,
|
|
217
|
+
data
|
|
218
|
+
);
|
|
219
|
+
delete params.srfaiappendcurcontent;
|
|
220
|
+
}
|
|
221
|
+
return exParams;
|
|
222
|
+
}
|
|
187
223
|
/**
|
|
188
224
|
* 打开AI聊天
|
|
189
225
|
*
|
|
@@ -201,6 +237,7 @@ class AppUtil {
|
|
|
201
237
|
appDEACModeId,
|
|
202
238
|
appDataEntityId
|
|
203
239
|
} = chartParams;
|
|
240
|
+
const exParams = this.computeAiExParams(context, params, data);
|
|
204
241
|
const deACMode = await getDeACMode(
|
|
205
242
|
appDEACModeId,
|
|
206
243
|
appDataEntityId,
|
|
@@ -449,7 +486,9 @@ class AppUtil {
|
|
|
449
486
|
}
|
|
450
487
|
}
|
|
451
488
|
return result;
|
|
452
|
-
}
|
|
489
|
+
},
|
|
490
|
+
// 扩展参数
|
|
491
|
+
...exParams
|
|
453
492
|
}
|
|
454
493
|
});
|
|
455
494
|
});
|
package/es/util/index.mjs
CHANGED
|
@@ -15,5 +15,6 @@ export { useFocusByEnter } from './keydown-util/keydown-util.mjs';
|
|
|
15
15
|
export { calcAiToolbarItemsByAc } from './ai-util/ai-util.mjs';
|
|
16
16
|
export { convertBtnType } from './button-util/button-util.mjs';
|
|
17
17
|
export { ArrowLeftBold, ArrowRightBold } from './icon/icon.mjs';
|
|
18
|
+
export { InLineAIUtil } from './inline-ai-util/inline-ai-util.mjs';
|
|
18
19
|
|
|
19
20
|
"use strict";
|