@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
|
@@ -23,12 +23,22 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
23
23
|
const c = props.controller;
|
|
24
24
|
const UUID = createUUID();
|
|
25
25
|
const currentVal = ref("");
|
|
26
|
+
const {
|
|
27
|
+
UIStore,
|
|
28
|
+
zIndex
|
|
29
|
+
} = useUIStore();
|
|
26
30
|
const enableEdit = ref(true);
|
|
27
31
|
const hasEnableEdit = ref(false);
|
|
28
32
|
const readonlyState = ref(false);
|
|
29
33
|
const enableFullScreen = ref(false);
|
|
30
34
|
const isFullScreen = ref(false);
|
|
31
35
|
const isLoading = ref(false);
|
|
36
|
+
let autoClose;
|
|
37
|
+
const textTBRef = ref();
|
|
38
|
+
const textTBStyle = ref({
|
|
39
|
+
[ns.cssVarBlockName("text-editor-toolbar-z-index")]: zIndex.increment()
|
|
40
|
+
});
|
|
41
|
+
const textTBVisible = ref(false);
|
|
32
42
|
const editorModel = c.model;
|
|
33
43
|
if (editorModel.editorParams) {
|
|
34
44
|
if (editorModel.editorParams.enableEdit) {
|
|
@@ -47,6 +57,13 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
47
57
|
if (editorModel.editorParams.enablefullscreen) {
|
|
48
58
|
enableFullScreen.value = c.toBoolean(editorModel.editorParams.enablefullscreen);
|
|
49
59
|
}
|
|
60
|
+
if (editorModel.editorParams.autoclose) {
|
|
61
|
+
try {
|
|
62
|
+
autoClose = JSON.parse(editorModel.editorParams.autoclose);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
ibiz.log.error(error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
50
67
|
}
|
|
51
68
|
let editor;
|
|
52
69
|
let monacoEditor;
|
|
@@ -54,10 +71,6 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
54
71
|
let inlineCompletionsProviderDisposable;
|
|
55
72
|
let decorationsCollection;
|
|
56
73
|
let chatInstance;
|
|
57
|
-
const {
|
|
58
|
-
UIStore,
|
|
59
|
-
zIndex
|
|
60
|
-
} = useUIStore();
|
|
61
74
|
const getMonacoTheme = (name) => {
|
|
62
75
|
var _a;
|
|
63
76
|
const customTheme = (_a = c == null ? void 0 : c.editorParams) == null ? void 0 : _a.customTheme;
|
|
@@ -137,6 +150,14 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
137
150
|
},
|
|
138
151
|
// 编辑器参数srfaiappendcurdata,是否传入对象参数,用于历史查询传参
|
|
139
152
|
appendCurData: c.editorParams.srfaiappendcurdata === "true" ? props.data : void 0,
|
|
153
|
+
// 自动提问
|
|
154
|
+
autoQuestion: c.editorParams.autoquestion !== "false",
|
|
155
|
+
// 自动填充
|
|
156
|
+
autoFill: c.editorParams.autofill === "true",
|
|
157
|
+
// 窗口的打开模式
|
|
158
|
+
openMode: c.editorParams.openmode,
|
|
159
|
+
// 窗口的自动关闭模式
|
|
160
|
+
autoClose,
|
|
140
161
|
// 编辑器参数srfaiappendcurcontent,传入编辑内容作为用户消息,获取历史数据后附加
|
|
141
162
|
appendCurContent: c.editorParams.srfaiappendcurcontent ? StringUtil.fill(c.editorParams.srfaiappendcurcontent, c.context, c.params, props.data) : void 0,
|
|
142
163
|
appDataEntityId: c.model.appDataEntityId,
|
|
@@ -309,6 +330,62 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
309
330
|
return false;
|
|
310
331
|
return true;
|
|
311
332
|
};
|
|
333
|
+
const updateTextToolbarPos = (selection) => {
|
|
334
|
+
var _a;
|
|
335
|
+
const position = selection.getStartPosition();
|
|
336
|
+
if (position) {
|
|
337
|
+
const coordinates = editor == null ? void 0 : editor.getScrolledVisiblePosition(position);
|
|
338
|
+
const editorRect = (_a = editor == null ? void 0 : editor.getDomNode()) == null ? void 0 : _a.getBoundingClientRect();
|
|
339
|
+
if (!editorRect || !coordinates)
|
|
340
|
+
return;
|
|
341
|
+
textTBStyle.value = {
|
|
342
|
+
...textTBStyle.value,
|
|
343
|
+
[ns.cssVarBlockName("text-editor-toolbar-left")]: "".concat(editorRect.left + coordinates.left, "px"),
|
|
344
|
+
[ns.cssVarBlockName("text-editor-toolbar-top")]: "".concat(editorRect.top + coordinates.top + 28, "px")
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
const setTextTBVisible = () => {
|
|
349
|
+
if (props.readonly || !enableEdit.value || !c.deACMode)
|
|
350
|
+
return;
|
|
351
|
+
const selection = editor == null ? void 0 : editor.getSelection();
|
|
352
|
+
textTBVisible.value = !!(selection && !selection.isEmpty());
|
|
353
|
+
};
|
|
354
|
+
const onSelectionChange = (e) => {
|
|
355
|
+
const selection = e.selection;
|
|
356
|
+
if (selection) {
|
|
357
|
+
updateTextToolbarPos(selection);
|
|
358
|
+
c.currentSelection = selection;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
const handleLineAiClick = (_e) => {
|
|
362
|
+
var _a, _b;
|
|
363
|
+
const position = (_a = editor == null ? void 0 : editor.getSelection()) == null ? void 0 : _a.getStartPosition();
|
|
364
|
+
if (!position)
|
|
365
|
+
return;
|
|
366
|
+
const coordinates = editor == null ? void 0 : editor.getScrolledVisiblePosition(position);
|
|
367
|
+
const editorRect = (_b = editor == null ? void 0 : editor.getDomNode()) == null ? void 0 : _b.getBoundingClientRect();
|
|
368
|
+
if (!coordinates || !editorRect)
|
|
369
|
+
return;
|
|
370
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
371
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
372
|
+
});
|
|
373
|
+
if (items.length === 0)
|
|
374
|
+
return;
|
|
375
|
+
ibiz.inLineAIUtil.showContextMenus(editorRect.left + coordinates.left, editorRect.top + coordinates.top + 28 + 40, items);
|
|
376
|
+
};
|
|
377
|
+
const handleEditorClick = (e) => {
|
|
378
|
+
var _a;
|
|
379
|
+
if (!((_a = textTBRef.value) == null ? void 0 : _a.contains(e.target))) {
|
|
380
|
+
setTimeout(setTextTBVisible, 100);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
const handleMousedown = (e) => {
|
|
384
|
+
var _a;
|
|
385
|
+
if (textTBVisible.value && !((_a = textTBRef.value) == null ? void 0 : _a.contains(e.target))) {
|
|
386
|
+
textTBVisible.value = false;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
312
389
|
const editorInit = () => {
|
|
313
390
|
nextTick(() => {
|
|
314
391
|
isLoading.value = true;
|
|
@@ -318,6 +395,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
318
395
|
}
|
|
319
396
|
});
|
|
320
397
|
loader.init().then((loaderMonaco) => {
|
|
398
|
+
var _a;
|
|
321
399
|
isLoading.value = false;
|
|
322
400
|
if (!editor) {
|
|
323
401
|
monacoEditor = loaderMonaco.editor;
|
|
@@ -374,6 +452,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
374
452
|
});
|
|
375
453
|
}
|
|
376
454
|
}
|
|
455
|
+
c.onCreated(editor, loaderMonaco);
|
|
377
456
|
setTimeout(() => {
|
|
378
457
|
editor.layout();
|
|
379
458
|
editor.setValue(currentVal.value);
|
|
@@ -406,11 +485,14 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
406
485
|
createDecorationsCollection();
|
|
407
486
|
});
|
|
408
487
|
editor.onDidChangeModelContent(() => {
|
|
488
|
+
setTextTBVisible();
|
|
409
489
|
if (!hasEnableEdit.value) {
|
|
410
490
|
currentVal.value = editor.getValue();
|
|
411
491
|
emit("change", currentVal.value);
|
|
412
492
|
}
|
|
413
493
|
});
|
|
494
|
+
editor.onDidChangeCursorSelection(onSelectionChange);
|
|
495
|
+
(_a = editor.getDomNode()) == null ? void 0 : _a.addEventListener("click", handleEditorClick);
|
|
414
496
|
window.addEventListener("resize", () => {
|
|
415
497
|
editor.layout();
|
|
416
498
|
});
|
|
@@ -526,11 +608,37 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
526
608
|
}
|
|
527
609
|
}, null);
|
|
528
610
|
};
|
|
611
|
+
const renderTextEditorToolbar = () => {
|
|
612
|
+
if (!textTBVisible.value)
|
|
613
|
+
return null;
|
|
614
|
+
return createVNode("div", {
|
|
615
|
+
"ref": "textTBRef",
|
|
616
|
+
"class": [ns.b("text-editor-toolbar")],
|
|
617
|
+
"style": {
|
|
618
|
+
...textTBStyle.value
|
|
619
|
+
}
|
|
620
|
+
}, [createVNode("div", {
|
|
621
|
+
"class": [ns.be("text-editor-toolbar", "item")],
|
|
622
|
+
"title": "AI",
|
|
623
|
+
"onClick": handleLineAiClick
|
|
624
|
+
}, [createVNode("svg", {
|
|
625
|
+
"version": "1.1",
|
|
626
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
627
|
+
"viewBox": "0 0 1024 1024",
|
|
628
|
+
"width": "1em",
|
|
629
|
+
"height": "1em",
|
|
630
|
+
"fill": "currentColor"
|
|
631
|
+
}, [createVNode("path", {
|
|
632
|
+
"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"
|
|
633
|
+
}, null)])])]);
|
|
634
|
+
};
|
|
529
635
|
onMounted(() => {
|
|
530
636
|
editorInit();
|
|
637
|
+
window.addEventListener("mousedown", handleMousedown.bind(this));
|
|
531
638
|
});
|
|
532
639
|
onUnmounted(() => {
|
|
533
640
|
unload();
|
|
641
|
+
window.removeEventListener("mousedown", handleMousedown.bind(this));
|
|
534
642
|
});
|
|
535
643
|
return {
|
|
536
644
|
ns,
|
|
@@ -540,8 +648,10 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
540
648
|
hasEnableEdit,
|
|
541
649
|
readonlyState,
|
|
542
650
|
isLoading,
|
|
651
|
+
textTBRef,
|
|
543
652
|
renderFooter,
|
|
544
653
|
renderHeaderToolbar,
|
|
654
|
+
renderTextEditorToolbar,
|
|
545
655
|
renderCodeContent,
|
|
546
656
|
changeFullScreenState
|
|
547
657
|
};
|
|
@@ -555,7 +665,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
555
665
|
}, {
|
|
556
666
|
[this.ns.b("editor-enable")]: !this.readonlyState
|
|
557
667
|
}, this.ns.is("enable", this.hasEnableEdit)]
|
|
558
|
-
}, [this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[resolveDirective("loading"), isLoading]]) : createVNode(resolveComponent("el-dialog"), {
|
|
668
|
+
}, [this.renderTextEditorToolbar(), this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[resolveDirective("loading"), isLoading]]) : createVNode(resolveComponent("el-dialog"), {
|
|
559
669
|
"modelValue": this.isFullScreen,
|
|
560
670
|
"onUpdate:modelValue": ($event) => this.isFullScreen = $event,
|
|
561
671
|
"class": this.ns.b("dialog-full-screen"),
|
|
@@ -567,7 +677,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
567
677
|
}, {
|
|
568
678
|
[this.ns.b("editor-enable")]: !this.readonlyState
|
|
569
679
|
}]
|
|
570
|
-
}, [this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[resolveDirective("loading"), isLoading]])]
|
|
680
|
+
}, [this.renderTextEditorToolbar(), this.renderHeaderToolbar(), this.renderCodeContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]), [[resolveDirective("loading"), isLoading]])]
|
|
571
681
|
});
|
|
572
682
|
}
|
|
573
683
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { h } from 'vue';
|
|
2
|
-
import { EditorController, getDeACMode } from '@ibiz-template/runtime';
|
|
3
|
-
import { NOOP, listenJSEvent } from '@ibiz-template/core';
|
|
2
|
+
import { EditorController, getDeACMode, UIActionUtil } from '@ibiz-template/runtime';
|
|
3
|
+
import { NOOP, listenJSEvent, RuntimeError } from '@ibiz-template/core';
|
|
4
4
|
import { Boot } from '@wangeditor/editor';
|
|
5
5
|
import './wang-editor/index.mjs';
|
|
6
6
|
import { AIMenu } from './wang-editor/module/ai-module.mjs';
|
|
7
|
+
import { InLineAIMenu } from './wang-editor/module/inline-ai-module.mjs';
|
|
7
8
|
import { EmojiElem } from './wang-editor/element/emoji.mjs';
|
|
8
9
|
import { EmojiModule } from './wang-editor/module/emoji-module.mjs';
|
|
9
10
|
import { Plugin } from './wang-editor/plugin/plugin.mjs';
|
|
@@ -170,6 +171,7 @@ class HtmlEditorController extends EditorController {
|
|
|
170
171
|
customRegister() {
|
|
171
172
|
if (!window.aichartRegister && ibiz.env.enableAI) {
|
|
172
173
|
Boot.registerMenu(AIMenu);
|
|
174
|
+
Boot.registerMenu(InLineAIMenu);
|
|
173
175
|
window.aichartRegister = true;
|
|
174
176
|
}
|
|
175
177
|
if (!window.customElements.get("emoji-elem")) {
|
|
@@ -280,6 +282,79 @@ class HtmlEditorController extends EditorController {
|
|
|
280
282
|
this.overlay.dismiss();
|
|
281
283
|
}
|
|
282
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* 获取选中文本
|
|
287
|
+
* @returns 选中文本
|
|
288
|
+
*/
|
|
289
|
+
getSelectionText() {
|
|
290
|
+
if (this.wangEditor) {
|
|
291
|
+
return this.wangEditor.getSelectionText();
|
|
292
|
+
}
|
|
293
|
+
return "";
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* 插入文本
|
|
297
|
+
* @param text 文本
|
|
298
|
+
*/
|
|
299
|
+
insertText(text) {
|
|
300
|
+
if (this.wangEditor) {
|
|
301
|
+
this.wangEditor.insertText(text);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* 替换选中文本
|
|
306
|
+
* @param text 文本
|
|
307
|
+
*/
|
|
308
|
+
replaceSelectionText(text) {
|
|
309
|
+
if (this.wangEditor) {
|
|
310
|
+
this.wangEditor.deleteFragment();
|
|
311
|
+
this.wangEditor.insertText(text);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* 恢复选区
|
|
316
|
+
*/
|
|
317
|
+
restoreSelection() {
|
|
318
|
+
if (this.wangEditor) {
|
|
319
|
+
this.wangEditor.restoreSelection();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* 获取内联AI参数
|
|
324
|
+
*/
|
|
325
|
+
getInLineAiChatOptions() {
|
|
326
|
+
if (!this.wangEditor) {
|
|
327
|
+
throw new RuntimeError("\u7F16\u8F91\u5668\u672A\u521D\u59CB\u5316");
|
|
328
|
+
}
|
|
329
|
+
const selectionPosition = this.wangEditor.getSelectionPosition();
|
|
330
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
331
|
+
throw new RuntimeError("\u83B7\u53D6\u9009\u533A\u4F4D\u7F6E\u5931\u8D25");
|
|
332
|
+
const editorBoundingClientRect = this.wangEditor.getEditableContainer().getBoundingClientRect();
|
|
333
|
+
return {
|
|
334
|
+
left: editorBoundingClientRect.x + 10,
|
|
335
|
+
top: editorBoundingClientRect.y + Number(selectionPosition.top.replace("px", "")),
|
|
336
|
+
width: editorBoundingClientRect.width - 20
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* 执行内联AIUI操作
|
|
341
|
+
* @param uiActionId
|
|
342
|
+
* @param appId
|
|
343
|
+
*/
|
|
344
|
+
async doInLineAIUIAction(uiActionId, appId) {
|
|
345
|
+
const eventArgs = this.ctrl.getEventArgs();
|
|
346
|
+
eventArgs.params.editor = this;
|
|
347
|
+
if (this.editorParams.srfaiappendcurdata && this.editorParams.srfaiappendcurdata === "true") {
|
|
348
|
+
eventArgs.context.srfaiappendcurdata = true;
|
|
349
|
+
}
|
|
350
|
+
await UIActionUtil.exec(
|
|
351
|
+
uiActionId,
|
|
352
|
+
{
|
|
353
|
+
...eventArgs
|
|
354
|
+
},
|
|
355
|
+
appId
|
|
356
|
+
);
|
|
357
|
+
}
|
|
283
358
|
}
|
|
284
359
|
|
|
285
360
|
export { HtmlEditorController };
|
|
@@ -4,6 +4,7 @@ import './plugin/index.mjs';
|
|
|
4
4
|
import './component/index.mjs';
|
|
5
5
|
export { AIMenu } from './module/ai-module.mjs';
|
|
6
6
|
export { EmojiModule } from './module/emoji-module.mjs';
|
|
7
|
+
export { InLineAIMenu, hoverbarKeysEx } from './module/inline-ai-module.mjs';
|
|
7
8
|
export { EmojiElem } from './element/emoji.mjs';
|
|
8
9
|
export { Plugin } from './plugin/plugin.mjs';
|
|
9
10
|
export { Emoji } from './component/emoji/emoji.mjs';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
class InLineAIButton {
|
|
9
|
+
constructor() {
|
|
10
|
+
__publicField(this, "title");
|
|
11
|
+
__publicField(this, "tag");
|
|
12
|
+
__publicField(this, "iconSvg");
|
|
13
|
+
this.title = "AI";
|
|
14
|
+
this.tag = "button";
|
|
15
|
+
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>';
|
|
16
|
+
}
|
|
17
|
+
// 获取选中文本
|
|
18
|
+
getValue(editor) {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
// 判断按钮是否激活
|
|
22
|
+
isActive(editor) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
// 判断按钮是否可用
|
|
26
|
+
isDisabled(editor) {
|
|
27
|
+
return editor.getConfig().readOnly;
|
|
28
|
+
}
|
|
29
|
+
// 点击按钮的执行逻辑
|
|
30
|
+
exec(editor, value) {
|
|
31
|
+
if (this.isDisabled(editor))
|
|
32
|
+
return;
|
|
33
|
+
editor.emit("lineAiClick");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const InLineAIMenu = {
|
|
37
|
+
key: "inline-ai",
|
|
38
|
+
factory() {
|
|
39
|
+
return new InLineAIButton();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const hoverbarKeysEx = {
|
|
43
|
+
link: {
|
|
44
|
+
menuKeys: ["inline-ai", "editLink", "unLink", "viewLink"]
|
|
45
|
+
},
|
|
46
|
+
image: {
|
|
47
|
+
menuKeys: [
|
|
48
|
+
"inline-ai",
|
|
49
|
+
"imageWidth30",
|
|
50
|
+
"imageWidth50",
|
|
51
|
+
"imageWidth100",
|
|
52
|
+
"editImage",
|
|
53
|
+
"viewImageLink",
|
|
54
|
+
"deleteImage"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
pre: {
|
|
58
|
+
menuKeys: ["inline-ai", "enter", "codeBlock", "codeSelectLang"]
|
|
59
|
+
},
|
|
60
|
+
table: {
|
|
61
|
+
menuKeys: [
|
|
62
|
+
"inline-ai",
|
|
63
|
+
"enter",
|
|
64
|
+
"tableHeader",
|
|
65
|
+
"tableFullWidth",
|
|
66
|
+
"insertTableRow",
|
|
67
|
+
"deleteTableRow",
|
|
68
|
+
"insertTableCol",
|
|
69
|
+
"deleteTableCol",
|
|
70
|
+
"deleteTable"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
divider: {
|
|
74
|
+
menuKeys: ["inline-ai", "enter"]
|
|
75
|
+
},
|
|
76
|
+
video: {
|
|
77
|
+
menuKeys: ["inline-ai", "enter", "editVideoSize"]
|
|
78
|
+
},
|
|
79
|
+
text: {
|
|
80
|
+
menuKeys: [
|
|
81
|
+
"inline-ai",
|
|
82
|
+
"headerSelect",
|
|
83
|
+
"insertLink",
|
|
84
|
+
"bulletedList",
|
|
85
|
+
"|",
|
|
86
|
+
"bold",
|
|
87
|
+
"through",
|
|
88
|
+
"color",
|
|
89
|
+
"bgColor",
|
|
90
|
+
"clearStyle"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { InLineAIMenu, hoverbarKeysEx };
|
|
@@ -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}
|
|
@@ -7,7 +7,9 @@ import { IBizContext, StringUtil, awaitTimeout } from '@ibiz-template/core';
|
|
|
7
7
|
import { UIActionUtil, SysUIActionTag } from '@ibiz-template/runtime';
|
|
8
8
|
import { ElMessageBox } from 'element-plus';
|
|
9
9
|
import '../../../util/index.mjs';
|
|
10
|
+
import './module/index.mjs';
|
|
10
11
|
import './wang-editor.css';
|
|
12
|
+
import { hoverbarKeysEx } from './module/inline-ai-module.mjs';
|
|
11
13
|
import { calcAiToolbarItemsByAc } from '../../../util/ai-util/ai-util.mjs';
|
|
12
14
|
|
|
13
15
|
"use strict";
|
|
@@ -37,6 +39,7 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
37
39
|
const readonlyState = ref(false);
|
|
38
40
|
const enableFullScreen = ref(false);
|
|
39
41
|
const isFullScreen = ref(false);
|
|
42
|
+
let autoClose;
|
|
40
43
|
const editorModel = c.model;
|
|
41
44
|
if (editorModel.editorParams) {
|
|
42
45
|
if (editorModel.editorParams.enableEdit) {
|
|
@@ -55,6 +58,13 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
55
58
|
if (editorModel.editorParams.enablefullscreen) {
|
|
56
59
|
enableFullScreen.value = c.toBoolean(editorModel.editorParams.enablefullscreen);
|
|
57
60
|
}
|
|
61
|
+
if (editorModel.editorParams.autoclose) {
|
|
62
|
+
try {
|
|
63
|
+
autoClose = JSON.parse(editorModel.editorParams.autoclose);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
ibiz.log.error(error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
69
|
if (props.readonly) {
|
|
60
70
|
hasEnableEdit.value = false;
|
|
@@ -180,7 +190,8 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
180
190
|
parseLinkUrl: customParseLinkUrl
|
|
181
191
|
// 也支持 async 函数
|
|
182
192
|
}
|
|
183
|
-
}
|
|
193
|
+
},
|
|
194
|
+
hoverbarKeys: hoverbarKeysEx
|
|
184
195
|
};
|
|
185
196
|
onBeforeUnmount(() => {
|
|
186
197
|
const editor = editorRef.value;
|
|
@@ -227,6 +238,14 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
227
238
|
otherToolbarItems,
|
|
228
239
|
// 编辑器参数srfaiappendcurdata,是否传入对象参数,用于历史查询传参
|
|
229
240
|
appendCurData: c.editorParams.srfaiappendcurdata === "true" ? props.data : void 0,
|
|
241
|
+
// 自动提问
|
|
242
|
+
autoQuestion: c.editorParams.autoquestion !== "false",
|
|
243
|
+
// 自动填充
|
|
244
|
+
autoFill: c.editorParams.autofill === "true",
|
|
245
|
+
// 窗口的打开模式
|
|
246
|
+
openMode: c.editorParams.openmode,
|
|
247
|
+
// 窗口的自动关闭模式
|
|
248
|
+
autoClose,
|
|
230
249
|
// 编辑器参数srfaiappendcurcontent,传入编辑内容作为用户消息,获取历史数据后附加
|
|
231
250
|
appendCurContent: c.editorParams.srfaiappendcurcontent ? StringUtil.fill(c.editorParams.srfaiappendcurcontent, c.context, c.params, props.data) : void 0,
|
|
232
251
|
question: async (aiChat, ctx, param, other, arr, sessionid) => {
|
|
@@ -400,6 +419,18 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
400
419
|
editor.on("aiClick", () => {
|
|
401
420
|
onClickAI();
|
|
402
421
|
});
|
|
422
|
+
editor.on("lineAiClick", () => {
|
|
423
|
+
const selectionPosition = editor.getSelectionPosition();
|
|
424
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
425
|
+
return;
|
|
426
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
427
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
428
|
+
});
|
|
429
|
+
if (items.length === 0)
|
|
430
|
+
return;
|
|
431
|
+
const editorBoundingClientRect = editor.getEditableContainer().getBoundingClientRect();
|
|
432
|
+
ibiz.inLineAIUtil.showContextMenus(editorBoundingClientRect.x + Number(selectionPosition.left.replace("px", "")), editorBoundingClientRect.y + Number(selectionPosition.top.replace("px", "")) + 60, items);
|
|
433
|
+
});
|
|
403
434
|
};
|
|
404
435
|
const handleChange = (editor) => {
|
|
405
436
|
const html = editor.getHtml();
|
|
@@ -615,7 +646,7 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
615
646
|
};
|
|
616
647
|
const renderEditorContent = () => {
|
|
617
648
|
return createVNode("div", {
|
|
618
|
-
"class": ns.b("content"),
|
|
649
|
+
"class": [ns.b("content"), ns.is("editing", !readonlyState.value)],
|
|
619
650
|
"ref": "htmlContent",
|
|
620
651
|
"style": cssVars.value
|
|
621
652
|
}, [createVNode(Toolbar, {
|
|
@@ -685,13 +716,13 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
685
716
|
return !this.isFullScreen ? createVNode("div", {
|
|
686
717
|
"class": [this.ns.b(), {
|
|
687
718
|
[this.ns.b("editor-readonly")]: this.readonlyState
|
|
688
|
-
}, this.ns.is("show-ai", true)]
|
|
719
|
+
}, this.ns.is("show-ai", true), this.ns.is("enable-edit", !this.readonly && !this.disabled)]
|
|
689
720
|
}, [this.renderHeaserToolbar(), this.renderEditorContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]) : createVNode(resolveComponent("el-dialog"), {
|
|
690
721
|
"modelValue": this.isFullScreen,
|
|
691
722
|
"onUpdate:modelValue": ($event) => this.isFullScreen = $event,
|
|
692
723
|
"width": "80%",
|
|
693
724
|
"top": "10vh",
|
|
694
|
-
"class": this.ns.b("dialog-full-screen"),
|
|
725
|
+
"class": [this.ns.b("dialog-full-screen"), this.ns.is("editing", !this.readonlyState)],
|
|
695
726
|
"onClose": () => this.changeFullScreenState()
|
|
696
727
|
}, {
|
|
697
728
|
default: () => [createVNode("div", {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Cherry from 'cherry-markdown';
|
|
2
|
+
import { nextTick } from 'vue';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
function initCustomMenu(c) {
|
|
6
|
+
const AIMenu = Cherry.createMenuHook("AI", {
|
|
7
|
+
icon: {
|
|
8
|
+
type: "svg",
|
|
9
|
+
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 "
|
|
10
|
+
},
|
|
11
|
+
onClick: (_selection, _menukey, event) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const startPos = (_a = c.mdeditor) == null ? void 0 : _a.editor.editor.getCursor("start");
|
|
14
|
+
const endPos = (_b = c.mdeditor) == null ? void 0 : _b.editor.editor.getCursor("end");
|
|
15
|
+
c.setCursorPos(startPos, endPos);
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
nextTick(() => {
|
|
19
|
+
var _a2;
|
|
20
|
+
if ((_a2 = c.mdeditor) == null ? void 0 : _a2.bubble) {
|
|
21
|
+
c.mdeditor.bubble.visible = true;
|
|
22
|
+
const selectionPosition = c.mdeditor.bubble.bubbleDom.getBoundingClientRect();
|
|
23
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
24
|
+
return;
|
|
25
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(
|
|
26
|
+
c.deACMode,
|
|
27
|
+
(tag) => {
|
|
28
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
if (items.length === 0)
|
|
32
|
+
return;
|
|
33
|
+
ibiz.inLineAIUtil.showContextMenus(
|
|
34
|
+
selectionPosition.left,
|
|
35
|
+
selectionPosition.top + 60,
|
|
36
|
+
items
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return [AIMenu];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { initCustomMenu };
|
|
@@ -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}
|