@ibiz-template/vue3-components 0.7.41-alpha.36 → 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-CxXULY47.js → xlsx-util-BMANxyk-.js} +1 -1
- package/es/control/calendar/calendar.mjs +33 -8
- 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/form-mdctrl-repeater.util.mjs +30 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs +114 -85
- 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/control/tab-exp-panel/tab-exp-panel.mjs +4 -17
- 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/editor/text-box/input/input.css +1 -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/panel-component/nav-breadcrumb/nav-breadcrumb.util.mjs +1 -1
- package/es/panel-component/user-message/internal-message/internal-message-json/internal-message-json.provider.mjs +2 -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/calendar/calendar.cjs +32 -7
- 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/form-mdctrl-repeater.util.cjs +32 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.cjs +113 -84
- 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/control/tab-exp-panel/tab-exp-panel.cjs +3 -16
- 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/editor/text-box/input/input.css +1 -1
- 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/panel-component/nav-breadcrumb/nav-breadcrumb.util.cjs +1 -1
- package/lib/panel-component/user-message/internal-message/internal-message-json/internal-message-json.provider.cjs +2 -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-CCKb6xlM.js +0 -11
- package/dist/wang-editor-BIllIvre.js +0 -1
|
@@ -25,12 +25,22 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
25
25
|
const c = props.controller;
|
|
26
26
|
const UUID = qxUtil.createUUID();
|
|
27
27
|
const currentVal = vue.ref("");
|
|
28
|
+
const {
|
|
29
|
+
UIStore,
|
|
30
|
+
zIndex
|
|
31
|
+
} = vue3Util.useUIStore();
|
|
28
32
|
const enableEdit = vue.ref(true);
|
|
29
33
|
const hasEnableEdit = vue.ref(false);
|
|
30
34
|
const readonlyState = vue.ref(false);
|
|
31
35
|
const enableFullScreen = vue.ref(false);
|
|
32
36
|
const isFullScreen = vue.ref(false);
|
|
33
37
|
const isLoading = vue.ref(false);
|
|
38
|
+
let autoClose;
|
|
39
|
+
const textTBRef = vue.ref();
|
|
40
|
+
const textTBStyle = vue.ref({
|
|
41
|
+
[ns.cssVarBlockName("text-editor-toolbar-z-index")]: zIndex.increment()
|
|
42
|
+
});
|
|
43
|
+
const textTBVisible = vue.ref(false);
|
|
34
44
|
const editorModel = c.model;
|
|
35
45
|
if (editorModel.editorParams) {
|
|
36
46
|
if (editorModel.editorParams.enableEdit) {
|
|
@@ -49,6 +59,13 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
49
59
|
if (editorModel.editorParams.enablefullscreen) {
|
|
50
60
|
enableFullScreen.value = c.toBoolean(editorModel.editorParams.enablefullscreen);
|
|
51
61
|
}
|
|
62
|
+
if (editorModel.editorParams.autoclose) {
|
|
63
|
+
try {
|
|
64
|
+
autoClose = JSON.parse(editorModel.editorParams.autoclose);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
ibiz.log.error(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
52
69
|
}
|
|
53
70
|
let editor;
|
|
54
71
|
let monacoEditor;
|
|
@@ -56,10 +73,6 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
56
73
|
let inlineCompletionsProviderDisposable;
|
|
57
74
|
let decorationsCollection;
|
|
58
75
|
let chatInstance;
|
|
59
|
-
const {
|
|
60
|
-
UIStore,
|
|
61
|
-
zIndex
|
|
62
|
-
} = vue3Util.useUIStore();
|
|
63
76
|
const getMonacoTheme = (name) => {
|
|
64
77
|
var _a;
|
|
65
78
|
const customTheme = (_a = c == null ? void 0 : c.editorParams) == null ? void 0 : _a.customTheme;
|
|
@@ -139,6 +152,14 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
139
152
|
},
|
|
140
153
|
// 编辑器参数srfaiappendcurdata,是否传入对象参数,用于历史查询传参
|
|
141
154
|
appendCurData: c.editorParams.srfaiappendcurdata === "true" ? props.data : void 0,
|
|
155
|
+
// 自动提问
|
|
156
|
+
autoQuestion: c.editorParams.autoquestion !== "false",
|
|
157
|
+
// 自动填充
|
|
158
|
+
autoFill: c.editorParams.autofill === "true",
|
|
159
|
+
// 窗口的打开模式
|
|
160
|
+
openMode: c.editorParams.openmode,
|
|
161
|
+
// 窗口的自动关闭模式
|
|
162
|
+
autoClose,
|
|
142
163
|
// 编辑器参数srfaiappendcurcontent,传入编辑内容作为用户消息,获取历史数据后附加
|
|
143
164
|
appendCurContent: c.editorParams.srfaiappendcurcontent ? core.StringUtil.fill(c.editorParams.srfaiappendcurcontent, c.context, c.params, props.data) : void 0,
|
|
144
165
|
appDataEntityId: c.model.appDataEntityId,
|
|
@@ -311,6 +332,62 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
311
332
|
return false;
|
|
312
333
|
return true;
|
|
313
334
|
};
|
|
335
|
+
const updateTextToolbarPos = (selection) => {
|
|
336
|
+
var _a;
|
|
337
|
+
const position = selection.getStartPosition();
|
|
338
|
+
if (position) {
|
|
339
|
+
const coordinates = editor == null ? void 0 : editor.getScrolledVisiblePosition(position);
|
|
340
|
+
const editorRect = (_a = editor == null ? void 0 : editor.getDomNode()) == null ? void 0 : _a.getBoundingClientRect();
|
|
341
|
+
if (!editorRect || !coordinates)
|
|
342
|
+
return;
|
|
343
|
+
textTBStyle.value = {
|
|
344
|
+
...textTBStyle.value,
|
|
345
|
+
[ns.cssVarBlockName("text-editor-toolbar-left")]: "".concat(editorRect.left + coordinates.left, "px"),
|
|
346
|
+
[ns.cssVarBlockName("text-editor-toolbar-top")]: "".concat(editorRect.top + coordinates.top + 28, "px")
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
const setTextTBVisible = () => {
|
|
351
|
+
if (props.readonly || !enableEdit.value || !c.deACMode)
|
|
352
|
+
return;
|
|
353
|
+
const selection = editor == null ? void 0 : editor.getSelection();
|
|
354
|
+
textTBVisible.value = !!(selection && !selection.isEmpty());
|
|
355
|
+
};
|
|
356
|
+
const onSelectionChange = (e) => {
|
|
357
|
+
const selection = e.selection;
|
|
358
|
+
if (selection) {
|
|
359
|
+
updateTextToolbarPos(selection);
|
|
360
|
+
c.currentSelection = selection;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
const handleLineAiClick = (_e) => {
|
|
364
|
+
var _a, _b;
|
|
365
|
+
const position = (_a = editor == null ? void 0 : editor.getSelection()) == null ? void 0 : _a.getStartPosition();
|
|
366
|
+
if (!position)
|
|
367
|
+
return;
|
|
368
|
+
const coordinates = editor == null ? void 0 : editor.getScrolledVisiblePosition(position);
|
|
369
|
+
const editorRect = (_b = editor == null ? void 0 : editor.getDomNode()) == null ? void 0 : _b.getBoundingClientRect();
|
|
370
|
+
if (!coordinates || !editorRect)
|
|
371
|
+
return;
|
|
372
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
373
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
374
|
+
});
|
|
375
|
+
if (items.length === 0)
|
|
376
|
+
return;
|
|
377
|
+
ibiz.inLineAIUtil.showContextMenus(editorRect.left + coordinates.left, editorRect.top + coordinates.top + 28 + 40, items);
|
|
378
|
+
};
|
|
379
|
+
const handleEditorClick = (e) => {
|
|
380
|
+
var _a;
|
|
381
|
+
if (!((_a = textTBRef.value) == null ? void 0 : _a.contains(e.target))) {
|
|
382
|
+
setTimeout(setTextTBVisible, 100);
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
const handleMousedown = (e) => {
|
|
386
|
+
var _a;
|
|
387
|
+
if (textTBVisible.value && !((_a = textTBRef.value) == null ? void 0 : _a.contains(e.target))) {
|
|
388
|
+
textTBVisible.value = false;
|
|
389
|
+
}
|
|
390
|
+
};
|
|
314
391
|
const editorInit = () => {
|
|
315
392
|
vue.nextTick(() => {
|
|
316
393
|
isLoading.value = true;
|
|
@@ -320,6 +397,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
320
397
|
}
|
|
321
398
|
});
|
|
322
399
|
index.default.init().then((loaderMonaco) => {
|
|
400
|
+
var _a;
|
|
323
401
|
isLoading.value = false;
|
|
324
402
|
if (!editor) {
|
|
325
403
|
monacoEditor = loaderMonaco.editor;
|
|
@@ -376,6 +454,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
376
454
|
});
|
|
377
455
|
}
|
|
378
456
|
}
|
|
457
|
+
c.onCreated(editor, loaderMonaco);
|
|
379
458
|
setTimeout(() => {
|
|
380
459
|
editor.layout();
|
|
381
460
|
editor.setValue(currentVal.value);
|
|
@@ -408,11 +487,14 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
408
487
|
createDecorationsCollection();
|
|
409
488
|
});
|
|
410
489
|
editor.onDidChangeModelContent(() => {
|
|
490
|
+
setTextTBVisible();
|
|
411
491
|
if (!hasEnableEdit.value) {
|
|
412
492
|
currentVal.value = editor.getValue();
|
|
413
493
|
emit("change", currentVal.value);
|
|
414
494
|
}
|
|
415
495
|
});
|
|
496
|
+
editor.onDidChangeCursorSelection(onSelectionChange);
|
|
497
|
+
(_a = editor.getDomNode()) == null ? void 0 : _a.addEventListener("click", handleEditorClick);
|
|
416
498
|
window.addEventListener("resize", () => {
|
|
417
499
|
editor.layout();
|
|
418
500
|
});
|
|
@@ -528,11 +610,37 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
528
610
|
}
|
|
529
611
|
}, null);
|
|
530
612
|
};
|
|
613
|
+
const renderTextEditorToolbar = () => {
|
|
614
|
+
if (!textTBVisible.value)
|
|
615
|
+
return null;
|
|
616
|
+
return vue.createVNode("div", {
|
|
617
|
+
"ref": "textTBRef",
|
|
618
|
+
"class": [ns.b("text-editor-toolbar")],
|
|
619
|
+
"style": {
|
|
620
|
+
...textTBStyle.value
|
|
621
|
+
}
|
|
622
|
+
}, [vue.createVNode("div", {
|
|
623
|
+
"class": [ns.be("text-editor-toolbar", "item")],
|
|
624
|
+
"title": "AI",
|
|
625
|
+
"onClick": handleLineAiClick
|
|
626
|
+
}, [vue.createVNode("svg", {
|
|
627
|
+
"version": "1.1",
|
|
628
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
629
|
+
"viewBox": "0 0 1024 1024",
|
|
630
|
+
"width": "1em",
|
|
631
|
+
"height": "1em",
|
|
632
|
+
"fill": "currentColor"
|
|
633
|
+
}, [vue.createVNode("path", {
|
|
634
|
+
"d": "M274.344554 173.673875c16.429399 0 30.950568 8.00526 39.956484 20.338945a34.906655 34.906655 0 0 1 14.660796 15.754537l1.117013 2.815803 210.138065 597.927736c6.795162 19.268474-5.329083 40.817516-27.041022 48.147913-20.641469 6.95806-42.493035-1.419537-50.451753-18.803052l-1.117013-2.815803-54.477653-154.939008H134.997185L80.566074 837.039954c-6.771891 19.268474-29.856826 28.949253-51.568765 21.618855-20.641469-6.981331-32.602816-26.761769-27.925325-45.239025l0.861031-2.908888L212.047809 212.58316c4.025901-11.426112 13.799764-19.477914 25.598214-22.619512 9.029188-10.006575 22.107548-16.289773 36.67526-16.289773z m386.416675 169.460176c21.828295 0 39.723774 10.890876 41.469106 24.713912l0.116356 2.210755v461.652153c0 14.893506-18.616883 26.947938-41.585462 26.947938-21.805024 0-39.700503-10.890876-41.422565-24.737183l-0.162897-2.210755V370.081989c0-14.870235 18.616883-26.924667 41.585462-26.924667z m-389.697901-48.171184L163.620643 600.628812h214.88537l-107.442685-305.665945z m602.163076-206.181978a12.566396 12.566396 0 0 1 8.144887 8.051802l32.509731 99.041817 101.694723 36.07021a12.566396 12.566396 0 0 1-0.791218 23.922695l-99.53051 27.995137-30.857483 97.552467a12.566396 12.566396 0 0 1-23.899423 0.116355l-32.509732-99.018546-98.669479-31.322905a12.566396 12.566396 0 0 1-0.186169-23.876152l97.505924-32.812256 30.834212-97.529195a12.566396 12.566396 0 0 1 15.754537-8.191429zM649.544557 0.513593c2.676177 0.884302 4.770576 3.025243 5.608336 5.724692l18.523798 59.294772 60.970292 20.66474a8.796477 8.796477 0 0 1-0.325796 16.755194l-60.73758 18.058377-19.780438 59.550754a8.796477 8.796477 0 0 1-16.731924-0.162898l-18.523798-59.271501-59.062061-17.825665a8.796477 8.796477 0 0 1-0.395609-16.708653l59.574025-20.943993 19.780438-59.574025a8.796477 8.796477 0 0 1 11.100317-5.561794z"
|
|
635
|
+
}, null)])])]);
|
|
636
|
+
};
|
|
531
637
|
vue.onMounted(() => {
|
|
532
638
|
editorInit();
|
|
639
|
+
window.addEventListener("mousedown", handleMousedown.bind(this));
|
|
533
640
|
});
|
|
534
641
|
vue.onUnmounted(() => {
|
|
535
642
|
unload();
|
|
643
|
+
window.removeEventListener("mousedown", handleMousedown.bind(this));
|
|
536
644
|
});
|
|
537
645
|
return {
|
|
538
646
|
ns,
|
|
@@ -542,8 +650,10 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
542
650
|
hasEnableEdit,
|
|
543
651
|
readonlyState,
|
|
544
652
|
isLoading,
|
|
653
|
+
textTBRef,
|
|
545
654
|
renderFooter,
|
|
546
655
|
renderHeaderToolbar,
|
|
656
|
+
renderTextEditorToolbar,
|
|
547
657
|
renderCodeContent,
|
|
548
658
|
changeFullScreenState
|
|
549
659
|
};
|
|
@@ -557,7 +667,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
557
667
|
}, {
|
|
558
668
|
[this.ns.b("editor-enable")]: !this.readonlyState
|
|
559
669
|
}, this.ns.is("enable", this.hasEnableEdit)]
|
|
560
|
-
}, [this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[vue.resolveDirective("loading"), isLoading]]) : vue.createVNode(vue.resolveComponent("el-dialog"), {
|
|
670
|
+
}, [this.renderTextEditorToolbar(), this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[vue.resolveDirective("loading"), isLoading]]) : vue.createVNode(vue.resolveComponent("el-dialog"), {
|
|
561
671
|
"modelValue": this.isFullScreen,
|
|
562
672
|
"onUpdate:modelValue": ($event) => this.isFullScreen = $event,
|
|
563
673
|
"class": this.ns.b("dialog-full-screen"),
|
|
@@ -569,7 +679,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
569
679
|
}, {
|
|
570
680
|
[this.ns.b("editor-enable")]: !this.readonlyState
|
|
571
681
|
}]
|
|
572
|
-
}, [this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[vue.resolveDirective("loading"), isLoading]])]
|
|
682
|
+
}, [this.renderTextEditorToolbar(), this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[vue.resolveDirective("loading"), isLoading]])]
|
|
573
683
|
});
|
|
574
684
|
}
|
|
575
685
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ibiz-code{display:flex;flex-direction:column;width:100%;height:100%}.ibiz-code__box{width:100%;height:100%;min-height:200px;overflow:hidden}.ibiz-code__first-prompt::before{padding-right:var(--ibiz-spacing-base);content:var(--ibiz-code-placeholder)}.ibiz-code-toolbar{position:absolute;top:4px;right:18px;z-index:10;display:flex;align-items:center;justify-content:end;width:auto;height:auto;padding-right:0;font-size:var(--ibiz-font-size-header-6)}.ibiz-code-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-code-toolbar__fullscreen{height:38px;padding:0 12px;font-size:var(--ibiz-font-size-regular);font-style:normal;line-height:2.8;cursor:pointer}.ibiz-code-toolbar__fullscreen:hover{background-color:var(--ibiz-color-bg-3)}.ibiz-code-footer{--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;display:flex;align-items:center;justify-content:end;width:100%;min-height:var(--ibiz-code-footer-toolbar-height);margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-code-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-code-footer__cancel{height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-code-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-code-footer__save{width:96px;height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-code-footer__save:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-primary)}.ibiz-code-message{width:500px;max-width:unset}.ibiz-code-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-code-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-code-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-code-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-code-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-code-editor-enable{--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px}.ibiz-code-editor-enable .ibiz-code__box{height:100%}.ibiz-code-editor-enable:has(.ibiz-code-footer) .ibiz-code__box{height:calc(100% - var(--ibiz-code-footer-toolbar-height))}.ibiz-code-dialog-full-screen{width:100%!important;height:100%!important;margin:0!important}.ibiz-code-dialog-full-screen .ibiz-code-footer{--ibiz-code-footer-toolbar-height:68px}.ibiz-code-dialog-full-screen .ibiz-code{gap:0;padding:0 var(--ibiz-spacing-extra-loose);--w-e-toolbar-bg-color:var(--ibiz-color-bg-0)}.ibiz-code-dialog-full-screen .ibiz-code .ibiz-code-toolbar{right:calc(var(--ibiz-spacing-extra-loose) + 18px)}.ibiz-code-dialog-full-screen .el-dialog__header{display:none!important}.ibiz-code-dialog-full-screen .el-dialog__body{width:100%;height:100%;padding:0 0 var(--ibiz-spacing-base)}.ibiz-code-dialog-full-screen .el-dialog__body:has(.ibiz-code-footer){padding-bottom:0}.ibiz-code-footer-dialog{margin-top:0}
|
|
1
|
+
.ibiz-code{display:flex;flex-direction:column;width:100%;height:100%}.ibiz-code__box{width:100%;height:100%;min-height:200px;overflow:hidden}.ibiz-code__first-prompt::before{padding-right:var(--ibiz-spacing-base);content:var(--ibiz-code-placeholder)}.ibiz-code-toolbar{position:absolute;top:4px;right:18px;z-index:10;display:flex;align-items:center;justify-content:end;width:auto;height:auto;padding-right:0;font-size:var(--ibiz-font-size-header-6)}.ibiz-code-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-code-toolbar__fullscreen{height:38px;padding:0 12px;font-size:var(--ibiz-font-size-regular);font-style:normal;line-height:2.8;cursor:pointer}.ibiz-code-toolbar__fullscreen:hover{background-color:var(--ibiz-color-bg-3)}.ibiz-code-footer{--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0;display:flex;align-items:center;justify-content:end;width:100%;min-height:var(--ibiz-code-footer-toolbar-height);margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-code-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-code-footer__cancel{height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-code-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-code-footer__save{width:96px;height:var(--ibiz-code-footer-button-height);line-height:var(--ibiz-code-footer-button-height);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-code-footer__save:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-primary)}.ibiz-code-message{width:500px;max-width:unset}.ibiz-code-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-code-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-code-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-code-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-code-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-code-editor-enable{--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0}.ibiz-code-editor-enable .ibiz-code__box{height:100%}.ibiz-code-editor-enable:has(.ibiz-code-footer) .ibiz-code__box{height:calc(100% - var(--ibiz-code-footer-toolbar-height))}.ibiz-code-dialog-full-screen{width:100%!important;height:100%!important;margin:0!important}.ibiz-code-dialog-full-screen .ibiz-code-footer{--ibiz-code-footer-toolbar-height:68px}.ibiz-code-dialog-full-screen .ibiz-code{gap:0;padding:0 var(--ibiz-spacing-extra-loose);--w-e-toolbar-bg-color:var(--ibiz-color-bg-0)}.ibiz-code-dialog-full-screen .ibiz-code .ibiz-code-toolbar{right:calc(var(--ibiz-spacing-extra-loose) + 18px)}.ibiz-code-dialog-full-screen .el-dialog__header{display:none!important}.ibiz-code-dialog-full-screen .el-dialog__body{width:100%;height:100%;padding:0 0 var(--ibiz-spacing-base)}.ibiz-code-dialog-full-screen .el-dialog__body:has(.ibiz-code-footer){padding-bottom:0}.ibiz-code-footer-dialog{margin-top:0}.ibiz-code-text-editor-toolbar{--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0;position:fixed;top:var(--ibiz-code-text-editor-toolbar-top);left:var(--ibiz-code-text-editor-toolbar-left);z-index:var(--ibiz-code-text-editor-toolbar-z-index);display:flex;gap:var(--ibiz-spacing-tight);height:var(--ibiz-code-height-text-editor-toolbar);padding:var(--ibiz-spacing-extra-tight);font-size:var(--ibiz-font-size-regular);background-color:var(--ibiz-color-bg-2);border-radius:var(--ibiz-border-radius-extra-small);box-shadow:var(--ibiz-shadow-elevated)}.ibiz-code-text-editor-toolbar__item{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-spacing-extra-tight) var(--ibiz-spacing-tight);cursor:pointer;border-radius:var(--ibiz-border-radius-extra-small)}.ibiz-code-text-editor-toolbar__item:hover{color:var(--ibiz-color-primary);background-color:var(--ibiz-color-primary-light-default)}
|
|
@@ -6,6 +6,7 @@ var core = require('@ibiz-template/core');
|
|
|
6
6
|
var editor = require('@wangeditor/editor');
|
|
7
7
|
require('./wang-editor/index.cjs');
|
|
8
8
|
var aiModule = require('./wang-editor/module/ai-module.cjs');
|
|
9
|
+
var inlineAiModule = require('./wang-editor/module/inline-ai-module.cjs');
|
|
9
10
|
var emoji = require('./wang-editor/element/emoji.cjs');
|
|
10
11
|
var emojiModule = require('./wang-editor/module/emoji-module.cjs');
|
|
11
12
|
var plugin = require('./wang-editor/plugin/plugin.cjs');
|
|
@@ -172,6 +173,7 @@ class HtmlEditorController extends runtime.EditorController {
|
|
|
172
173
|
customRegister() {
|
|
173
174
|
if (!window.aichartRegister && ibiz.env.enableAI) {
|
|
174
175
|
editor.Boot.registerMenu(aiModule.AIMenu);
|
|
176
|
+
editor.Boot.registerMenu(inlineAiModule.InLineAIMenu);
|
|
175
177
|
window.aichartRegister = true;
|
|
176
178
|
}
|
|
177
179
|
if (!window.customElements.get("emoji-elem")) {
|
|
@@ -282,6 +284,79 @@ class HtmlEditorController extends runtime.EditorController {
|
|
|
282
284
|
this.overlay.dismiss();
|
|
283
285
|
}
|
|
284
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* 获取选中文本
|
|
289
|
+
* @returns 选中文本
|
|
290
|
+
*/
|
|
291
|
+
getSelectionText() {
|
|
292
|
+
if (this.wangEditor) {
|
|
293
|
+
return this.wangEditor.getSelectionText();
|
|
294
|
+
}
|
|
295
|
+
return "";
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* 插入文本
|
|
299
|
+
* @param text 文本
|
|
300
|
+
*/
|
|
301
|
+
insertText(text) {
|
|
302
|
+
if (this.wangEditor) {
|
|
303
|
+
this.wangEditor.insertText(text);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* 替换选中文本
|
|
308
|
+
* @param text 文本
|
|
309
|
+
*/
|
|
310
|
+
replaceSelectionText(text) {
|
|
311
|
+
if (this.wangEditor) {
|
|
312
|
+
this.wangEditor.deleteFragment();
|
|
313
|
+
this.wangEditor.insertText(text);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* 恢复选区
|
|
318
|
+
*/
|
|
319
|
+
restoreSelection() {
|
|
320
|
+
if (this.wangEditor) {
|
|
321
|
+
this.wangEditor.restoreSelection();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* 获取内联AI参数
|
|
326
|
+
*/
|
|
327
|
+
getInLineAiChatOptions() {
|
|
328
|
+
if (!this.wangEditor) {
|
|
329
|
+
throw new core.RuntimeError("\u7F16\u8F91\u5668\u672A\u521D\u59CB\u5316");
|
|
330
|
+
}
|
|
331
|
+
const selectionPosition = this.wangEditor.getSelectionPosition();
|
|
332
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
333
|
+
throw new core.RuntimeError("\u83B7\u53D6\u9009\u533A\u4F4D\u7F6E\u5931\u8D25");
|
|
334
|
+
const editorBoundingClientRect = this.wangEditor.getEditableContainer().getBoundingClientRect();
|
|
335
|
+
return {
|
|
336
|
+
left: editorBoundingClientRect.x + 10,
|
|
337
|
+
top: editorBoundingClientRect.y + Number(selectionPosition.top.replace("px", "")),
|
|
338
|
+
width: editorBoundingClientRect.width - 20
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* 执行内联AIUI操作
|
|
343
|
+
* @param uiActionId
|
|
344
|
+
* @param appId
|
|
345
|
+
*/
|
|
346
|
+
async doInLineAIUIAction(uiActionId, appId) {
|
|
347
|
+
const eventArgs = this.ctrl.getEventArgs();
|
|
348
|
+
eventArgs.params.editor = this;
|
|
349
|
+
if (this.editorParams.srfaiappendcurdata && this.editorParams.srfaiappendcurdata === "true") {
|
|
350
|
+
eventArgs.context.srfaiappendcurdata = true;
|
|
351
|
+
}
|
|
352
|
+
await runtime.UIActionUtil.exec(
|
|
353
|
+
uiActionId,
|
|
354
|
+
{
|
|
355
|
+
...eventArgs
|
|
356
|
+
},
|
|
357
|
+
appId
|
|
358
|
+
);
|
|
359
|
+
}
|
|
285
360
|
}
|
|
286
361
|
|
|
287
362
|
exports.HtmlEditorController = HtmlEditorController;
|
|
@@ -6,6 +6,7 @@ require('./plugin/index.cjs');
|
|
|
6
6
|
require('./component/index.cjs');
|
|
7
7
|
var aiModule = require('./module/ai-module.cjs');
|
|
8
8
|
var emojiModule = require('./module/emoji-module.cjs');
|
|
9
|
+
var inlineAiModule = require('./module/inline-ai-module.cjs');
|
|
9
10
|
var emoji = require('./element/emoji.cjs');
|
|
10
11
|
var plugin = require('./plugin/plugin.cjs');
|
|
11
12
|
var emoji$1 = require('./component/emoji/emoji.cjs');
|
|
@@ -14,6 +15,8 @@ var emoji$1 = require('./component/emoji/emoji.cjs');
|
|
|
14
15
|
|
|
15
16
|
exports.AIMenu = aiModule.AIMenu;
|
|
16
17
|
exports.EmojiModule = emojiModule.EmojiModule;
|
|
18
|
+
exports.InLineAIMenu = inlineAiModule.InLineAIMenu;
|
|
19
|
+
exports.hoverbarKeysEx = inlineAiModule.hoverbarKeysEx;
|
|
17
20
|
exports.EmojiElem = emoji.EmojiElem;
|
|
18
21
|
exports.Plugin = plugin.Plugin;
|
|
19
22
|
exports.Emoji = emoji$1.Emoji;
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var aiModule = require('./ai-module.cjs');
|
|
4
4
|
var emojiModule = require('./emoji-module.cjs');
|
|
5
|
+
var inlineAiModule = require('./inline-ai-module.cjs');
|
|
5
6
|
|
|
6
7
|
"use strict";
|
|
7
8
|
|
|
8
9
|
exports.AIMenu = aiModule.AIMenu;
|
|
9
10
|
exports.EmojiModule = emojiModule.EmojiModule;
|
|
11
|
+
exports.InLineAIMenu = inlineAiModule.InLineAIMenu;
|
|
12
|
+
exports.hoverbarKeysEx = inlineAiModule.hoverbarKeysEx;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => {
|
|
7
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
+
return value;
|
|
9
|
+
};
|
|
10
|
+
class InLineAIButton {
|
|
11
|
+
constructor() {
|
|
12
|
+
__publicField(this, "title");
|
|
13
|
+
__publicField(this, "tag");
|
|
14
|
+
__publicField(this, "iconSvg");
|
|
15
|
+
this.title = "AI";
|
|
16
|
+
this.tag = "button";
|
|
17
|
+
this.iconSvg = '<svg t="1763370094787" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="14" height="14" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M274.344554 173.673875c16.429399 0 30.950568 8.00526 39.956484 20.338945a34.906655 34.906655 0 0 1 14.660796 15.754537l1.117013 2.815803 210.138065 597.927736c6.795162 19.268474-5.329083 40.817516-27.041022 48.147913-20.641469 6.95806-42.493035-1.419537-50.451753-18.803052l-1.117013-2.815803-54.477653-154.939008H134.997185L80.566074 837.039954c-6.771891 19.268474-29.856826 28.949253-51.568765 21.618855-20.641469-6.981331-32.602816-26.761769-27.925325-45.239025l0.861031-2.908888L212.047809 212.58316c4.025901-11.426112 13.799764-19.477914 25.598214-22.619512 9.029188-10.006575 22.107548-16.289773 36.67526-16.289773z m386.416675 169.460176c21.828295 0 39.723774 10.890876 41.469106 24.713912l0.116356 2.210755v461.652153c0 14.893506-18.616883 26.947938-41.585462 26.947938-21.805024 0-39.700503-10.890876-41.422565-24.737183l-0.162897-2.210755V370.081989c0-14.870235 18.616883-26.924667 41.585462-26.924667z m-389.697901-48.171184L163.620643 600.628812h214.88537l-107.442685-305.665945z m602.163076-206.181978a12.566396 12.566396 0 0 1 8.144887 8.051802l32.509731 99.041817 101.694723 36.07021a12.566396 12.566396 0 0 1-0.791218 23.922695l-99.53051 27.995137-30.857483 97.552467a12.566396 12.566396 0 0 1-23.899423 0.116355l-32.509732-99.018546-98.669479-31.322905a12.566396 12.566396 0 0 1-0.186169-23.876152l97.505924-32.812256 30.834212-97.529195a12.566396 12.566396 0 0 1 15.754537-8.191429zM649.544557 0.513593c2.676177 0.884302 4.770576 3.025243 5.608336 5.724692l18.523798 59.294772 60.970292 20.66474a8.796477 8.796477 0 0 1-0.325796 16.755194l-60.73758 18.058377-19.780438 59.550754a8.796477 8.796477 0 0 1-16.731924-0.162898l-18.523798-59.271501-59.062061-17.825665a8.796477 8.796477 0 0 1-0.395609-16.708653l59.574025-20.943993 19.780438-59.574025a8.796477 8.796477 0 0 1 11.100317-5.561794z" fill="black"></path></svg>';
|
|
18
|
+
}
|
|
19
|
+
// 获取选中文本
|
|
20
|
+
getValue(editor) {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
// 判断按钮是否激活
|
|
24
|
+
isActive(editor) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// 判断按钮是否可用
|
|
28
|
+
isDisabled(editor) {
|
|
29
|
+
return editor.getConfig().readOnly;
|
|
30
|
+
}
|
|
31
|
+
// 点击按钮的执行逻辑
|
|
32
|
+
exec(editor, value) {
|
|
33
|
+
if (this.isDisabled(editor))
|
|
34
|
+
return;
|
|
35
|
+
editor.emit("lineAiClick");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const InLineAIMenu = {
|
|
39
|
+
key: "inline-ai",
|
|
40
|
+
factory() {
|
|
41
|
+
return new InLineAIButton();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const hoverbarKeysEx = {
|
|
45
|
+
link: {
|
|
46
|
+
menuKeys: ["inline-ai", "editLink", "unLink", "viewLink"]
|
|
47
|
+
},
|
|
48
|
+
image: {
|
|
49
|
+
menuKeys: [
|
|
50
|
+
"inline-ai",
|
|
51
|
+
"imageWidth30",
|
|
52
|
+
"imageWidth50",
|
|
53
|
+
"imageWidth100",
|
|
54
|
+
"editImage",
|
|
55
|
+
"viewImageLink",
|
|
56
|
+
"deleteImage"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
pre: {
|
|
60
|
+
menuKeys: ["inline-ai", "enter", "codeBlock", "codeSelectLang"]
|
|
61
|
+
},
|
|
62
|
+
table: {
|
|
63
|
+
menuKeys: [
|
|
64
|
+
"inline-ai",
|
|
65
|
+
"enter",
|
|
66
|
+
"tableHeader",
|
|
67
|
+
"tableFullWidth",
|
|
68
|
+
"insertTableRow",
|
|
69
|
+
"deleteTableRow",
|
|
70
|
+
"insertTableCol",
|
|
71
|
+
"deleteTableCol",
|
|
72
|
+
"deleteTable"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
divider: {
|
|
76
|
+
menuKeys: ["inline-ai", "enter"]
|
|
77
|
+
},
|
|
78
|
+
video: {
|
|
79
|
+
menuKeys: ["inline-ai", "enter", "editVideoSize"]
|
|
80
|
+
},
|
|
81
|
+
text: {
|
|
82
|
+
menuKeys: [
|
|
83
|
+
"inline-ai",
|
|
84
|
+
"headerSelect",
|
|
85
|
+
"insertLink",
|
|
86
|
+
"bulletedList",
|
|
87
|
+
"|",
|
|
88
|
+
"bold",
|
|
89
|
+
"through",
|
|
90
|
+
"color",
|
|
91
|
+
"bgColor",
|
|
92
|
+
"clearStyle"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
exports.InLineAIMenu = InLineAIMenu;
|
|
98
|
+
exports.hoverbarKeysEx = hoverbarKeysEx;
|
|
@@ -11,7 +11,9 @@ var core = require('@ibiz-template/core');
|
|
|
11
11
|
var runtime = require('@ibiz-template/runtime');
|
|
12
12
|
var ElementPlus = require('element-plus');
|
|
13
13
|
require('../../../util/index.cjs');
|
|
14
|
+
require('./module/index.cjs');
|
|
14
15
|
require('./wang-editor.css');
|
|
16
|
+
var inlineAiModule = require('./module/inline-ai-module.cjs');
|
|
15
17
|
var aiUtil = require('../../../util/ai-util/ai-util.cjs');
|
|
16
18
|
|
|
17
19
|
"use strict";
|
|
@@ -41,6 +43,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
41
43
|
const readonlyState = vue.ref(false);
|
|
42
44
|
const enableFullScreen = vue.ref(false);
|
|
43
45
|
const isFullScreen = vue.ref(false);
|
|
46
|
+
let autoClose;
|
|
44
47
|
const editorModel = c.model;
|
|
45
48
|
if (editorModel.editorParams) {
|
|
46
49
|
if (editorModel.editorParams.enableEdit) {
|
|
@@ -59,6 +62,13 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
59
62
|
if (editorModel.editorParams.enablefullscreen) {
|
|
60
63
|
enableFullScreen.value = c.toBoolean(editorModel.editorParams.enablefullscreen);
|
|
61
64
|
}
|
|
65
|
+
if (editorModel.editorParams.autoclose) {
|
|
66
|
+
try {
|
|
67
|
+
autoClose = JSON.parse(editorModel.editorParams.autoclose);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
ibiz.log.error(error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
62
72
|
}
|
|
63
73
|
if (props.readonly) {
|
|
64
74
|
hasEnableEdit.value = false;
|
|
@@ -184,7 +194,8 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
184
194
|
parseLinkUrl: customParseLinkUrl
|
|
185
195
|
// 也支持 async 函数
|
|
186
196
|
}
|
|
187
|
-
}
|
|
197
|
+
},
|
|
198
|
+
hoverbarKeys: inlineAiModule.hoverbarKeysEx
|
|
188
199
|
};
|
|
189
200
|
vue.onBeforeUnmount(() => {
|
|
190
201
|
const editor = editorRef.value;
|
|
@@ -231,6 +242,14 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
231
242
|
otherToolbarItems,
|
|
232
243
|
// 编辑器参数srfaiappendcurdata,是否传入对象参数,用于历史查询传参
|
|
233
244
|
appendCurData: c.editorParams.srfaiappendcurdata === "true" ? props.data : void 0,
|
|
245
|
+
// 自动提问
|
|
246
|
+
autoQuestion: c.editorParams.autoquestion !== "false",
|
|
247
|
+
// 自动填充
|
|
248
|
+
autoFill: c.editorParams.autofill === "true",
|
|
249
|
+
// 窗口的打开模式
|
|
250
|
+
openMode: c.editorParams.openmode,
|
|
251
|
+
// 窗口的自动关闭模式
|
|
252
|
+
autoClose,
|
|
234
253
|
// 编辑器参数srfaiappendcurcontent,传入编辑内容作为用户消息,获取历史数据后附加
|
|
235
254
|
appendCurContent: c.editorParams.srfaiappendcurcontent ? core.StringUtil.fill(c.editorParams.srfaiappendcurcontent, c.context, c.params, props.data) : void 0,
|
|
236
255
|
question: async (aiChat, ctx, param, other, arr, sessionid) => {
|
|
@@ -404,6 +423,18 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
404
423
|
editor.on("aiClick", () => {
|
|
405
424
|
onClickAI();
|
|
406
425
|
});
|
|
426
|
+
editor.on("lineAiClick", () => {
|
|
427
|
+
const selectionPosition = editor.getSelectionPosition();
|
|
428
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
429
|
+
return;
|
|
430
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
431
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
432
|
+
});
|
|
433
|
+
if (items.length === 0)
|
|
434
|
+
return;
|
|
435
|
+
const editorBoundingClientRect = editor.getEditableContainer().getBoundingClientRect();
|
|
436
|
+
ibiz.inLineAIUtil.showContextMenus(editorBoundingClientRect.x + Number(selectionPosition.left.replace("px", "")), editorBoundingClientRect.y + Number(selectionPosition.top.replace("px", "")) + 60, items);
|
|
437
|
+
});
|
|
407
438
|
};
|
|
408
439
|
const handleChange = (editor) => {
|
|
409
440
|
const html = editor.getHtml();
|
|
@@ -619,7 +650,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
619
650
|
};
|
|
620
651
|
const renderEditorContent = () => {
|
|
621
652
|
return vue.createVNode("div", {
|
|
622
|
-
"class": ns.b("content"),
|
|
653
|
+
"class": [ns.b("content"), ns.is("editing", !readonlyState.value)],
|
|
623
654
|
"ref": "htmlContent",
|
|
624
655
|
"style": cssVars.value
|
|
625
656
|
}, [vue.createVNode(editorForVue.Toolbar, {
|
|
@@ -689,13 +720,13 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
689
720
|
return !this.isFullScreen ? vue.createVNode("div", {
|
|
690
721
|
"class": [this.ns.b(), {
|
|
691
722
|
[this.ns.b("editor-readonly")]: this.readonlyState
|
|
692
|
-
}, this.ns.is("show-ai", true)]
|
|
723
|
+
}, this.ns.is("show-ai", true), this.ns.is("enable-edit", !this.readonly && !this.disabled)]
|
|
693
724
|
}, [this.renderHeaserToolbar(), this.renderEditorContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]) : vue.createVNode(vue.resolveComponent("el-dialog"), {
|
|
694
725
|
"modelValue": this.isFullScreen,
|
|
695
726
|
"onUpdate:modelValue": ($event) => this.isFullScreen = $event,
|
|
696
727
|
"width": "80%",
|
|
697
728
|
"top": "10vh",
|
|
698
|
-
"class": this.ns.b("dialog-full-screen"),
|
|
729
|
+
"class": [this.ns.b("dialog-full-screen"), this.ns.is("editing", !this.readonlyState)],
|
|
699
730
|
"onClose": () => this.changeFullScreenState()
|
|
700
731
|
}, {
|
|
701
732
|
default: () => [vue.createVNode("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ibiz-html{--ibiz-html-height:300px;display:inline-block;width:100%;height:100%}.ibiz-html .ibiz-html-content{display:flex;flex-direction:column;height:100%;background-color:var(--ibiz-color-bg-0)}.ibiz-html .ibiz-html-editor{height:var(--ibiz-html-height)!important;padding:0;overflow-y:scroll;border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor.is-readonly{height:auto!important}.ibiz-html .ibiz-html-editor table{width:100%!important;border-collapse:collapse}.ibiz-html .ibiz-html-editor table th{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor table td{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);empty-cells:show;border:1px solid var(--ibiz-color-border)}.ibiz-html{--w-e-textarea-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-color:var(--ibiz-color-text-2);--w-e-textarea-border-color:var(--ibiz-color-border);--w-e-textarea-slight-border-color:var(--ibiz-color-border);--w-e-textarea-slight-color:var(--ibiz-color-text-3);--w-e-textarea-slight-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-selected-border-color:var(--ibiz-color-border);--w-e-textarea-handler-bg-color:var(--ibiz-color-primary);--w-e-toolbar-color:var(--ibiz-color-text-0);--w-e-toolbar-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-active-color:var(--ibiz-color-text-0);--w-e-toolbar-active-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-disabled-color:var(--ibiz-color-disabled-text);--w-e-toolbar-border-color:var(--ibiz-color-border);--w-e-modal-button-bg-color:var(--ibiz-color-bg-1);--w-e-modal-button-border-color:var(--ibiz-color-border)}.ibiz-html .w-e-menu-tooltip-v5::before{color:var(--ibiz-color-text-0);background-color:var(--w-e-toolbar-bg-color)}.ibiz-html .w-e-full-screen-container{z-index:9999}.ibiz-html .w-e-scroll>div{background-color:var(--ibiz-color-bg-1)}.ibiz-html .table-container table{width:100%}.ibiz-html-editor-readonly .ibiz-html-toolbar{display:none}.ibiz-html-editor-readonly .ibiz-html-editor{border:none}.ibiz-html-footer{display:flex;align-items:center;justify-content:end;margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-html-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-html-footer__cancel{height:var(--ibiz-height-control-default);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-html-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-html-footer__save{height:var(--ibiz-height-control-default);padding:0 var(--ibiz-spacing-base);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-html-custom-toolbar{display:flex;align-items:center;justify-content:end;width:100%;height:var(--ibiz-height-control-default);padding-right:var(--ibiz-spacing-base);font-size:var(--ibiz-font-size-header-6)}.ibiz-html-custom-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-html-custom-toolbar i{cursor:pointer}.ibiz-html-custom-toolbar i:hover{color:var(--ibiz-color-primary)}.ibiz-html-message{width:500px;max-width:unset}.ibiz-html-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-html-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-html-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-html-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-html-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-html-dialog-full-screen{height:80%}.ibiz-html-dialog-full-screen .ibiz-html{padding:0
|
|
1
|
+
.ibiz-html{--ibiz-html-height:300px;display:inline-block;width:100%;height:100%}.ibiz-html .ibiz-html-content{display:flex;flex-direction:column;height:100%;background-color:var(--ibiz-color-bg-0)}.ibiz-html .ibiz-html-editor{height:var(--ibiz-html-height)!important;padding:0;overflow-y:scroll;border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor.is-readonly{height:auto!important}.ibiz-html .ibiz-html-editor table{width:100%!important;border-collapse:collapse}.ibiz-html .ibiz-html-editor table th{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor table td{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);empty-cells:show;border:1px solid var(--ibiz-color-border)}.ibiz-html{--w-e-textarea-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-color:var(--ibiz-color-text-2);--w-e-textarea-border-color:var(--ibiz-color-border);--w-e-textarea-slight-border-color:var(--ibiz-color-border);--w-e-textarea-slight-color:var(--ibiz-color-text-3);--w-e-textarea-slight-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-selected-border-color:var(--ibiz-color-border);--w-e-textarea-handler-bg-color:var(--ibiz-color-primary);--w-e-toolbar-color:var(--ibiz-color-text-0);--w-e-toolbar-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-active-color:var(--ibiz-color-text-0);--w-e-toolbar-active-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-disabled-color:var(--ibiz-color-disabled-text);--w-e-toolbar-border-color:var(--ibiz-color-border);--w-e-modal-button-bg-color:var(--ibiz-color-bg-1);--w-e-modal-button-border-color:var(--ibiz-color-border)}.ibiz-html .w-e-menu-tooltip-v5::before{color:var(--ibiz-color-text-0);background-color:var(--w-e-toolbar-bg-color)}.ibiz-html .w-e-full-screen-container{z-index:9999}.ibiz-html .w-e-scroll>div{background-color:var(--ibiz-color-bg-1)}.ibiz-html .table-container table{width:100%}.ibiz-html.is-enable-edit .w-e-bar-item>button{color:var(--w-e-toolbar-color);cursor:pointer}.ibiz-html.is-enable-edit .w-e-bar-item>button svg{fill:var(--w-e-toolbar-color)}.ibiz-html-editor-readonly .ibiz-html-toolbar{display:none}.ibiz-html-editor-readonly .ibiz-html-editor{border:none}.ibiz-html-toolbar .w-e-toolbar{background-color:var(--ibiz-color-bg-0);border:1px solid var(--ibiz-color-border);border-bottom:none;box-shadow:none}.ibiz-html-toolbar .w-e-toolbar .w-e-bar-item>button:hover{background-color:var(--ibiz-color-bg-0)}.ibiz-html-footer{display:flex;align-items:center;justify-content:end;margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-html-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-html-footer__cancel{height:var(--ibiz-height-control-default);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-html-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-html-footer__save{height:var(--ibiz-height-control-default);padding:0 var(--ibiz-spacing-base);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-html-custom-toolbar{display:flex;align-items:center;justify-content:end;width:100%;height:var(--ibiz-height-control-default);padding-right:var(--ibiz-spacing-base);font-size:var(--ibiz-font-size-header-6)}.ibiz-html-custom-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-html-custom-toolbar i{cursor:pointer}.ibiz-html-custom-toolbar i:hover{color:var(--ibiz-color-primary)}.ibiz-html-message{width:500px;max-width:unset}.ibiz-html-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-html-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-html-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-html-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-html-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-html-dialog-full-screen{height:80%}.ibiz-html-dialog-full-screen .el-dialog__header{display:none}.ibiz-html-dialog-full-screen .el-dialog__body{height:100%;padding-top:0}.ibiz-html-dialog-full-screen.is-editing .el-dialog__body{padding-bottom:0}.ibiz-html-dialog-full-screen .ibiz-html{padding:0;--w-e-toolbar-bg-color:var(--ibiz-color-bg-0)}.ibiz-html-dialog-full-screen .ibiz-html-custom-toolbar{height:56px;padding-right:0}.ibiz-html-dialog-full-screen .ibiz-html-content{height:calc(100% - 56px)}.ibiz-html-dialog-full-screen .ibiz-html-content .ibiz-html-editor{height:100%!important}.ibiz-html-dialog-full-screen .ibiz-html-content.is-editing{height:calc(100% - 128px)}.ibiz-html-footer-dialog{height:68px;margin-top:0;margin-right:0}emoji-elem{margin:0 1px!important}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Cherry = require('cherry-markdown');
|
|
4
|
+
var vue = require('vue');
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
function initCustomMenu(c) {
|
|
8
|
+
const AIMenu = Cherry.createMenuHook("AI", {
|
|
9
|
+
icon: {
|
|
10
|
+
type: "svg",
|
|
11
|
+
content: "<svg\n viewBox='0 0 16 16'\n xmlns='http://www.w3.org/2000/svg'\n fill='currentColor'\n height='1em'\n width='1em'\n preserveAspectRatio='xMidYMid meet'\n focusable='false'\n >\n <g\n id='aae1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/ai-star'\n stroke-width='1'\n fill-rule='evenodd'\n >\n <path\n d='M5.817 1.53l3.158 8.797h.054v.152l1.443 4.021-1.402.001-1.041-2.982H2.495l-1.03 2.982L0 14.5 4.671 1.533l1.146-.003zm7.86 5.424V14.5h-1.213V6.954h1.212zM5.248 3.549l-2.342 6.778h4.706L5.249 3.55zM13.046 0c.075 0 .147.02.204.071a.318.318 0 01.094.181l.064.273c.097.417.17.727.255.968.084.24.177.4.31.523.134.124.318.218.599.306.281.088.65.166 1.15.265a.358.358 0 01.195.095c.056.057.083.13.083.213a.289.289 0 01-.083.21.362.362 0 01-.197.094c-.528.093-.918.167-1.214.255-.295.088-.485.187-.621.324-.137.138-.23.324-.31.606-.08.283-.145.651-.23 1.147a.329.329 0 01-.093.184.293.293 0 01-.206.075.308.308 0 01-.207-.072.322.322 0 01-.1-.188l-.006-.033c-.085-.486-.149-.845-.228-1.12-.079-.274-.17-.452-.305-.585-.135-.133-.323-.23-.618-.32s-.683-.168-1.21-.273a.353.353 0 01-.2-.096.29.29 0 01-.08-.208c0-.079.023-.153.079-.211a.35.35 0 01.2-.097c.5-.098.869-.176 1.15-.263.282-.087.465-.18.597-.302.132-.12.224-.278.306-.511.082-.236.151-.539.244-.947l.071-.312a.312.312 0 01.102-.183.311.311 0 01.205-.069z'\n id='aae\u5F62\u72B6\u7ED3\u5408'\n ></path>\n </g>\n </svg>\n "
|
|
12
|
+
},
|
|
13
|
+
onClick: (_selection, _menukey, event) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const startPos = (_a = c.mdeditor) == null ? void 0 : _a.editor.editor.getCursor("start");
|
|
16
|
+
const endPos = (_b = c.mdeditor) == null ? void 0 : _b.editor.editor.getCursor("end");
|
|
17
|
+
c.setCursorPos(startPos, endPos);
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
vue.nextTick(() => {
|
|
21
|
+
var _a2;
|
|
22
|
+
if ((_a2 = c.mdeditor) == null ? void 0 : _a2.bubble) {
|
|
23
|
+
c.mdeditor.bubble.visible = true;
|
|
24
|
+
const selectionPosition = c.mdeditor.bubble.bubbleDom.getBoundingClientRect();
|
|
25
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
26
|
+
return;
|
|
27
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(
|
|
28
|
+
c.deACMode,
|
|
29
|
+
(tag) => {
|
|
30
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
if (items.length === 0)
|
|
34
|
+
return;
|
|
35
|
+
ibiz.inLineAIUtil.showContextMenus(
|
|
36
|
+
selectionPosition.left,
|
|
37
|
+
selectionPosition.top + 60,
|
|
38
|
+
items
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return [AIMenu];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.initCustomMenu = initCustomMenu;
|