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