@ibiz-template/vue3-components 0.7.41-alpha.39 → 0.7.41-alpha.40

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.
Files changed (58) hide show
  1. package/dist/ibiz-markdown-editor-CxFS8frQ.js +1 -0
  2. package/dist/index-2eZnbrr4.js +11 -0
  3. package/dist/index.min.css +1 -1
  4. package/dist/index.system.min.js +1 -1
  5. package/dist/wang-editor-BPl509oX.js +1 -0
  6. package/dist/{xlsx-util-DpgMzatq.js → xlsx-util-Cg5zMYCC.js} +1 -1
  7. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.mjs +146 -0
  8. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.css +1 -0
  9. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.mjs +165 -0
  10. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.provider.mjs +21 -0
  11. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.state.mjs +22 -0
  12. package/es/control/form/form-detail/form-item/composite-form-item-ex/index.mjs +16 -0
  13. package/es/control/form/form-detail/form-item/index.mjs +2 -0
  14. package/es/control/grid/grid/grid.css +1 -1
  15. package/es/control/grid/grid-column/grid-field-column/grid-field-column.css +1 -1
  16. package/es/editor/code/code-editor.controller.mjs +17 -1
  17. package/es/editor/data-picker/ibiz-picker-dropdown/ibiz-picker-dropdown.css +1 -1
  18. package/es/editor/html/html-editor.controller.mjs +21 -2
  19. package/es/editor/html/wang-editor/wang-editor.css +1 -1
  20. package/es/editor/html/wang-editor/wang-editor.mjs +7 -4
  21. package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +1 -1
  22. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  23. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +27 -6
  24. package/es/editor/markdown/ibiz-markdown-editor/render-util.mjs +88 -0
  25. package/es/editor/markdown/markdown-editor.controller.mjs +21 -5
  26. package/es/util/ai-util/ai-util.mjs +17 -1
  27. package/es/util/app-util/app-util.mjs +24 -8
  28. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +38 -5
  29. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +24 -16
  30. package/es/util/inline-ai-util/inline-ai-util.mjs +3 -2
  31. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.cjs +170 -0
  32. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.cjs +148 -0
  33. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.css +1 -0
  34. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.provider.cjs +23 -0
  35. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.state.cjs +24 -0
  36. package/lib/control/form/form-detail/form-item/composite-form-item-ex/index.cjs +20 -0
  37. package/lib/control/form/form-detail/form-item/index.cjs +2 -0
  38. package/lib/control/grid/grid/grid.css +1 -1
  39. package/lib/control/grid/grid-column/grid-field-column/grid-field-column.css +1 -1
  40. package/lib/editor/code/code-editor.controller.cjs +17 -1
  41. package/lib/editor/data-picker/ibiz-picker-dropdown/ibiz-picker-dropdown.css +1 -1
  42. package/lib/editor/html/html-editor.controller.cjs +21 -2
  43. package/lib/editor/html/wang-editor/wang-editor.cjs +7 -4
  44. package/lib/editor/html/wang-editor/wang-editor.css +1 -1
  45. package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +1 -1
  46. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +27 -6
  47. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  48. package/lib/editor/markdown/ibiz-markdown-editor/render-util.cjs +90 -0
  49. package/lib/editor/markdown/markdown-editor.controller.cjs +21 -5
  50. package/lib/util/ai-util/ai-util.cjs +17 -0
  51. package/lib/util/app-util/app-util.cjs +23 -7
  52. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +23 -15
  53. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +38 -5
  54. package/lib/util/inline-ai-util/inline-ai-util.cjs +3 -2
  55. package/package.json +5 -5
  56. package/dist/ibiz-markdown-editor-D4Og0fLv.js +0 -1
  57. package/dist/index-DHKZJQyN.js +0 -11
  58. package/dist/wang-editor-BYeoazrn.js +0 -1
@@ -18,7 +18,8 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
18
18
  props: getHtmlProps(),
19
19
  emits: getEditorEmits(),
20
20
  setup(props, {
21
- emit
21
+ emit,
22
+ slots
22
23
  }) {
23
24
  const ns = useNamespace("html");
24
25
  const c = props.controller;
@@ -651,11 +652,12 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
651
652
  return null;
652
653
  };
