@ibiz-template/vue3-components 0.7.41-alpha.38 → 0.7.41-alpha.39
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-D4Og0fLv.js +1 -0
- package/dist/{index-Dp8ExwuL.js → index-BewO9StC.js} +1 -1
- package/dist/{index-C28lnh2e.js → index-ClxO69TM.js} +1 -1
- package/dist/index-DHKZJQyN.js +11 -0
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{wang-editor-DDVqSnRX.js → wang-editor-BYeoazrn.js} +1 -1
- package/dist/{xlsx-util-BMANxyk-.js → xlsx-util-DpgMzatq.js} +1 -1
- package/es/control/form/form-detail/form-item/form-item-container/form-item-container.mjs +42 -8
- package/es/editor/code/code-editor.controller.mjs +72 -25
- package/es/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/es/editor/code/monaco-editor/monaco-editor.mjs +20 -8
- package/es/editor/html/html-editor.controller.mjs +49 -4
- package/es/editor/html/wang-editor/wang-editor.mjs +7 -1
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +5 -7
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +42 -4
- package/es/editor/markdown/markdown-editor.controller.mjs +111 -6
- package/es/locale/en/index.mjs +5 -2
- package/es/locale/zh-CN/index.mjs +5 -2
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +76 -21
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +48 -33
- package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.cjs +42 -8
- package/lib/editor/code/code-editor.controller.cjs +72 -25
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +20 -8
- package/lib/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/lib/editor/html/html-editor.controller.cjs +49 -4
- package/lib/editor/html/wang-editor/wang-editor.cjs +7 -1
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +5 -7
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +42 -4
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/markdown/markdown-editor.controller.cjs +111 -6
- package/lib/locale/en/index.cjs +5 -2
- package/lib/locale/zh-CN/index.cjs +5 -2
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +48 -33
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +76 -21
- package/package.json +4 -4
- package/dist/ibiz-markdown-editor-qRaayafj.js +0 -1
- package/dist/index-BiYphJ2f.js +0 -11
|
@@ -54,7 +54,7 @@ const IBizFormItemContainer = /* @__PURE__ */ defineComponent({
|
|
|
54
54
|
}, null);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
const
|
|
57
|
+
const renderTipsIcon = () => {
|
|
58
58
|
return createVNode(resolveComponent("el-tooltip"), {
|
|
59
59
|
"effect": "light",
|
|
60
60
|
"visible": visible.value,
|
|
@@ -64,16 +64,42 @@ const IBizFormItemContainer = /* @__PURE__ */ defineComponent({
|
|
|
64
64
|
"placement": labelPos === "RIGHT" ? "right" : "left"
|
|
65
65
|
}, {
|
|
66
66
|
default: () => {
|
|
67
|
-
return createVNode("
|
|
68
|
-
"class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
|
|
69
|
-
}, [enableInputTip && ibiz.config.form.showTipsIcon && createVNode("ion-icon", {
|
|
67
|
+
return createVNode("ion-icon", {
|
|
70
68
|
"name": "bulb-outline",
|
|
71
69
|
"class": ns.em("label", "icon")
|
|
72
|
-
}, null)
|
|
70
|
+
}, null);
|
|
71
|
+
},
|
|
72
|
+
content: () => {
|
|
73
|
+
return createVNode("div", {
|
|
74
|
+
"class": ns.em("popper", "content")
|
|
75
|
+
}, [createVNode("div", {
|
|
76
|
+
"class": ns.em("popper", "tooltip")
|
|
77
|
+
}, [renderTipContent()]), c.state.inputTipUrl && createVNode("a", {
|
|
78
|
+
"target": "_blank",
|
|
79
|
+
"href": c.state.inputTipUrl,
|
|
80
|
+
"title": ibiz.i18n.t("component.formItemContainer.more")
|
|
81
|
+
}, [ibiz.i18n.t("component.formItemContainer.more")])]);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const renderLabelWithoutTips = () => {
|
|
86
|
+
return createVNode(resolveComponent("el-tooltip"), {
|
|
87
|
+
"effect": "light",
|
|
88
|
+
"visible": visible.value,
|
|
89
|
+
"onUpdate:visible": ($event) => visible.value = $event,
|
|
90
|
+
"popper-class": [ns.e("popper"), ns.is(ibiz.config.tooltiprendermode.toLowerCase(), true)],
|
|
91
|
+
"disabled": !enableInputTip,
|
|
92
|
+
"placement": labelPos === "RIGHT" ? "right" : "left"
|
|
93
|
+
}, {
|
|
94
|
+
default: () => {
|
|
95
|
+
return createVNode("div", {
|
|
96
|
+
"class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
|
|
97
|
+
}, [sysImage && createVNode(IBizIcon, {
|
|
73
98
|
"class": ns.em("label", "icon"),
|
|
74
99
|
"icon": sysImage
|
|
75
100
|
}, null), createVNode("div", {
|
|
76
|
-
"class": ns.em("label", "text")
|
|
101
|
+
"class": ns.em("label", "text"),
|
|
102
|
+
"title": enableInputTip ? void 0 : showTitle(c.labelCaption)
|
|
77
103
|
}, [c.labelCaption])]);
|
|
78
104
|
},
|
|
79
105
|
content: () => {
|
|
@@ -90,10 +116,18 @@ const IBizFormItemContainer = /* @__PURE__ */ defineComponent({
|
|
|
90
116
|
});
|
|
91
117
|
};
|
|
92
118
|
const renderLabel = () => {
|
|
119
|
+
const showTipsIcon = enableInputTip && ibiz.config.form.showTipsIcon;
|
|
93
120
|
return createVNode("div", {
|
|
94
|
-
"title": enableInputTip ? void 0 : showTitle(c.labelCaption),
|
|
95
121
|
"class": [ns.e("label"), ...c.labelClass || []]
|
|
96
|
-
}, [
|
|
122
|
+
}, [showTipsIcon && createVNode("div", {
|
|
123
|
+
"class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
|
|
124
|
+
}, [renderTipsIcon(), sysImage && createVNode(IBizIcon, {
|
|
125
|
+
"class": ns.em("label", "icon"),
|
|
126
|
+
"icon": sysImage
|
|
127
|
+
}, null), createVNode("div", {
|
|
128
|
+
"class": ns.em("label", "text"),
|
|
129
|
+
"title": showTitle(c.labelCaption)
|
|
130
|
+
}, [c.labelCaption])]), !showTipsIcon && renderLabelWithoutTips()]);
|
|
97
131
|
};
|
|
98
132
|
return {
|
|
99
133
|
ns,
|
|
@@ -41,6 +41,13 @@ class CodeEditorController extends EditorController {
|
|
|
41
41
|
* @memberof CodeEditorController
|
|
42
42
|
*/
|
|
43
43
|
__publicField(this, "currentSelection");
|
|
44
|
+
/**
|
|
45
|
+
* AI 聊天自填模式
|
|
46
|
+
*
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
* @memberof CodeEditorController
|
|
49
|
+
*/
|
|
50
|
+
__publicField(this, "chatCompletion", false);
|
|
44
51
|
}
|
|
45
52
|
/**
|
|
46
53
|
* 语言类型
|
|
@@ -76,6 +83,11 @@ class CodeEditorController extends EditorController {
|
|
|
76
83
|
appDataEntityId,
|
|
77
84
|
this.context.srfappid
|
|
78
85
|
);
|
|
86
|
+
if (this.deACMode) {
|
|
87
|
+
if (this.deACMode.actype === "CHATCOMPLETION") {
|
|
88
|
+
this.chatCompletion = true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
79
91
|
}
|
|
80
92
|
/**
|
|
81
93
|
* editor 创建完成
|
|
@@ -105,33 +117,38 @@ class CodeEditorController extends EditorController {
|
|
|
105
117
|
* @param {string} text 文本
|
|
106
118
|
*/
|
|
107
119
|
insertText(text) {
|
|
108
|
-
var _a, _b, _c, _d
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
var _a, _b, _c, _d;
|
|
121
|
+
if (!this.editor || !this.monaco) {
|
|
122
|
+
throw new RuntimeError(ibiz.i18n.t("editor.code.editorNotInit"));
|
|
123
|
+
}
|
|
124
|
+
const selections = this.editor.getSelections();
|
|
125
|
+
if (!selections || selections.length === 0)
|
|
111
126
|
return;
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
127
|
+
const activeSelection = selections[selections.length - 1];
|
|
128
|
+
const insertLine = activeSelection.positionLineNumber;
|
|
129
|
+
const insertColumn = activeSelection.positionColumn;
|
|
130
|
+
const formattedText = "\n".concat(text, "\n");
|
|
131
|
+
(_a = this.editor) == null ? void 0 : _a.executeEdits("", [
|
|
116
132
|
{
|
|
117
133
|
range: new this.monaco.Range(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
insertLine,
|
|
135
|
+
insertColumn,
|
|
136
|
+
insertLine,
|
|
137
|
+
insertColumn
|
|
138
|
+
// 光标位置纯插入,不替换任何内容
|
|
122
139
|
),
|
|
123
|
-
text
|
|
140
|
+
text: formattedText
|
|
124
141
|
}
|
|
125
142
|
]);
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
);
|
|
134
|
-
(
|
|
143
|
+
const linesInText = formattedText.split("\n");
|
|
144
|
+
const linesAdded = linesInText.length - 1;
|
|
145
|
+
const lastLineOfInsert = insertLine + linesAdded - 1;
|
|
146
|
+
const lastLineContent = linesInText[linesInText.length - 2] || "";
|
|
147
|
+
const newColumn = lastLineContent.length + 1;
|
|
148
|
+
const newPosition = new this.monaco.Position(lastLineOfInsert, newColumn);
|
|
149
|
+
(_b = this.editor) == null ? void 0 : _b.setPosition(newPosition);
|
|
150
|
+
(_c = this.editor) == null ? void 0 : _c.revealPositionInCenter(newPosition);
|
|
151
|
+
(_d = this.editor) == null ? void 0 : _d.focus();
|
|
135
152
|
}
|
|
136
153
|
/**
|
|
137
154
|
* 替换选中文本
|
|
@@ -179,11 +196,37 @@ class CodeEditorController extends EditorController {
|
|
|
179
196
|
var _a;
|
|
180
197
|
(_a = this.editor) == null ? void 0 : _a.focus();
|
|
181
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* 获取内联AI编辑器元素
|
|
201
|
+
*/
|
|
202
|
+
getInLineAiEditorElement() {
|
|
203
|
+
if (!this.editor) {
|
|
204
|
+
throw new RuntimeError(ibiz.i18n.t("editor.code.editorNotInit"));
|
|
205
|
+
}
|
|
206
|
+
return this.editor.getDomNode();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* 获取内联AI编辑器主题
|
|
210
|
+
*/
|
|
211
|
+
getInLineAiEditorTheme() {
|
|
212
|
+
var _a, _b, _c;
|
|
213
|
+
const currentTheme = (_c = (_b = (_a = this.editor) == null ? void 0 : _a._themeService) == null ? void 0 : _b._theme) == null ? void 0 : _c.themeName;
|
|
214
|
+
switch (currentTheme) {
|
|
215
|
+
case "vs-dark":
|
|
216
|
+
return "dark";
|
|
217
|
+
case "vs":
|
|
218
|
+
default:
|
|
219
|
+
return "light";
|
|
220
|
+
}
|
|
221
|
+
}
|
|
182
222
|
/**
|
|
183
223
|
* 获取内联AI聊天参数
|
|
184
224
|
*/
|
|
185
225
|
getInLineAiChatOptions() {
|
|
186
226
|
var _a, _b, _c, _d, _e, _f;
|
|
227
|
+
if (!this.editor || !this.monaco) {
|
|
228
|
+
throw new RuntimeError(ibiz.i18n.t("editor.code.editorNotInit"));
|
|
229
|
+
}
|
|
187
230
|
const contentArea = (_b = (_a = this.editor) == null ? void 0 : _a.getDomNode()) == null ? void 0 : _b.querySelector(".editor-scrollable");
|
|
188
231
|
if (!contentArea) {
|
|
189
232
|
throw new RuntimeError(ibiz.i18n.t("editor.code.noEditorArea"));
|
|
@@ -201,12 +244,16 @@ class CodeEditorController extends EditorController {
|
|
|
201
244
|
throw new RuntimeError(ibiz.i18n.t("editor.code.noSelCoords"));
|
|
202
245
|
}
|
|
203
246
|
const rect = contentArea.getBoundingClientRect();
|
|
247
|
+
const layoutInfo = this.editor.getLayoutInfo();
|
|
204
248
|
return {
|
|
249
|
+
// 编辑器编辑区左侧距离
|
|
205
250
|
left: rect.left,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
251
|
+
// 编辑器上方距离 + 选区距离编辑器上方距离 + 行高度
|
|
252
|
+
top: editorRect.top + coordinates.top + coordinates.height,
|
|
253
|
+
// 编辑器编辑区宽度 - 代码预览区宽度 - 代码预览区标尺宽度
|
|
254
|
+
width: rect.width - layoutInfo.minimap.minimapWidth - layoutInfo.overviewRuler.width,
|
|
255
|
+
editorElement: this.getInLineAiEditorElement(),
|
|
256
|
+
editorTheme: this.getInLineAiEditorTheme()
|
|
210
257
|
};
|
|
211
258
|
}
|
|
212
259
|
/**
|
|
@@ -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{
|
|
1
|
+
.ibiz-code{--ibiz-code-color-text-editor-toolbar-bg:var(--ibiz-color-bg-2);--ibiz-code-color-text-editor-toolbar-text:var(--ibiz-color-text-0);--ibiz-code-color-text-editor-toolbar-item-bg-hover:var(--ibiz-color-primary-light-default);--ibiz-code-color-text-editor-toolbar-item-text-hover:var(--ibiz-color-primary);--ibiz-code-height-text-editor-toolbar:40px;--ibiz-code-footer-toolbar-height:36px;--ibiz-code-footer-button-height:36px;--ibiz-code-spacing-code-text-editor-toolbar-padding:var(--ibiz-spacing-extra-tight);--ibiz-code-spacing-code-text-editor-toolbar-item-padding:var(--ibiz-spacing-extra-tight) var(--ibiz-spacing-tight);--ibiz-code-spacing-code-text-editor-toolbar-circle:var(--ibiz-border-radius-extra-small);--ibiz-code-spacing-code-text-editor-toolbar-item-circle:var(--ibiz-border-radius-extra-small);--ibiz-code-text-editor-toolbar-z-index:1;--ibiz-code-text-editor-toolbar-left:0;--ibiz-code-text-editor-toolbar-top:0;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{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__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{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-code-spacing-code-text-editor-toolbar-padding);font-size:var(--ibiz-font-size-regular);color:var(--ibiz-code-color-text-editor-toolbar-text);background-color:var(--ibiz-code-color-text-editor-toolbar-bg);border-radius:var(--ibiz-code-spacing-code-text-editor-toolbar-circle);box-shadow:var(--ibiz-shadow-elevated)}.ibiz-code-text-editor-toolbar__item{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-code-spacing-code-text-editor-toolbar-item-padding);cursor:pointer;border-radius:var(--ibiz-code-spacing-code-text-editor-toolbar-item-circle)}.ibiz-code-text-editor-toolbar__item:hover{color:var(--ibiz-code-color-text-editor-toolbar-item-text-hover);background-color:var(--ibiz-code-color-text-editor-toolbar-item-bg-hover)}.ibiz-code.is-dark{--ibiz-code-color-text-editor-toolbar-bg:rgb(53, 54, 60);--ibiz-code-color-text-editor-toolbar-text:rgb(249, 249, 249);--ibiz-code-color-text-editor-toolbar-item-bg-hover:rgba(255, 255, 255, 0.12);--ibiz-code-color-text-editor-toolbar-item-text-hover:rgb(249, 249, 249)}
|
|
@@ -39,6 +39,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
39
39
|
[ns.cssVarBlockName("text-editor-toolbar-z-index")]: zIndex.increment()
|
|
40
40
|
});
|
|
41
41
|
const textTBVisible = ref(false);
|
|
42
|
+
const editorTheme = ref("");
|
|
42
43
|
const editorModel = c.model;
|
|
43
44
|
if (editorModel.editorParams) {
|
|
44
45
|
if (editorModel.editorParams.enableEdit) {
|
|
@@ -72,8 +73,9 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
72
73
|
let decorationsCollection;
|
|
73
74
|
let chatInstance;
|
|
74
75
|
const getMonacoTheme = (name) => {
|
|
75
|
-
var _a;
|
|
76
|
-
|
|
76
|
+
var _a, _b;
|
|
77
|
+
editorTheme.value = ((_a = c == null ? void 0 : c.editorParams) == null ? void 0 : _a.customTheme) || ibiz.config.codeEditorTheme || name;
|
|
78
|
+
const customTheme = (_b = c == null ? void 0 : c.editorParams) == null ? void 0 : _b.customTheme;
|
|
77
79
|
if (customTheme) {
|
|
78
80
|
return customTheme === "dark" ? "vs-dark" : "vs";
|
|
79
81
|
}
|
|
@@ -340,13 +342,15 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
340
342
|
return;
|
|
341
343
|
textTBStyle.value = {
|
|
342
344
|
...textTBStyle.value,
|
|
345
|
+
// 编辑器左侧距离 + 选区距离编辑器左侧距离
|
|
343
346
|
[ns.cssVarBlockName("text-editor-toolbar-left")]: "".concat(editorRect.left + coordinates.left, "px"),
|
|
344
|
-
|
|
347
|
+
// 编辑器上方距离 + 选区距离编辑器上方距离 + 行高度
|
|
348
|
+
[ns.cssVarBlockName("text-editor-toolbar-top")]: "".concat(editorRect.top + coordinates.top + coordinates.height, "px")
|
|
345
349
|
};
|
|
346
350
|
}
|
|
347
351
|
};
|
|
348
352
|
const setTextTBVisible = () => {
|
|
349
|
-
if (props.readonly || !enableEdit.value || !c.deACMode)
|
|
353
|
+
if (props.readonly || !enableEdit.value || !c.deACMode || !c.chatCompletion)
|
|
350
354
|
return;
|
|
351
355
|
const selection = editor == null ? void 0 : editor.getSelection();
|
|
352
356
|
textTBVisible.value = !!(selection && !selection.isEmpty());
|
|
@@ -365,14 +369,21 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
365
369
|
return;
|
|
366
370
|
const coordinates = editor == null ? void 0 : editor.getScrolledVisiblePosition(position);
|
|
367
371
|
const editorRect = (_b = editor == null ? void 0 : editor.getDomNode()) == null ? void 0 : _b.getBoundingClientRect();
|
|
368
|
-
|
|
372
|
+
const textTBHeight = textTBRef.value.offsetHeight;
|
|
373
|
+
if (!coordinates || !editorRect || !textTBHeight)
|
|
369
374
|
return;
|
|
370
375
|
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
371
376
|
c.doInLineAIUIAction(tag, c.model.appId);
|
|
372
377
|
});
|
|
373
378
|
if (items.length === 0)
|
|
374
379
|
return;
|
|
375
|
-
ibiz.inLineAIUtil.showContextMenus(
|
|
380
|
+
ibiz.inLineAIUtil.showContextMenus(
|
|
381
|
+
// 编辑器左侧距离 + 选区距离编辑器左侧距离
|
|
382
|
+
editorRect.left + coordinates.left,
|
|
383
|
+
// 编辑器上方距离 + 选区距离编辑器上方距离 + 行高度 + 工具栏高度
|
|
384
|
+
editorRect.top + coordinates.top + coordinates.height + textTBHeight,
|
|
385
|
+
items
|
|
386
|
+
);
|
|
376
387
|
};
|
|
377
388
|
const handleEditorClick = (e) => {
|
|
378
389
|
var _a;
|
|
@@ -649,6 +660,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
649
660
|
readonlyState,
|
|
650
661
|
isLoading,
|
|
651
662
|
textTBRef,
|
|
663
|
+
editorTheme,
|
|
652
664
|
renderFooter,
|
|
653
665
|
renderHeaderToolbar,
|
|
654
666
|
renderTextEditorToolbar,
|
|
@@ -660,7 +672,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
660
672
|
var _a, _b;
|
|
661
673
|
const isLoading = !((_b = (_a = this.controller.view) == null ? void 0 : _a.state) == null ? void 0 : _b.isLoading) && this.isLoading;
|
|
662
674
|
return !this.isFullScreen ? withDirectives(createVNode("div", {
|
|
663
|
-
"class": [this.ns.b(), {
|
|
675
|
+
"class": [this.ns.b(), this.ns.is(this.editorTheme, !!this.editorTheme), {
|
|
664
676
|
[this.ns.b("editor-readonly")]: this.readonlyState
|
|
665
677
|
}, {
|
|
666
678
|
[this.ns.b("editor-enable")]: !this.readonlyState
|
|
@@ -672,7 +684,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
672
684
|
"onClose": () => this.changeFullScreenState()
|
|
673
685
|
}, {
|
|
674
686
|
default: () => [withDirectives(createVNode("div", {
|
|
675
|
-
"class": [this.ns.b(), {
|
|
687
|
+
"class": [this.ns.b(), this.ns.is(this.editorTheme, !!this.editorTheme), {
|
|
676
688
|
[this.ns.b("editor-readonly")]: this.readonlyState
|
|
677
689
|
}, {
|
|
678
690
|
[this.ns.b("editor-enable")]: !this.readonlyState
|
|
@@ -298,7 +298,24 @@ class HtmlEditorController extends EditorController {
|
|
|
298
298
|
*/
|
|
299
299
|
insertText(text) {
|
|
300
300
|
if (this.wangEditor) {
|
|
301
|
-
|
|
301
|
+
const newParagraph = {
|
|
302
|
+
type: "paragraph",
|
|
303
|
+
children: [{ text }]
|
|
304
|
+
};
|
|
305
|
+
const selection = this.wangEditor.selection;
|
|
306
|
+
if (selection) {
|
|
307
|
+
const collapsedSelection = {
|
|
308
|
+
anchor: selection.anchor,
|
|
309
|
+
focus: selection.anchor
|
|
310
|
+
};
|
|
311
|
+
if (selection.anchor.path !== selection.focus.path || selection.anchor.offset !== selection.focus.offset) {
|
|
312
|
+
collapsedSelection.anchor = selection.focus;
|
|
313
|
+
collapsedSelection.focus = selection.focus;
|
|
314
|
+
}
|
|
315
|
+
this.wangEditor.select(collapsedSelection);
|
|
316
|
+
}
|
|
317
|
+
this.wangEditor.insertNode(newParagraph);
|
|
318
|
+
this.wangEditor.move(1);
|
|
302
319
|
}
|
|
303
320
|
}
|
|
304
321
|
/**
|
|
@@ -307,8 +324,12 @@ class HtmlEditorController extends EditorController {
|
|
|
307
324
|
*/
|
|
308
325
|
replaceSelectionText(text) {
|
|
309
326
|
if (this.wangEditor) {
|
|
310
|
-
this.wangEditor.
|
|
311
|
-
|
|
327
|
+
if (this.wangEditor.selection) {
|
|
328
|
+
this.wangEditor.deleteFragment();
|
|
329
|
+
this.wangEditor.insertText(text);
|
|
330
|
+
} else {
|
|
331
|
+
this.wangEditor.insertText(text);
|
|
332
|
+
}
|
|
312
333
|
}
|
|
313
334
|
}
|
|
314
335
|
/**
|
|
@@ -319,6 +340,25 @@ class HtmlEditorController extends EditorController {
|
|
|
319
340
|
this.wangEditor.restoreSelection();
|
|
320
341
|
}
|
|
321
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* 获取内联AI编辑器元素
|
|
345
|
+
*/
|
|
346
|
+
getInLineAiEditorElement() {
|
|
347
|
+
if (!this.wangEditor) {
|
|
348
|
+
throw new RuntimeError("\u7F16\u8F91\u5668\u672A\u521D\u59CB\u5316");
|
|
349
|
+
}
|
|
350
|
+
return this.wangEditor.getEditableContainer();
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* 获取内联AI编辑器主题
|
|
354
|
+
*/
|
|
355
|
+
getInLineAiEditorTheme() {
|
|
356
|
+
const appTheme = ibiz.util.theme.getTheme();
|
|
357
|
+
if (appTheme.indexOf("dark") !== -1) {
|
|
358
|
+
return "dark";
|
|
359
|
+
}
|
|
360
|
+
return "light";
|
|
361
|
+
}
|
|
322
362
|
/**
|
|
323
363
|
* 获取内联AI参数
|
|
324
364
|
*/
|
|
@@ -331,9 +371,14 @@ class HtmlEditorController extends EditorController {
|
|
|
331
371
|
throw new RuntimeError("\u83B7\u53D6\u9009\u533A\u4F4D\u7F6E\u5931\u8D25");
|
|
332
372
|
const editorBoundingClientRect = this.wangEditor.getEditableContainer().getBoundingClientRect();
|
|
333
373
|
return {
|
|
374
|
+
// 编辑器的左侧距离 + 默认padding
|
|
334
375
|
left: editorBoundingClientRect.x + 10,
|
|
376
|
+
// 编辑器的上方距离+选区距离编辑器上方距离
|
|
335
377
|
top: editorBoundingClientRect.y + Number(selectionPosition.top.replace("px", "")),
|
|
336
|
-
|
|
378
|
+
// 编辑器的宽度 - 左右padding
|
|
379
|
+
width: editorBoundingClientRect.width - 20,
|
|
380
|
+
editorElement: this.getInLineAiEditorElement(),
|
|
381
|
+
editorTheme: this.getInLineAiEditorTheme()
|
|
337
382
|
};
|
|
338
383
|
}
|
|
339
384
|
/**
|
|
@@ -429,7 +429,13 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
|
|
|
429
429
|
if (items.length === 0)
|
|
430
430
|
return;
|
|
431
431
|
const editorBoundingClientRect = editor.getEditableContainer().getBoundingClientRect();
|
|
432
|
-
ibiz.inLineAIUtil.showContextMenus(
|
|
432
|
+
ibiz.inLineAIUtil.showContextMenus(
|
|
433
|
+
// 编辑器的左侧距离+选区距离编辑器左侧距离
|
|
434
|
+
editorBoundingClientRect.x + Number(selectionPosition.left.replace("px", "")),
|
|
435
|
+
// 编辑器的上方距离+选区距离编辑器上方距离+悬浮工具栏高度
|
|
436
|
+
editorBoundingClientRect.y + Number(selectionPosition.top.replace("px", "")) + 42,
|
|
437
|
+
items
|
|
438
|
+
);
|
|
433
439
|
});
|
|
434
440
|
};
|
|
435
441
|
const handleChange = (editor) => {
|
|
@@ -9,15 +9,11 @@ function initCustomMenu(c) {
|
|
|
9
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
10
|
},
|
|
11
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
12
|
event.stopPropagation();
|
|
17
13
|
event.preventDefault();
|
|
18
14
|
nextTick(() => {
|
|
19
|
-
var
|
|
20
|
-
if ((
|
|
15
|
+
var _a;
|
|
16
|
+
if ((_a = c.mdeditor) == null ? void 0 : _a.bubble) {
|
|
21
17
|
c.mdeditor.bubble.visible = true;
|
|
22
18
|
const selectionPosition = c.mdeditor.bubble.bubbleDom.getBoundingClientRect();
|
|
23
19
|
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
@@ -31,8 +27,10 @@ function initCustomMenu(c) {
|
|
|
31
27
|
if (items.length === 0)
|
|
32
28
|
return;
|
|
33
29
|
ibiz.inLineAIUtil.showContextMenus(
|
|
30
|
+
// 浮动工具栏的左侧距离
|
|
34
31
|
selectionPosition.left,
|
|
35
|
-
|
|
32
|
+
// 浮动工具栏的顶部距离 + 浮动工具栏的高度
|
|
33
|
+
selectionPosition.top + 43,
|
|
36
34
|
items
|
|
37
35
|
);
|
|
38
36
|
}
|
|
@@ -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)}.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-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}
|
|
@@ -211,12 +211,37 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
211
211
|
const handleKeyDown = (_e) => {
|
|
212
212
|
_e.stopPropagation();
|
|
213
213
|
if (_e.key === "Escape") {
|
|
214
|
+
_e.preventDefault();
|
|
214
215
|
if (isFullscreen()) {
|
|
215
216
|
closeFullscreen();
|
|
216
217
|
isFullScreen.value = false;
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
};
|
|
221
|
+
const changeMainTheme = (_theme) => {
|
|
222
|
+
c == null ? void 0 : c.setCurrentEditorTheme(_theme);
|
|
223
|
+
};
|
|
224
|
+
const selectionChange = (event) => {
|
|
225
|
+
var _a2, _b2;
|
|
226
|
+
const {
|
|
227
|
+
info
|
|
228
|
+
} = event;
|
|
229
|
+
let isForwardSelection = true;
|
|
230
|
+
const firstRange = info.ranges && info.ranges[0];
|
|
231
|
+
if (!firstRange) {
|
|
232
|
+
isForwardSelection = true;
|
|
233
|
+
} else {
|
|
234
|
+
const {
|
|
235
|
+
anchor,
|
|
236
|
+
head
|
|
237
|
+
} = firstRange;
|
|
238
|
+
isForwardSelection = c.isPositionBefore(anchor, head);
|
|
239
|
+
}
|
|
240
|
+
const startPos = (_a2 = c.mdeditor) == null ? void 0 : _a2.editor.editor.getCursor("start");
|
|
241
|
+
const endPos = (_b2 = c.mdeditor) == null ? void 0 : _b2.editor.editor.getCursor("end");
|
|
242
|
+
c.setCursorPos(startPos, endPos);
|
|
243
|
+
c.setSelectionDirection(isForwardSelection);
|
|
244
|
+
};
|
|
220
245
|
const editorInit = () => {
|
|
221
246
|
if (props.disabled || props.readonly || showmode === "manual") {
|
|
222
247
|
defaultModel.value = "previewOnly";
|
|
@@ -224,7 +249,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
224
249
|
nextTick(() => {
|
|
225
250
|
var _a2;
|
|
226
251
|
const bubble = ["bold", "italic", "underline", "strikethrough", "sub", "sup", "|", "size", "color"];
|
|
227
|
-
if (c
|
|
252
|
+
if (c && c.chatCompletion) {
|
|
228
253
|
bubble.unshift("AI");
|
|
229
254
|
}
|
|
230
255
|
editor = new Cherry({
|
|
@@ -290,6 +315,10 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
290
315
|
afterChange,
|
|
291
316
|
beforeImageMounted
|
|
292
317
|
},
|
|
318
|
+
event: {
|
|
319
|
+
changeMainTheme,
|
|
320
|
+
selectionChange
|
|
321
|
+
},
|
|
293
322
|
engine: {
|
|
294
323
|
syntax: {
|
|
295
324
|
table: {
|
|
@@ -310,7 +339,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
310
339
|
span.appendChild(createCherryIcon("fullscreen"));
|
|
311
340
|
const parentElement = props.disabled ? editor.editor.options.editorDom.parentElement : (_a2 = editor.editor.options.editorDom.parentElement) == null ? void 0 : _a2.querySelector(".cherry-toolbar>.toolbar-right");
|
|
312
341
|
parentElement == null ? void 0 : parentElement.appendChild(span);
|
|
313
|
-
c.setMDEditor(editor);
|
|
342
|
+
c == null ? void 0 : c.setMDEditor(editor);
|
|
314
343
|
});
|
|
315
344
|
};
|
|
316
345
|
watch(() => UIStore.theme, (newVal) => {
|
|
@@ -366,9 +395,14 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
366
395
|
isIgnoreChange = false;
|
|
367
396
|
onResetEditState();
|
|
368
397
|
};
|
|
398
|
+
const onFocusEditor = () => {
|
|
399
|
+
const target = document.getElementById(id);
|
|
400
|
+
target == null ? void 0 : target.focus();
|
|
401
|
+
};
|
|
369
402
|
const renderHeader = () => {
|
|
370
403
|
if (showmode === "manual" && !isEditing.value) {
|
|
371
404
|
return createVNode("div", {
|
|
405
|
+
"onClick": onFocusEditor,
|
|
372
406
|
"class": [ns.e("header"), ns.is("fullscreen", isFullScreen.value)]
|
|
373
407
|
}, [!props.disabled && !props.readonly && createVNode("div", {
|
|
374
408
|
"class": ns.em("header", "edit"),
|
|
@@ -394,6 +428,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
394
428
|
const renderFooter = () => {
|
|
395
429
|
if (showmode === "manual" && isEditing.value && !props.disabled && !props.readonly) {
|
|
396
430
|
return createVNode("div", {
|
|
431
|
+
"onClick": onFocusEditor,
|
|
397
432
|
"class": [ns.e("footer"), ns.is("fullscreen", isFullScreen.value)]
|
|
398
433
|
}, [createVNode("div", {
|
|
399
434
|
"class": ns.em("footer", "cancel"),
|
|
@@ -405,12 +440,14 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
405
440
|
}
|
|
406
441
|
};
|
|
407
442
|
onMounted(() => {
|
|
443
|
+
var _a2;
|
|
408
444
|
editorInit();
|
|
409
445
|
calcMarkDownStyle();
|
|
410
|
-
|
|
446
|
+
(_a2 = markDownBox.value) == null ? void 0 : _a2.addEventListener("keydown", handleKeyDown.bind(this));
|
|
411
447
|
});
|
|
412
448
|
onBeforeUnmount(() => {
|
|
413
|
-
|
|
449
|
+
var _a2;
|
|
450
|
+
(_a2 = markDownBox.value) == null ? void 0 : _a2.removeEventListener("keydown", handleKeyDown.bind(this));
|
|
414
451
|
});
|
|
415
452
|
onUnmounted(() => {
|
|
416
453
|
editor = null;
|
|
@@ -442,6 +479,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
|
|
|
442
479
|
"ref": "markDownBox",
|
|
443
480
|
"class": [this.ns.b(), this.ns.is("disabled", this.disabled), this.ns.is("manual", this.showmode === "manual"), this.ns.is("editing", this.isEditing)]
|
|
444
481
|
}, [this.renderHeader(), this.renderFooter(), createVNode("div", {
|
|
482
|
+
"tabindex": "-1",
|
|
445
483
|
"id": this.id,
|
|
446
484
|
"style": this.cssVars,
|
|
447
485
|
"class": this.ns.b("cherry")
|