653
654
  const renderEditorContent = () => {
655
+ var _a;
654
656
  return createVNode("div", {
655
657
  "class": [ns.b("content"), ns.is("editing", !readonlyState.value)],
656
658
  "ref": "htmlContent",
657
659
  "style": cssVars.value
658
- }, [createVNode(Toolbar, {
660
+ }, [(_a = slots.editorSwitchMenu) == null ? void 0 : _a.call(slots), createVNode(Toolbar, {
659
661
  "ref": "toolbarRef",
660
662
  "editor": editorRef.value,
661
663
  "default-config": toolbarConfig,
@@ -719,10 +721,11 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
719
721
  };
720
722
  },
721
723
  render() {
724
+ const isShowEditorSwitchMenu = !!this.$slots.editorSwitchMenu;
722
725
  return !this.isFullScreen ? createVNode("div", {
723
726
  "class": [this.ns.b(), {
724
727
  [this.ns.b("editor-readonly")]: this.readonlyState
725
- }, this.ns.is("show-ai", true), this.ns.is("enable-edit", !this.readonly && !this.disabled)]
728
+ }, this.ns.is("show-ai", true), this.ns.is("enable-edit", !this.readonly && !this.disabled), this.ns.is("show-editor-switch-menu", isShowEditorSwitchMenu)]
726
729
  }, [this.renderHeaserToolbar(), this.renderEditorContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]) : createVNode(resolveComponent("el-dialog"), {
727
730
  "modelValue": this.isFullScreen,
728
731
  "onUpdate:modelValue": ($event) => this.isFullScreen = $event,
@@ -734,7 +737,7 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
734
737
  default: () => [createVNode("div", {
735
738
  "class": [this.ns.b(), {
736
739
  [this.ns.b("editor-readonly")]: this.readonlyState
737
- }]
740
+ }, this.ns.is("show-editor-switch-menu", isShowEditorSwitchMenu)]
738
741
  }, [this.renderHeaserToolbar(), this.renderEditorContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null])]
739
742
  });
740
743
  }
@@ -14,7 +14,7 @@ function initCustomMenu(c) {
14
14
  nextTick(() => {
15
15
  var _a;
16
16
  if ((_a = c.mdeditor) == null ? void 0 : _a.bubble) {
17
- c.mdeditor.bubble.visible = true;
17
+ c.mdeditor.bubble.showBubble();
18
18
  const selectionPosition = c.mdeditor.bubble.bubbleDom.getBoundingClientRect();
19
19
  if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
20
20
  return;
@@ -1 +1 @@
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);outline:0}.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}
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-color-dark-scrollbar-thumb-dark:rgb(var(--ibiz-grey-4));--ibiz-markdown-color-light-scrollbar-thumb-dark:rgb(var(--ibiz-grey-4));--ibiz-markdown-color-scrollbar-thumb-dark-hover:rgba(var(--ibiz-grey-4), 0.5);--ibiz-markdown-color-dark-toc-text:var(--ibiz-color-fill-0);--ibiz-markdown-color-toc-header-text:var(--ibiz-color-text-0);--ibiz-markdown-color-dark-mardown-border:rgb(var(--ibiz-grey-2));--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-img-preview-top:-32px;--ibiz-markdown-img-preview-right:-36px;--ibiz-markdown-img-preview-width:32px;--ibiz-markdown-img-preview-height:32px}.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__img-preview.el-image{position:absolute;height:0}.ibiz-markdown__img-preview .el-image-viewer__wrapper{width:90%;height:90%;margin:auto}.ibiz-markdown__img-preview .el-image-viewer__mask{position:fixed;width:100vw;height:100vh;cursor:zoom-out;opacity:.7}.ibiz-markdown__img-preview .el-image-viewer__close{top:var(--ibiz-markdown-img-preview-top);right:var(--ibiz-markdown-img-preview-right);width:var(--ibiz-markdown-img-preview-width);height:var(--ibiz-markdown-img-preview-height)}.ibiz-markdown .ibiz-markdown-cherry{width:var(--ibiz-markdown-width);outline:0}.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{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-previewer img{cursor:zoom-in}.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.is-manual .ibiz-markdown-menu{display:none}.ibiz-markdown.is-manual.is-editing .ibiz-markdown-menu{display:block}.ibiz-markdown.is-show-editor-switch-menu .ibiz-composite-form-item-ex-menu{--ibiz-composite-form-item-ex-menu-height:48px;--ibiz-composite-form-item-ex-menu-padding:var(--ibiz-spacing-tight) var(--ibiz-spacing-tight) 0}.ibiz-markdown.is-show-editor-switch-menu .cherry-toolbar{padding-right:var(--ibiz-composite-form-item-ex-menu-width)}.ibiz-markdown.is-show-editor-switch-menu .ibiz-markdown-menu{position:absolute;top:0;right:0}.ibiz-markdown.is-show-editor-switch-menu .ibiz-markdown-menu.is-fullscreen{position:fixed;z-index:1000}.ibiz-markdown.is-show-editor-switch-menu .ibiz-markdown-menu .ibiz-composite-form-item-ex-menu{position:relative}.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}.ibiz-markdown--light .theme__green .cherry-toolbar,.ibiz-markdown--light .theme__light .cherry-toolbar,.ibiz-markdown--light .theme__violet .cherry-toolbar{background-color:var(--ibiz-color-bg-0)}.ibiz-markdown--light .theme__dark.cherry .cherry-flex-toc{color:var(--ibiz-markdown-color-toc-header-text)}.ibiz-markdown--light .theme__dark.cherry ::-webkit-scrollbar-thumb{background:var(--ibiz-markdown-color-light-scrollbar-thumb-dark)}.ibiz-markdown--light .theme__dark.cherry ::-webkit-scrollbar-thumb:hover{background:var(--ibiz-markdown-color-scrollbar-thumb-dark-hover)}.ibiz-markdown--dark.ibiz-markdown-cherry .cherry{border:1px solid var(--ibiz-markdown-color-dark-mardown-border)}.ibiz-markdown--dark .theme__green .cherry-toolbar,.ibiz-markdown--dark .theme__light .cherry-toolbar,.ibiz-markdown--dark .theme__violet .cherry-toolbar{background-color:var(--ibiz-color-shadow)}.ibiz-markdown--dark .theme__dark.cherry .cherry-toc-head{color:var(--ibiz-markdown-color-dark-toc-text)}.ibiz-markdown--dark .theme__dark.cherry ::-webkit-scrollbar-thumb{background:var(--ibiz-markdown-color-dark-scrollbar-thumb-dark)}.ibiz-markdown--dark .theme__dark.cherry ::-webkit-scrollbar-thumb:hover{background:var(--ibiz-markdown-color-scrollbar-thumb-dark-hover)}
@@ -2,8 +2,9 @@ import { defineComponent, createVNode, ref, watch, nextTick, onMounted, onBefore
2
2
  import { useNamespace, useUIStore, getEditorEmits, getMarkDownProps } from '@ibiz-template/vue3-util';
3
3
  import { createUUID } from 'qx-util';
4
4
  import Cherry from 'cherry-markdown';
5
- import './ibiz-markdown-editor.css';
6
5
  import { initCustomMenu } from './custom-menu.mjs';
6
+ import { useImgPreviewRender } from './render-util.mjs';
7
+ import './ibiz-markdown-editor.css';
7
8
 
8
9
  "use strict";
9
10
  const IBizMarkDown = /* @__PURE__ */ defineComponent({
@@ -11,7 +12,8 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
11
12
  props: getMarkDownProps(),
12
13
  emits: getEditorEmits(),
13
14
  setup(props, {
14
- emit
15
+ emit,
16
+ slots
15
17
  }) {
16
18
  var _a, _b, _c;
17
19
  const ns = useNamespace("markdown");
@@ -20,6 +22,10 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
20
22
  let editor = null;
21
23
  const id = createUUID();
22
24
  const [AIMenu] = initCustomMenu(c);
25
+ const {
26
+ onMDEditorCreated,
27
+ renderImgPreview
28
+ } = useImgPreviewRender(ns);
23
29
  const uploadHeaders = ibiz.util.file.getUploadHeaders();
24
30
  const headers = ref({
25
31
  ...uploadHeaders
@@ -40,6 +46,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
40
46
  let resizeObserver = null;
41
47
  let lastMarkDownWidth = 0;
42
48
  const cssVars = ref({});
49
+ const lastDirectoryState = ref("full");
43
50
  let isIgnoreChange = false;
44
51
  watch(() => props.data, (newVal) => {
45
52
  if (newVal && c) {
@@ -201,9 +208,12 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
201
208
  if (editor && markDownBox.value) {
202
209
  if (isFullscreen()) {
203
210
  closeFullscreen();
211
+ editor.toggleToc(lastDirectoryState.value);
204
212
  isFullScreen.value = false;
205
213
  } else {
206
214
  openFullscreen();
215
+ lastDirectoryState.value = editor.toc.model;
216
+ editor.toggleToc("full");
207
217
  isFullScreen.value = true;
208
218
  }
209
219
  }
@@ -214,6 +224,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
214
224
  _e.preventDefault();
215
225
  if (isFullscreen()) {
216
226
  closeFullscreen();
227
+ editor.toggleToc(lastDirectoryState.value);
217
228
  isFullScreen.value = false;
218
229
  }
219
230
  }
@@ -340,6 +351,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
340
351
  const parentElement = props.disabled ? editor.editor.options.editorDom.parentElement : (_a2 = editor.editor.options.editorDom.parentElement) == null ? void 0 : _a2.querySelector(".cherry-toolbar>.toolbar-right");
341
352
  parentElement == null ? void 0 : parentElement.appendChild(span);
342
353
  c == null ? void 0 : c.setMDEditor(editor);
354
+ onMDEditorCreated(editor);
343
355
  });
344
356
  };
345
357
  watch(() => UIStore.theme, (newVal) => {
@@ -439,6 +451,12 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
439
451
  }, [ibiz.i18n.t("editor.common.confirm")])]);
440
452
  }
441
453
  };
454
+ const renderEditorSwitchMenu = () => {
455
+ var _a2;
456
+ return createVNode("div", {
457
+ "class": [ns.b("menu"), ns.is("fullscreen", isFullScreen.value)]
458
+ }, [(_a2 = slots.editorSwitchMenu) == null ? void 0 : _a2.call(slots)]);
459
+ };
442
460
  onMounted(() => {
443
461
  var _a2;
444
462
  editorInit();
@@ -471,18 +489,21 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
471
489
  getCherryContent,
472
490
  setCherryContent,
473
491
  renderHeader,
474
- renderFooter
492
+ renderFooter,
493
+ renderImgPreview,
494
+ renderEditorSwitchMenu
475
495
  };
476
496
  },
477
497
  render() {
498
+ const isShowEditorSwitchMenu = !!this.$slots.editorSwitchMenu;
478
499
  return createVNode("div", {
479
500
  "ref": "markDownBox",
480
- "class": [this.ns.b(), this.ns.is("disabled", this.disabled), this.ns.is("manual", this.showmode === "manual"), this.ns.is("editing", this.isEditing)]
481
- }, [this.renderHeader(), this.renderFooter(), createVNode("div", {
501
+ "class": [this.ns.b(), this.ns.is("disabled", this.disabled), this.ns.is("manual", this.showmode === "manual"), this.ns.is("editing", this.isEditing), this.ns.is("show-editor-switch-menu", isShowEditorSwitchMenu)]
502
+ }, [isShowEditorSwitchMenu ? this.renderEditorSwitchMenu() : null, this.renderHeader(), this.renderFooter(), this.renderImgPreview(), createVNode("div", {
482
503
  "tabindex": "-1",
483
504
  "id": this.id,
484
505
  "style": this.cssVars,
485
- "class": this.ns.b("cherry")
506
+ "class": [this.ns.b("cherry"), this.ns.m(this.theme === "dark" ? "dark" : "light")]
486
507
  }, null)]);
487
508
  }
488
509
  });
@@ -0,0 +1,88 @@
1
+ import { ref, nextTick, createVNode, resolveComponent, onBeforeUnmount } from 'vue';
2
+
3
+ "use strict";
4
+ function isElement(element, nodeName) {
5
+ return !!(element && element.nodeType === 1 && element.nodeName === nodeName);
6
+ }
7
+ function useImgPreviewRender(ns) {
8
+ const imgPreviewUrl = ref("");
9
+ const imgPreviewUrlList = ref([]);
10
+ const imgPreviewRef = ref();
11
+ let mdPreviewerDom = null;
12
+ const openImgPreview = async (url) => {
13
+ var _a;
14
+ imgPreviewUrl.value = url;
15
+ imgPreviewUrlList.value = [url];
16
+ await nextTick();
17
+ if (imgPreviewRef.value) {
18
+ const {
19
+ container
20
+ } = imgPreviewRef.value.$refs;
21
+ if (container) {
22
+ (_a = container.children[0]) == null ? void 0 : _a.click();
23
+ }
24
+ }
25
+ };
26
+ const handleKeyPress = (event) => {
27
+ if (event.key === "Escape" || event.keyCode === 27) {
28
+ event.stopPropagation();
29
+ event.preventDefault();
30
+ imgPreviewUrlList.value = [];
31
+ removeKeydownListener();
32
+ }
33
+ };
34
+ const addKeydownListener = async () => {
35
+ var _a;
36
+ await nextTick();
37
+ const container = (_a = imgPreviewRef.value) == null ? void 0 : _a.$refs.container;
38
+ if (!container)
39
+ return;
40
+ const imgViewerWrapper = container.querySelector(".el-image-viewer__wrapper");
41
+ imgViewerWrapper == null ? void 0 : imgViewerWrapper.addEventListener("keydown", handleKeyPress);
42
+ };
43
+ const removeKeydownListener = () => {
44
+ var _a;
45
+ const container = (_a = imgPreviewRef.value) == null ? void 0 : _a.$refs.container;
46
+ if (!container)
47
+ return;
48
+ const imgViewerWrapper = container.querySelector(".el-image-viewer__wrapper");
49
+ imgViewerWrapper == null ? void 0 : imgViewerWrapper.removeEventListener("keydown", handleKeyPress);
50
+ };
51
+ const handlePreviewerImgClick = (event) => {
52
+ var _a;
53
+ const imgUrl = (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.src;
54
+ if (isElement(event == null ? void 0 : event.target, "IMG") && imgUrl) {
55
+ openImgPreview(imgUrl);
56
+ }
57
+ };
58
+ const renderImgPreview = () => {
59
+ return createVNode(resolveComponent("el-image"), {
60
+ "class": ns.e("img-preview"),
61
+ "ref": imgPreviewRef,
62
+ "zoom-rate": 1.1,
63
+ "src": imgPreviewUrl.value,
64
+ "preview-src-list": imgPreviewUrlList.value,
65
+ "hide-on-click-modal": true,
66
+ "onShow": addKeydownListener,
67
+ "fit": "cover"
68
+ }, null);
69
+ };
70
+ const onMDEditorCreated = (mdeditor) => {
71
+ var _a, _b;
72
+ mdPreviewerDom = ((_b = (_a = mdeditor == null ? void 0 : mdeditor.previewer) == null ? void 0 : _a.previewerBubble) == null ? void 0 : _b.previewerDom) || null;
73
+ mdPreviewerDom == null ? void 0 : mdPreviewerDom.addEventListener("click", handlePreviewerImgClick);
74
+ };
75
+ onBeforeUnmount(() => {
76
+ if (mdPreviewerDom) {
77
+ mdPreviewerDom.removeEventListener("click", handlePreviewerImgClick);
78
+ mdPreviewerDom = null;
79
+ }
80
+ removeKeydownListener();
81
+ });
82
+ return {
83
+ renderImgPreview,
84
+ onMDEditorCreated
85
+ };
86
+ }
87
+
88
+ export { useImgPreviewRender };
@@ -1,5 +1,6 @@
1
1
  import { RuntimeModelError } from '@ibiz-template/core';
2
2
  import { EditorController, getDeACMode, UIActionUtil } from '@ibiz-template/runtime';
3
+ import { clone } from 'ramda';
3
4
 
4
5
  "use strict";
5
6
  var __defProp = Object.defineProperty;
@@ -103,6 +104,13 @@ class MarkDownEditorController extends EditorController {
103
104
  * @memberof MarkDownEditorController
104
105
  */
105
106
  __publicField(this, "currentEditorTheme", "light");
107
+ /**
108
+ * AI行内聊天框高度
109
+ *
110
+ * @type {number}
111
+ * @memberof MarkDownEditorController
112
+ */
113
+ __publicField(this, "inlineAiChatHeight");
106
114
  }
107
115
  async onInit() {
108
116
  await super.onInit();
@@ -110,7 +118,7 @@ class MarkDownEditorController extends EditorController {
110
118
  this.style.height = "600px";
111
119
  }
112
120
  if (this.editorParams) {
113
- const { uploadparams, exportparams } = this.editorParams;
121
+ const { uploadparams, exportparams, inlineaichatheight } = this.editorParams;
114
122
  if (uploadparams) {
115
123
  try {
116
124
  this.uploadParams = JSON.parse(uploadparams);
@@ -131,6 +139,9 @@ class MarkDownEditorController extends EditorController {
131
139
  );
132
140
  }
133
141
  }
142
+ if (inlineaichatheight) {
143
+ this.inlineAiChatHeight = Number(inlineaichatheight);
144
+ }
134
145
  }
135
146
  const model = this.model;
136
147
  if (model.appDEACModeId) {
@@ -312,9 +323,12 @@ class MarkDownEditorController extends EditorController {
312
323
  * @memberof MarkDownEditorController
313
324
  */
314
325
  getInLineAiChatOptions() {
315
- var _a, _b, _c;
326
+ var _a, _b, _c, _d, _e;
316
327
  const editorRect = (_a = this.mdeditor) == null ? void 0 : _a.wrapperDom.getBoundingClientRect();
317
- const bubbleRect = (_b = this.mdeditor) == null ? void 0 : _b.bubble.bubbleDom.getBoundingClientRect();
328
+ if (!((_b = this.mdeditor) == null ? void 0 : _b.bubble.visible)) {
329
+ (_c = this.mdeditor) == null ? void 0 : _c.bubble.showBubble();
330
+ }
331
+ const bubbleRect = (_d = this.mdeditor) == null ? void 0 : _d.bubble.bubbleDom.getBoundingClientRect();
318
332
  return {
319
333
  // 编辑器的左侧距离 + 10px
320
334
  left: editorRect.left + 10,
@@ -322,8 +336,9 @@ class MarkDownEditorController extends EditorController {
322
336
  top: bubbleRect.top,
323
337
  // 编辑器的宽度 - 右侧工具栏的宽度(38px) - 左侧边距(10px)- 右侧边距(10px)
324
338
  width: editorRect.width - 58,
325
- editorElement: (_c = this.mdeditor) == null ? void 0 : _c.wrapperDom,
326
- editorTheme: this.getCurrentTheme()
339
+ editorElement: (_e = this.mdeditor) == null ? void 0 : _e.wrapperDom,
340
+ editorTheme: this.getCurrentTheme(),
341
+ height: this.inlineAiChatHeight
327
342
  };
328
343
  }
329
344
  /**
@@ -346,6 +361,7 @@ class MarkDownEditorController extends EditorController {
346
361
  */
347
362
  async doInLineAIUIAction(uiActionId, appId) {
348
363
  const eventArgs = this.ctrl.getEventArgs();
364
+ eventArgs.params = clone(eventArgs.params);
349
365
  eventArgs.params.editor = this;
350
366
  if (this.editorParams.srfaiappendcurdata && this.editorParams.srfaiappendcurdata === "true") {
351
367
  eventArgs.context.srfaiappendcurdata = true;
@@ -1,3 +1,5 @@
1
+ import { UtilService } from '@ibiz-template/runtime';
2
+
1
3
  "use strict";
2
4
  function calcAiToolbarItemsByAc(deACMode) {
3
5
  var _a, _b;
@@ -48,5 +50,19 @@ function calcAiToolbarItemsByAc(deACMode) {
48
50
  inlineToolbarItems
49
51
  };
50
52
  }
53
+ const getAIAgentList = async (context, params) => {
54
+ const emptyList = [];
55
+ const app = ibiz.hub.getApp(ibiz.env.appId);
56
+ const aiAgentUtil = app.getAppUtil("DYNAMICAIGENT", "CUSTOM");
57
+ if (!aiAgentUtil) {
58
+ return emptyList;
59
+ }
60
+ const utilService = new UtilService(aiAgentUtil);
61
+ const data = await utilService.load("", context, params);
62
+ if (!data || data.length === 0) {
63
+ return emptyList;
64
+ }
65
+ return data;
66
+ };
51
67
 
52
- export { calcAiToolbarItemsByAc };
68
+ export { calcAiToolbarItemsByAc, getAIAgentList };
@@ -2,7 +2,7 @@ import { getDeACMode, calcDeCodeNameById, UIActionUtil, SysUIActionTag, ConfigSe
2
2
  import { createUUID } from 'qx-util';
3
3
  import { StringUtil, IBizContext } from '@ibiz-template/core';
4
4
  import { route2routePath, useUIStore, routePath2string } from '@ibiz-template/vue3-util';
5
- import { calcAiToolbarItemsByAc } from '../ai-util/ai-util.mjs';
5
+ import { getAIAgentList, calcAiToolbarItemsByAc } from '../ai-util/ai-util.mjs';
6
6
 
7
7
  "use strict";
8
8
  var __defProp = Object.defineProperty;
@@ -237,6 +237,7 @@ class AppUtil {
237
237
  appDEACModeId,
238
238
  appDataEntityId
239
239
  } = chartParams;
240
+ const aiAgentlist = await getAIAgentList(context, params);
240
241
  const exParams = this.computeAiExParams(context, params, data);
241
242
  const deACMode = await getDeACMode(
242
243
  appDEACModeId,
@@ -309,11 +310,19 @@ class AppUtil {
309
310
  footerToolbarItems,
310
311
  questionToolbarItems,
311
312
  otherToolbarItems,
312
- question: async (aiChat, ctx, param, other, arr, sessionid) => {
313
+ aiAgentlist,
314
+ question: async (aiChat, ctx, param, other, arr, sessionid, srfaiagent) => {
313
315
  id = createUUID();
314
316
  abortController = new AbortController();
315
317
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
316
318
  try {
319
+ const questionRequestData = {
320
+ messages: arr,
321
+ sessionid
322
+ };
323
+ if (srfaiagent) {
324
+ questionRequestData.srfaiagent = srfaiagent;
325
+ }
317
326
  await deService.aiChatSse(
318
327
  (msg) => {
319
328
  if (msg.actionstate === 20 && msg.actionresult) {
@@ -349,10 +358,7 @@ class AppUtil {
349
358
  abortController,
350
359
  ctx,
351
360
  param,
352
- {
353
- messages: arr,
354
- sessionid
355
- }
361
+ { ...questionRequestData }
356
362
  );
357
363
  } catch (error) {
358
364
  aiChat.replaceMessage({
@@ -384,11 +390,21 @@ class AppUtil {
384
390
  },
385
391
  history: async (ctx, param, other) => {
386
392
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
387
- const historyData = other.appendCurData ? other.appendCurData : {};
393
+ const historyRequestData = {};
394
+ if (other.appendCurData) {
395
+ Object.assign(historyRequestData, {
396
+ ...other.appendCurData
397
+ });
398
+ }
399
+ if (other.srfaiagent) {
400
+ Object.assign(historyRequestData, {
401
+ srfaiagent: other.srfaiagent
402
+ });
403
+ }
388
404
  const result = await deService.aiChatHistory(
389
405
  ctx,
390
406
  param,
391
- historyData
407
+ historyRequestData
392
408
  );
393
409
  if (result.data && Array.isArray(result.data)) {
394
410
  let preMsg;
@@ -1,3 +1,5 @@
1
+ import qs from 'qs';
2
+ import { notNilEmpty } from 'qx-util';
1
3
  import { onMounted, onUnmounted, ref } from 'vue';
2
4
  import { calcResPath } from '@ibiz-template/runtime';
3
5
  import { RegenerateIcon, insertTextIcon, ReplaceTextIcon, CopyTextIcon, CancelIcon } from './icon.mjs';
@@ -15,7 +17,11 @@ const computedInLineAIParams = (props) => {
15
17
  const useInLineAIContainerClick = (props, content, isLoading) => {
16
18
  const handclick = async (evt) => {
17
19
  const target = evt.target;
18
- if (!target.closest(".ibiz-inline-ai-textarea-container") && !target.closest(".ibiz-inline-ai-alert") && !isLoading.value) {
20
+ if (!target.closest(".ibiz-inline-ai-textarea-container") && !target.closest(".ibiz-inline-ai-alert")) {
21
+ if (isLoading.value) {
22
+ evt.stopPropagation();
23
+ return;
24
+ }
19
25
  const isChange = props.content !== content.value;
20
26
  let isClose = true;
21
27
  if (isChange) {
@@ -70,6 +76,27 @@ const useAI = (props, opts) => {
70
76
  );
71
77
  }
72
78
  };
79
+ const abortController = ref();
80
+ const attachUrlParam = (url) => {
81
+ {
82
+ const urlSplit = url.split("?");
83
+ urlSplit[0] = urlSplit[0].split("/").map((item) => encodeURIComponent(item)).join("/");
84
+ url = urlSplit.length > 1 ? urlSplit.join("?") : urlSplit[0];
85
+ }
86
+ const strParams = qs.stringify(params);
87
+ if (notNilEmpty(strParams)) {
88
+ if (url.endsWith("?")) {
89
+ url = "".concat(url).concat(strParams);
90
+ } else if (url.indexOf("?") !== -1 && url.endsWith("&")) {
91
+ url = "".concat(url).concat(strParams);
92
+ } else if (url.indexOf("?") !== -1 && !url.endsWith("&")) {
93
+ url = "".concat(url, "&").concat(strParams);
94
+ } else {
95
+ url = "".concat(url, "?").concat(strParams);
96
+ }
97
+ }
98
+ return url;
99
+ };
73
100
  const askAI = async (content) => {
74
101
  var _a, _b;
75
102
  const body = {
@@ -85,12 +112,17 @@ const useAI = (props, opts) => {
85
112
  Object.assign(body, { mode: srfmode });
86
113
  if (srfaiagent)
87
114
  Object.assign(body, { srfaiagent });
115
+ abortController.value = new AbortController();
88
116
  const appDataEntity = await ibiz.hub.getAppDataEntity(
89
117
  deACMode.appDataEntityId,
90
118
  deACMode.appId
91
119
  );
92
- const path = calcAIPath(appDataEntity);
93
- const response = await app.net.post(path, body, params);
120
+ const path = attachUrlParam(calcAIPath(appDataEntity));
121
+ const response = await app.net.request(path, {
122
+ method: "post",
123
+ data: body,
124
+ signal: abortController.value.signal
125
+ });
94
126
  if (response.ok) {
95
127
  const result = (_b = (_a = response.data.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.content;
96
128
  return result;
@@ -101,7 +133,8 @@ const useAI = (props, opts) => {
101
133
  loadAiHistory();
102
134
  });
103
135
  return {
104
- askAI
136
+ askAI,
137
+ abortController
105
138
  };
106
139
  };
107
140
  const useBase = (props, container, target) => {
@@ -152,7 +185,7 @@ const useBase = (props, container, target) => {
152
185
  top: "".concat(options.top, "px")
153
186
  });
154
187
  const contentStyle = ref({
155
- height: "".concat(options.height || 80, "px"),
188
+ height: "".concat(options.height || 300, "px"),
156
189
  "max-height": "".concat(options.maxHeight, "px")
157
190
  });
158
191
  const updatePosition = () => {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, createVNode, withDirectives, vModelText, ref, computed, onMounted } from 'vue';
2
2
  import { useNamespace } from '@ibiz-template/vue3-util';
3
- import { computedInLineAIParams, useBase, useInLineAIContainerClick, useAI } from './inline-ai-textarea.hook.mjs';
3
+ import { computedInLineAIParams, useBase, useAI, useInLineAIContainerClick } from './inline-ai-textarea.hook.mjs';
4
4
  import { AIIcon, StopIcon, SendIcon } from './icon.mjs';
5
5
  import './inline-ai-textarea.css';
6
6
 
@@ -76,30 +76,38 @@ const InlineAITextArea = /* @__PURE__ */ defineComponent({
76
76
  containerStyle,
77
77
  contentStyle
78
78
  } = useBase(props, containerRef, actionsRef);
79
- useInLineAIContainerClick(props, textareaContent, isLoading);
80
79
  const {
81
- askAI
80
+ askAI,
81
+ abortController
82
82
  } = useAI(props, {
83
83
  srfaiappendcurdata,
84
84
  srfmode,
85
85
  srfaiagent
86
86
  });
87
+ const stopQuestionAndClose = () => {
88
+ var _a;
89
+ (_a = abortController.value) == null ? void 0 : _a.abort();
90
+ props.unMountAIChat();
91
+ };
92
+ useInLineAIContainerClick(props, textareaContent, isLoading);
87
93
  const restoreFocus = () => {
88
94
  var _a;
89
95
  (_a = textareaRef.value) == null ? void 0 : _a.blur();
90
96
  props.restoreSelection();
91
97
  };
92
98
  const sendQuestion = async (content) => {
93
- restoreFocus();
94
- question = content;
95
- textareaContent.value = "";
96
- isLoading.value = true;
97
- textareaContent.value = await askAI(question);
98
- isLoading.value = false;
99
- contentType.value = "ASSISTANT";
100
- };
101
- const stopQuestion = () => {
102
- props.unMountAIChat();
99
+ try {
100
+ isLoading.value = true;
101
+ restoreFocus();
102
+ question = content;
103
+ textareaContent.value = "";
104
+ textareaContent.value = await askAI(question);
105
+ contentType.value = "ASSISTANT";
106
+ } catch (error) {
107
+ ibiz.log.error(error);
108
+ } finally {
109
+ isLoading.value = false;
110
+ }
103
111
  };
104
112
  const onKeydown = (e) => {
105
113
  if (e.code === "Enter" && !e.isComposing) {
@@ -159,8 +167,8 @@ const InlineAITextArea = /* @__PURE__ */ defineComponent({
159
167
  textareaContent,
160
168
  onKeydown,
161
169
  sendQuestion,
162
- stopQuestion,
163
- handleAction
170
+ handleAction,
171
+ stopQuestionAndClose
164
172
  };
165
173
  },
166
174
  render() {
@@ -194,7 +202,7 @@ const InlineAITextArea = /* @__PURE__ */ defineComponent({
194
202
  "class": this.ns.em("content", "suffix")
195
203
  }, [this.isLoading && createVNode("div", {
196
204
  "class": this.ns.em("content", "stop-icon"),
197
- "onClick": () => this.stopQuestion()
205
+ "onClick": () => this.stopQuestionAndClose()
198
206
  }, [StopIcon, createVNode("span", null, [ibiz.i18n.t("util.inlineAiUtil.stopEdit")])]), !this.disabled && createVNode("div", {
199
207
  "class": this.ns.em("content", "sand-icon"),
200
208
  "onClick": () => this.sendQuestion(this.textareaContent)
@@ -81,12 +81,13 @@ class InLineAIUtil {
81
81
  * @param y 距离上方距离
82
82
  * @param menus 菜单集合
83
83
  */
84
- showContextMenus(x, y, menus) {
84
+ showContextMenus(x, y, menus, options = {}) {
85
85
  ContextMenu.showContextMenu({
86
86
  x,
87
87
  y,
88
88
  customClass: this.ns.b("context-menu"),
89
- items: menus
89
+ items: menus,
90
+ ...options
90
91
  });
91
92
  }
92
93
  /**