@ibiz-template/vue3-components 0.7.41-alpha.37 → 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-BiFsbM1Y.js → index-BewO9StC.js} +1 -1
- package/dist/{index-BFGNWF-0.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-BYeoazrn.js +1 -0
- package/dist/{xlsx-util-DZ5-cWNj.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/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.mjs +10 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.mjs +309 -0
- package/es/editor/code/code-editor.controller.mjs +223 -1
- package/es/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/es/editor/code/monaco-editor/monaco-editor.mjs +132 -10
- package/es/editor/html/html-editor.controller.mjs +122 -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 +41 -4
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +43 -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 +143 -9
- package/es/editor/markdown/markdown-editor.controller.mjs +218 -1
- package/es/index.mjs +1 -0
- package/es/locale/en/index.mjs +18 -2
- package/es/locale/zh-CN/index.mjs +18 -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 +217 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +220 -0
- package/es/util/inline-ai-util/inline-ai-util.mjs +145 -0
- package/es/web-app/main.mjs +2 -0
- package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.cjs +42 -8
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs +10 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.cjs +311 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/lib/editor/code/code-editor.controller.cjs +222 -0
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +132 -10
- package/lib/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/lib/editor/html/html-editor.controller.cjs +120 -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 +41 -4
- package/lib/editor/html/wang-editor/wang-editor.css +1 -1
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +45 -0
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +143 -9
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/markdown/markdown-editor.controller.cjs +217 -0
- package/lib/index.cjs +2 -0
- package/lib/locale/en/index.cjs +18 -2
- package/lib/locale/zh-CN/index.cjs +18 -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 +222 -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 +222 -0
- package/lib/util/inline-ai-util/inline-ai-util.cjs +147 -0
- package/lib/web-app/main.cjs +2 -0
- package/package.json +5 -5
- package/dist/ibiz-markdown-editor-Cs1m7gKI.js +0 -1
- package/dist/index-Dds3BDDF.js +0 -11
- package/dist/wang-editor-4cJ6X_hb.js +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => {
|
|
7
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
+
return value;
|
|
9
|
+
};
|
|
10
|
+
class InLineAIButton {
|
|
11
|
+
constructor() {
|
|
12
|
+
__publicField(this, "title");
|
|
13
|
+
__publicField(this, "tag");
|
|
14
|
+
__publicField(this, "iconSvg");
|
|
15
|
+
this.title = "AI";
|
|
16
|
+
this.tag = "button";
|
|
17
|
+
this.iconSvg = '<svg t="1763370094787" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="14" height="14" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M274.344554 173.673875c16.429399 0 30.950568 8.00526 39.956484 20.338945a34.906655 34.906655 0 0 1 14.660796 15.754537l1.117013 2.815803 210.138065 597.927736c6.795162 19.268474-5.329083 40.817516-27.041022 48.147913-20.641469 6.95806-42.493035-1.419537-50.451753-18.803052l-1.117013-2.815803-54.477653-154.939008H134.997185L80.566074 837.039954c-6.771891 19.268474-29.856826 28.949253-51.568765 21.618855-20.641469-6.981331-32.602816-26.761769-27.925325-45.239025l0.861031-2.908888L212.047809 212.58316c4.025901-11.426112 13.799764-19.477914 25.598214-22.619512 9.029188-10.006575 22.107548-16.289773 36.67526-16.289773z m386.416675 169.460176c21.828295 0 39.723774 10.890876 41.469106 24.713912l0.116356 2.210755v461.652153c0 14.893506-18.616883 26.947938-41.585462 26.947938-21.805024 0-39.700503-10.890876-41.422565-24.737183l-0.162897-2.210755V370.081989c0-14.870235 18.616883-26.924667 41.585462-26.924667z m-389.697901-48.171184L163.620643 600.628812h214.88537l-107.442685-305.665945z m602.163076-206.181978a12.566396 12.566396 0 0 1 8.144887 8.051802l32.509731 99.041817 101.694723 36.07021a12.566396 12.566396 0 0 1-0.791218 23.922695l-99.53051 27.995137-30.857483 97.552467a12.566396 12.566396 0 0 1-23.899423 0.116355l-32.509732-99.018546-98.669479-31.322905a12.566396 12.566396 0 0 1-0.186169-23.876152l97.505924-32.812256 30.834212-97.529195a12.566396 12.566396 0 0 1 15.754537-8.191429zM649.544557 0.513593c2.676177 0.884302 4.770576 3.025243 5.608336 5.724692l18.523798 59.294772 60.970292 20.66474a8.796477 8.796477 0 0 1-0.325796 16.755194l-60.73758 18.058377-19.780438 59.550754a8.796477 8.796477 0 0 1-16.731924-0.162898l-18.523798-59.271501-59.062061-17.825665a8.796477 8.796477 0 0 1-0.395609-16.708653l59.574025-20.943993 19.780438-59.574025a8.796477 8.796477 0 0 1 11.100317-5.561794z" fill="black"></path></svg>';
|
|
18
|
+
}
|
|
19
|
+
// 获取选中文本
|
|
20
|
+
getValue(editor) {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
// 判断按钮是否激活
|
|
24
|
+
isActive(editor) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// 判断按钮是否可用
|
|
28
|
+
isDisabled(editor) {
|
|
29
|
+
return editor.getConfig().readOnly;
|
|
30
|
+
}
|
|
31
|
+
// 点击按钮的执行逻辑
|
|
32
|
+
exec(editor, value) {
|
|
33
|
+
if (this.isDisabled(editor))
|
|
34
|
+
return;
|
|
35
|
+
editor.emit("lineAiClick");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const InLineAIMenu = {
|
|
39
|
+
key: "inline-ai",
|
|
40
|
+
factory() {
|
|
41
|
+
return new InLineAIButton();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const hoverbarKeysEx = {
|
|
45
|
+
link: {
|
|
46
|
+
menuKeys: ["inline-ai", "editLink", "unLink", "viewLink"]
|
|
47
|
+
},
|
|
48
|
+
image: {
|
|
49
|
+
menuKeys: [
|
|
50
|
+
"inline-ai",
|
|
51
|
+
"imageWidth30",
|
|
52
|
+
"imageWidth50",
|
|
53
|
+
"imageWidth100",
|
|
54
|
+
"editImage",
|
|
55
|
+
"viewImageLink",
|
|
56
|
+
"deleteImage"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
pre: {
|
|
60
|
+
menuKeys: ["inline-ai", "enter", "codeBlock", "codeSelectLang"]
|
|
61
|
+
},
|
|
62
|
+
table: {
|
|
63
|
+
menuKeys: [
|
|
64
|
+
"inline-ai",
|
|
65
|
+
"enter",
|
|
66
|
+
"tableHeader",
|
|
67
|
+
"tableFullWidth",
|
|
68
|
+
"insertTableRow",
|
|
69
|
+
"deleteTableRow",
|
|
70
|
+
"insertTableCol",
|
|
71
|
+
"deleteTableCol",
|
|
72
|
+
"deleteTable"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
divider: {
|
|
76
|
+
menuKeys: ["inline-ai", "enter"]
|
|
77
|
+
},
|
|
78
|
+
video: {
|
|
79
|
+
menuKeys: ["inline-ai", "enter", "editVideoSize"]
|
|
80
|
+
},
|
|
81
|
+
text: {
|
|
82
|
+
menuKeys: [
|
|
83
|
+
"inline-ai",
|
|
84
|
+
"headerSelect",
|
|
85
|
+
"insertLink",
|
|
86
|
+
"bulletedList",
|
|
87
|
+
"|",
|
|
88
|
+
"bold",
|
|
89
|
+
"through",
|
|
90
|
+
"color",
|
|
91
|
+
"bgColor",
|
|
92
|
+
"clearStyle"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
exports.InLineAIMenu = InLineAIMenu;
|
|
98
|
+
exports.hoverbarKeysEx = hoverbarKeysEx;
|
|
@@ -11,7 +11,9 @@ var core = require('@ibiz-template/core');
|
|
|
11
11
|
var runtime = require('@ibiz-template/runtime');
|
|
12
12
|
var ElementPlus = require('element-plus');
|
|
13
13
|
require('../../../util/index.cjs');
|
|
14
|
+
require('./module/index.cjs');
|
|
14
15
|
require('./wang-editor.css');
|
|
16
|
+
var inlineAiModule = require('./module/inline-ai-module.cjs');
|
|
15
17
|
var aiUtil = require('../../../util/ai-util/ai-util.cjs');
|
|
16
18
|
|
|
17
19
|
"use strict";
|
|
@@ -41,6 +43,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
41
43
|
const readonlyState = vue.ref(false);
|
|
42
44
|
const enableFullScreen = vue.ref(false);
|
|
43
45
|
const isFullScreen = vue.ref(false);
|
|
46
|
+
let autoClose;
|
|
44
47
|
const editorModel = c.model;
|
|
45
48
|
if (editorModel.editorParams) {
|
|
46
49
|
if (editorModel.editorParams.enableEdit) {
|
|
@@ -59,6 +62,13 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
59
62
|
if (editorModel.editorParams.enablefullscreen) {
|
|
60
63
|
enableFullScreen.value = c.toBoolean(editorModel.editorParams.enablefullscreen);
|
|
61
64
|
}
|
|
65
|
+
if (editorModel.editorParams.autoclose) {
|
|
66
|
+
try {
|
|
67
|
+
autoClose = JSON.parse(editorModel.editorParams.autoclose);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
ibiz.log.error(error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
62
72
|
}
|
|
63
73
|
if (props.readonly) {
|
|
64
74
|
hasEnableEdit.value = false;
|
|
@@ -184,7 +194,8 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
184
194
|
parseLinkUrl: customParseLinkUrl
|
|
185
195
|
// 也支持 async 函数
|
|
186
196
|
}
|
|
187
|
-
}
|
|
197
|
+
},
|
|
198
|
+
hoverbarKeys: inlineAiModule.hoverbarKeysEx
|
|
188
199
|
};
|
|
189
200
|
vue.onBeforeUnmount(() => {
|
|
190
201
|
const editor = editorRef.value;
|
|
@@ -231,6 +242,14 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
231
242
|
otherToolbarItems,
|
|
232
243
|
// 编辑器参数srfaiappendcurdata,是否传入对象参数,用于历史查询传参
|
|
233
244
|
appendCurData: c.editorParams.srfaiappendcurdata === "true" ? props.data : void 0,
|
|
245
|
+
// 自动提问
|
|
246
|
+
autoQuestion: c.editorParams.autoquestion !== "false",
|
|
247
|
+
// 自动填充
|
|
248
|
+
autoFill: c.editorParams.autofill === "true",
|
|
249
|
+
// 窗口的打开模式
|
|
250
|
+
openMode: c.editorParams.openmode,
|
|
251
|
+
// 窗口的自动关闭模式
|
|
252
|
+
autoClose,
|
|
234
253
|
// 编辑器参数srfaiappendcurcontent,传入编辑内容作为用户消息,获取历史数据后附加
|
|
235
254
|
appendCurContent: c.editorParams.srfaiappendcurcontent ? core.StringUtil.fill(c.editorParams.srfaiappendcurcontent, c.context, c.params, props.data) : void 0,
|
|
236
255
|
question: async (aiChat, ctx, param, other, arr, sessionid) => {
|
|
@@ -404,6 +423,24 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
404
423
|
editor.on("aiClick", () => {
|
|
405
424
|
onClickAI();
|
|
406
425
|
});
|
|
426
|
+
editor.on("lineAiClick", () => {
|
|
427
|
+
const selectionPosition = editor.getSelectionPosition();
|
|
428
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
429
|
+
return;
|
|
430
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
431
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
432
|
+
});
|
|
433
|
+
if (items.length === 0)
|
|
434
|
+
return;
|
|
435
|
+
const editorBoundingClientRect = editor.getEditableContainer().getBoundingClientRect();
|
|
436
|
+
ibiz.inLineAIUtil.showContextMenus(
|
|
437
|
+
// 编辑器的左侧距离+选区距离编辑器左侧距离
|
|
438
|
+
editorBoundingClientRect.x + Number(selectionPosition.left.replace("px", "")),
|
|
439
|
+
// 编辑器的上方距离+选区距离编辑器上方距离+悬浮工具栏高度
|
|
440
|
+
editorBoundingClientRect.y + Number(selectionPosition.top.replace("px", "")) + 42,
|
|
441
|
+
items
|
|
442
|
+
);
|
|
443
|
+
});
|
|
407
444
|
};
|
|
408
445
|
const handleChange = (editor) => {
|
|
409
446
|
const html = editor.getHtml();
|
|
@@ -619,7 +656,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
619
656
|
};
|
|
620
657
|
const renderEditorContent = () => {
|
|
621
658
|
return vue.createVNode("div", {
|
|
622
|
-
"class": ns.b("content"),
|
|
659
|
+
"class": [ns.b("content"), ns.is("editing", !readonlyState.value)],
|
|
623
660
|
"ref": "htmlContent",
|
|
624
661
|
"style": cssVars.value
|
|
625
662
|
}, [vue.createVNode(editorForVue.Toolbar, {
|
|
@@ -689,13 +726,13 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
689
726
|
return !this.isFullScreen ? vue.createVNode("div", {
|
|
690
727
|
"class": [this.ns.b(), {
|
|
691
728
|
[this.ns.b("editor-readonly")]: this.readonlyState
|
|
692
|
-
}, this.ns.is("show-ai", true)]
|
|
729
|
+
}, this.ns.is("show-ai", true), this.ns.is("enable-edit", !this.readonly && !this.disabled)]
|
|
693
730
|
}, [this.renderHeaserToolbar(), this.renderEditorContent(), this.hasEnableEdit && !this.readonlyState ? this.renderFooter() : null]) : vue.createVNode(vue.resolveComponent("el-dialog"), {
|
|
694
731
|
"modelValue": this.isFullScreen,
|
|
695
732
|
"onUpdate:modelValue": ($event) => this.isFullScreen = $event,
|
|
696
733
|
"width": "80%",
|
|
697
734
|
"top": "10vh",
|
|
698
|
-
"class": this.ns.b("dialog-full-screen"),
|
|
735
|
+
"class": [this.ns.b("dialog-full-screen"), this.ns.is("editing", !this.readonlyState)],
|
|
699
736
|
"onClose": () => this.changeFullScreenState()
|
|
700
737
|
}, {
|
|
701
738
|
default: () => [vue.createVNode("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ibiz-html{--ibiz-html-height:300px;display:inline-block;width:100%;height:100%}.ibiz-html .ibiz-html-content{display:flex;flex-direction:column;height:100%;background-color:var(--ibiz-color-bg-0)}.ibiz-html .ibiz-html-editor{height:var(--ibiz-html-height)!important;padding:0;overflow-y:scroll;border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor.is-readonly{height:auto!important}.ibiz-html .ibiz-html-editor table{width:100%!important;border-collapse:collapse}.ibiz-html .ibiz-html-editor table th{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor table td{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);empty-cells:show;border:1px solid var(--ibiz-color-border)}.ibiz-html{--w-e-textarea-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-color:var(--ibiz-color-text-2);--w-e-textarea-border-color:var(--ibiz-color-border);--w-e-textarea-slight-border-color:var(--ibiz-color-border);--w-e-textarea-slight-color:var(--ibiz-color-text-3);--w-e-textarea-slight-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-selected-border-color:var(--ibiz-color-border);--w-e-textarea-handler-bg-color:var(--ibiz-color-primary);--w-e-toolbar-color:var(--ibiz-color-text-0);--w-e-toolbar-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-active-color:var(--ibiz-color-text-0);--w-e-toolbar-active-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-disabled-color:var(--ibiz-color-disabled-text);--w-e-toolbar-border-color:var(--ibiz-color-border);--w-e-modal-button-bg-color:var(--ibiz-color-bg-1);--w-e-modal-button-border-color:var(--ibiz-color-border)}.ibiz-html .w-e-menu-tooltip-v5::before{color:var(--ibiz-color-text-0);background-color:var(--w-e-toolbar-bg-color)}.ibiz-html .w-e-full-screen-container{z-index:9999}.ibiz-html .w-e-scroll>div{background-color:var(--ibiz-color-bg-1)}.ibiz-html .table-container table{width:100%}.ibiz-html-editor-readonly .ibiz-html-toolbar{display:none}.ibiz-html-editor-readonly .ibiz-html-editor{border:none}.ibiz-html-footer{display:flex;align-items:center;justify-content:end;margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-html-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-html-footer__cancel{height:var(--ibiz-height-control-default);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-html-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-html-footer__save{height:var(--ibiz-height-control-default);padding:0 var(--ibiz-spacing-base);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-html-custom-toolbar{display:flex;align-items:center;justify-content:end;width:100%;height:var(--ibiz-height-control-default);padding-right:var(--ibiz-spacing-base);font-size:var(--ibiz-font-size-header-6)}.ibiz-html-custom-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-html-custom-toolbar i{cursor:pointer}.ibiz-html-custom-toolbar i:hover{color:var(--ibiz-color-primary)}.ibiz-html-message{width:500px;max-width:unset}.ibiz-html-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-html-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-html-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-html-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-html-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-html-dialog-full-screen{height:80%}.ibiz-html-dialog-full-screen .ibiz-html{padding:0
|
|
1
|
+
.ibiz-html{--ibiz-html-height:300px;display:inline-block;width:100%;height:100%}.ibiz-html .ibiz-html-content{display:flex;flex-direction:column;height:100%;background-color:var(--ibiz-color-bg-0)}.ibiz-html .ibiz-html-editor{height:var(--ibiz-html-height)!important;padding:0;overflow-y:scroll;border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor.is-readonly{height:auto!important}.ibiz-html .ibiz-html-editor table{width:100%!important;border-collapse:collapse}.ibiz-html .ibiz-html-editor table th{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);border:1px solid var(--ibiz-color-border)}.ibiz-html .ibiz-html-editor table td{height:var(--ibiz-height-control-large);min-height:var(--ibiz-height-control-large);padding:var(--ibiz-spacing-tight);empty-cells:show;border:1px solid var(--ibiz-color-border)}.ibiz-html{--w-e-textarea-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-color:var(--ibiz-color-text-2);--w-e-textarea-border-color:var(--ibiz-color-border);--w-e-textarea-slight-border-color:var(--ibiz-color-border);--w-e-textarea-slight-color:var(--ibiz-color-text-3);--w-e-textarea-slight-bg-color:var(--ibiz-color-bg-1);--w-e-textarea-selected-border-color:var(--ibiz-color-border);--w-e-textarea-handler-bg-color:var(--ibiz-color-primary);--w-e-toolbar-color:var(--ibiz-color-text-0);--w-e-toolbar-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-active-color:var(--ibiz-color-text-0);--w-e-toolbar-active-bg-color:var(--ibiz-color-bg-1);--w-e-toolbar-disabled-color:var(--ibiz-color-disabled-text);--w-e-toolbar-border-color:var(--ibiz-color-border);--w-e-modal-button-bg-color:var(--ibiz-color-bg-1);--w-e-modal-button-border-color:var(--ibiz-color-border)}.ibiz-html .w-e-menu-tooltip-v5::before{color:var(--ibiz-color-text-0);background-color:var(--w-e-toolbar-bg-color)}.ibiz-html .w-e-full-screen-container{z-index:9999}.ibiz-html .w-e-scroll>div{background-color:var(--ibiz-color-bg-1)}.ibiz-html .table-container table{width:100%}.ibiz-html.is-enable-edit .w-e-bar-item>button{color:var(--w-e-toolbar-color);cursor:pointer}.ibiz-html.is-enable-edit .w-e-bar-item>button svg{fill:var(--w-e-toolbar-color)}.ibiz-html-editor-readonly .ibiz-html-toolbar{display:none}.ibiz-html-editor-readonly .ibiz-html-editor{border:none}.ibiz-html-toolbar .w-e-toolbar{background-color:var(--ibiz-color-bg-0);border:1px solid var(--ibiz-color-border);border-bottom:none;box-shadow:none}.ibiz-html-toolbar .w-e-toolbar .w-e-bar-item>button:hover{background-color:var(--ibiz-color-bg-0)}.ibiz-html-footer{display:flex;align-items:center;justify-content:end;margin-top:var(--ibiz-spacing-base-tight);margin-right:var(--ibiz-spacing-tight)}.ibiz-html-footer>*+*{margin-left:var(--ibiz-spacing-base)}.ibiz-html-footer__cancel{height:var(--ibiz-height-control-default);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-text-1);cursor:pointer;opacity:.7}.ibiz-html-footer__cancel:hover{color:var(--ibiz-color-primary);opacity:1}.ibiz-html-footer__save{height:var(--ibiz-height-control-default);padding:0 var(--ibiz-spacing-base);line-height:var(--ibiz-height-control-default);color:var(--ibiz-color-primary-active-text);text-align:center;cursor:pointer;background-color:var(--ibiz-color-primary);border-radius:var(--ibiz-border-radius-small)}.ibiz-html-custom-toolbar{display:flex;align-items:center;justify-content:end;width:100%;height:var(--ibiz-height-control-default);padding-right:var(--ibiz-spacing-base);font-size:var(--ibiz-font-size-header-6)}.ibiz-html-custom-toolbar>*+*{margin-left:var(--ibiz-spacing-base-loose)}.ibiz-html-custom-toolbar i{cursor:pointer}.ibiz-html-custom-toolbar i:hover{color:var(--ibiz-color-primary)}.ibiz-html-message{width:500px;max-width:unset}.ibiz-html-message__message-content--message-tip{color:var(--ibiz-color-text-3)}.ibiz-html-message__message-cancel{color:var(--ibiz-color-text-1);background-color:transparent}.ibiz-html-message__message-cancel:hover{color:var(--ibiz-color-primary);background-color:transparent}.ibiz-html-message__message-comfire{background-color:var(--ibiz-color-danger)!important}.ibiz-html-message__message-comfire:hover{box-shadow:0 2px 5px 1px var(--ibiz-color-danger)}.ibiz-html-dialog-full-screen{height:80%}.ibiz-html-dialog-full-screen .el-dialog__header{display:none}.ibiz-html-dialog-full-screen .el-dialog__body{height:100%;padding-top:0}.ibiz-html-dialog-full-screen.is-editing .el-dialog__body{padding-bottom:0}.ibiz-html-dialog-full-screen .ibiz-html{padding:0;--w-e-toolbar-bg-color:var(--ibiz-color-bg-0)}.ibiz-html-dialog-full-screen .ibiz-html-custom-toolbar{height:56px;padding-right:0}.ibiz-html-dialog-full-screen .ibiz-html-content{height:calc(100% - 56px)}.ibiz-html-dialog-full-screen .ibiz-html-content .ibiz-html-editor{height:100%!important}.ibiz-html-dialog-full-screen .ibiz-html-content.is-editing{height:calc(100% - 128px)}.ibiz-html-footer-dialog{height:68px;margin-top:0;margin-right:0}emoji-elem{margin:0 1px!important}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Cherry = require('cherry-markdown');
|
|
4
|
+
var vue = require('vue');
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
function initCustomMenu(c) {
|
|
8
|
+
const AIMenu = Cherry.createMenuHook("AI", {
|
|
9
|
+
icon: {
|
|
10
|
+
type: "svg",
|
|
11
|
+
content: "<svg\n viewBox='0 0 16 16'\n xmlns='http://www.w3.org/2000/svg'\n fill='currentColor'\n height='1em'\n width='1em'\n preserveAspectRatio='xMidYMid meet'\n focusable='false'\n >\n <g\n id='aae1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/ai-star'\n stroke-width='1'\n fill-rule='evenodd'\n >\n <path\n d='M5.817 1.53l3.158 8.797h.054v.152l1.443 4.021-1.402.001-1.041-2.982H2.495l-1.03 2.982L0 14.5 4.671 1.533l1.146-.003zm7.86 5.424V14.5h-1.213V6.954h1.212zM5.248 3.549l-2.342 6.778h4.706L5.249 3.55zM13.046 0c.075 0 .147.02.204.071a.318.318 0 01.094.181l.064.273c.097.417.17.727.255.968.084.24.177.4.31.523.134.124.318.218.599.306.281.088.65.166 1.15.265a.358.358 0 01.195.095c.056.057.083.13.083.213a.289.289 0 01-.083.21.362.362 0 01-.197.094c-.528.093-.918.167-1.214.255-.295.088-.485.187-.621.324-.137.138-.23.324-.31.606-.08.283-.145.651-.23 1.147a.329.329 0 01-.093.184.293.293 0 01-.206.075.308.308 0 01-.207-.072.322.322 0 01-.1-.188l-.006-.033c-.085-.486-.149-.845-.228-1.12-.079-.274-.17-.452-.305-.585-.135-.133-.323-.23-.618-.32s-.683-.168-1.21-.273a.353.353 0 01-.2-.096.29.29 0 01-.08-.208c0-.079.023-.153.079-.211a.35.35 0 01.2-.097c.5-.098.869-.176 1.15-.263.282-.087.465-.18.597-.302.132-.12.224-.278.306-.511.082-.236.151-.539.244-.947l.071-.312a.312.312 0 01.102-.183.311.311 0 01.205-.069z'\n id='aae\u5F62\u72B6\u7ED3\u5408'\n ></path>\n </g>\n </svg>\n "
|
|
12
|
+
},
|
|
13
|
+
onClick: (_selection, _menukey, event) => {
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
vue.nextTick(() => {
|
|
17
|
+
var _a;
|
|
18
|
+
if ((_a = c.mdeditor) == null ? void 0 : _a.bubble) {
|
|
19
|
+
c.mdeditor.bubble.visible = true;
|
|
20
|
+
const selectionPosition = c.mdeditor.bubble.bubbleDom.getBoundingClientRect();
|
|
21
|
+
if (!selectionPosition || !selectionPosition.left || !selectionPosition.top)
|
|
22
|
+
return;
|
|
23
|
+
const items = ibiz.inLineAIUtil.calcContextMenus(
|
|
24
|
+
c.deACMode,
|
|
25
|
+
(tag) => {
|
|
26
|
+
c.doInLineAIUIAction(tag, c.model.appId);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
if (items.length === 0)
|
|
30
|
+
return;
|
|
31
|
+
ibiz.inLineAIUtil.showContextMenus(
|
|
32
|
+
// 浮动工具栏的左侧距离
|
|
33
|
+
selectionPosition.left,
|
|
34
|
+
// 浮动工具栏的顶部距离 + 浮动工具栏的高度
|
|
35
|
+
selectionPosition.top + 43,
|
|
36
|
+
items
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return [AIMenu];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.initCustomMenu = initCustomMenu;
|
|
@@ -7,6 +7,7 @@ var vue3Util = require('@ibiz-template/vue3-util');
|
|
|
7
7
|
var qxUtil = require('qx-util');
|
|
8
8
|
var Cherry = require('cherry-markdown');
|
|
9
9
|
require('./ibiz-markdown-editor.css');
|
|
10
|
+
var customMenu = require('./custom-menu.cjs');
|
|
10
11
|
|
|
11
12
|
"use strict";
|
|
12
13
|
const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -16,12 +17,13 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
16
17
|
setup(props, {
|
|
17
18
|
emit
|
|
18
19
|
}) {
|
|
19
|
-
var _a, _b;
|
|
20
|
+
var _a, _b, _c;
|
|
20
21
|
const ns = vue3Util.useNamespace("markdown");
|
|
21
22
|
const c = props.controller;
|
|
22
23
|
const currentVal = vue.ref("");
|
|
23
24
|
let editor = null;
|
|
24
25
|
const id = qxUtil.createUUID();
|
|
26
|
+
const [AIMenu] = customMenu.initCustomMenu(c);
|
|
25
27
|
const uploadHeaders = ibiz.util.file.getUploadHeaders();
|
|
26
28
|
const headers = vue.ref({
|
|
27
29
|
...uploadHeaders
|
|
@@ -32,6 +34,12 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
32
34
|
UIStore
|
|
33
35
|
} = vue3Util.useUIStore();
|
|
34
36
|
const theme = vue.ref(customTheme || UIStore.theme);
|
|
37
|
+
const isEditing = vue.ref(false);
|
|
38
|
+
let showmode = "default";
|
|
39
|
+
if (c && ((_c = c.editorParams) == null ? void 0 : _c.showmode)) {
|
|
40
|
+
showmode = c.editorParams.showmode;
|
|
41
|
+
}
|
|
42
|
+
const isFullScreen = vue.ref(false);
|
|
35
43
|
const defaultModel = vue.ref("editOnly");
|
|
36
44
|
let resizeObserver = null;
|
|
37
45
|
let lastMarkDownWidth = 0;
|
|
@@ -95,7 +103,7 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
95
103
|
};
|
|
96
104
|
const setCherryContent = (val) => {
|
|
97
105
|
isIgnoreChange = true;
|
|
98
|
-
editor == null ? void 0 : editor.setMarkdown(val,
|
|
106
|
+
editor == null ? void 0 : editor.setMarkdown(val, true);
|
|
99
107
|
};
|
|
100
108
|
vue.watch(() => props.value, (newVal, oldVal) => {
|
|
101
109
|
if (newVal !== oldVal) {
|
|
@@ -115,6 +123,9 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
115
123
|
}
|
|
116
124
|
});
|
|
117
125
|
const afterChange = (_e) => {
|
|
126
|
+
if (showmode === "manual") {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
118
129
|
emit("change", getCherryContent(), c == null ? void 0 : c.model.id, isIgnoreChange);
|
|
119
130
|
isIgnoreChange = false;
|
|
120
131
|
};
|
|
@@ -194,25 +205,57 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
194
205
|
if (editor && markDownBox.value) {
|
|
195
206
|
if (isFullscreen()) {
|
|
196
207
|
closeFullscreen();
|
|
208
|
+
isFullScreen.value = false;
|
|
197
209
|
} else {
|
|
198
210
|
openFullscreen();
|
|
211
|
+
isFullScreen.value = true;
|
|
199
212
|
}
|
|
200
213
|
}
|
|
201
214
|
};
|
|
202
215
|
const handleKeyDown = (_e) => {
|
|
203
216
|
_e.stopPropagation();
|
|
204
217
|
if (_e.key === "Escape") {
|
|
218
|
+
_e.preventDefault();
|
|
205
219
|
if (isFullscreen()) {
|
|
206
220
|
closeFullscreen();
|
|
221
|
+
isFullScreen.value = false;
|
|
207
222
|
}
|
|
208
223
|
}
|
|
209
224
|
};
|
|
225
|
+
const changeMainTheme = (_theme) => {
|
|
226
|
+
c == null ? void 0 : c.setCurrentEditorTheme(_theme);
|
|
227
|
+
};
|
|
228
|
+
const selectionChange = (event) => {
|
|
229
|
+
var _a2, _b2;
|
|
230
|
+
const {
|
|
231
|
+
info
|
|
232
|
+
} = event;
|
|
233
|
+
let isForwardSelection = true;
|
|
234
|
+
const firstRange = info.ranges && info.ranges[0];
|
|
235
|
+
if (!firstRange) {
|
|
236
|
+
isForwardSelection = true;
|
|
237
|
+
} else {
|
|
238
|
+
const {
|
|
239
|
+
anchor,
|
|
240
|
+
head
|
|
241
|
+
} = firstRange;
|
|
242
|
+
isForwardSelection = c.isPositionBefore(anchor, head);
|
|
243
|
+
}
|
|
244
|
+
const startPos = (_a2 = c.mdeditor) == null ? void 0 : _a2.editor.editor.getCursor("start");
|
|
245
|
+
const endPos = (_b2 = c.mdeditor) == null ? void 0 : _b2.editor.editor.getCursor("end");
|
|
246
|
+
c.setCursorPos(startPos, endPos);
|
|
247
|
+
c.setSelectionDirection(isForwardSelection);
|
|
248
|
+
};
|
|
210
249
|
const editorInit = () => {
|
|
211
|
-
if (props.disabled || props.readonly) {
|
|
250
|
+
if (props.disabled || props.readonly || showmode === "manual") {
|
|
212
251
|
defaultModel.value = "previewOnly";
|
|
213
252
|
}
|
|
214
253
|
vue.nextTick(() => {
|
|
215
254
|
var _a2;
|
|
255
|
+
const bubble = ["bold", "italic", "underline", "strikethrough", "sub", "sup", "|", "size", "color"];
|
|
256
|
+
if (c && c.chatCompletion) {
|
|
257
|
+
bubble.unshift("AI");
|
|
258
|
+
}
|
|
216
259
|
editor = new Cherry({
|
|
217
260
|
id,
|
|
218
261
|
value: currentVal.value,
|
|
@@ -249,15 +292,37 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
249
292
|
toolbar: ["bold", "italic", "underline", "strikethrough", "|", "color", "header", "|", "list", "image", {
|
|
250
293
|
insert: ["link", "hr", "br", "code", "formula", "toc", "table", "line-table", "bar-table"]
|
|
251
294
|
}, "settings", "togglePreview"],
|
|
252
|
-
bubble
|
|
295
|
+
bubble,
|
|
253
296
|
float: ["h1", "h2", "h3", "|", "checklist", "quote", "quickTable", "code"],
|
|
254
|
-
customMenu:
|
|
255
|
-
|
|
297
|
+
customMenu: {
|
|
298
|
+
AI: AIMenu
|
|
299
|
+
},
|
|
300
|
+
// 定义侧边栏,默认为空
|
|
301
|
+
sidebar: ["theme", "copy"],
|
|
302
|
+
// 定义顶部右侧工具栏,默认为空
|
|
303
|
+
toolbarRight: [],
|
|
304
|
+
// 目录
|
|
305
|
+
toc: {
|
|
306
|
+
updateLocationHash: false,
|
|
307
|
+
// 要不要更新URL的hash
|
|
308
|
+
defaultModel: "pure",
|
|
309
|
+
// pure: 精简模式/缩略模式,只有一排小点; full: 完整模式,会展示所有标题
|
|
310
|
+
showAutoNumber: true,
|
|
311
|
+
// 是否显示自增序号
|
|
312
|
+
position: "absolute",
|
|
313
|
+
// 悬浮目录的悬浮方式。当滚动条在cherry内部时,用absolute;当滚动条在cherry外部时,用fixed
|
|
314
|
+
cssText: ""
|
|
315
|
+
// 自定义样式
|
|
316
|
+
}
|
|
256
317
|
},
|
|
257
318
|
callback: {
|
|
258
319
|
afterChange,
|
|
259
320
|
beforeImageMounted
|
|
260
321
|
},
|
|
322
|
+
event: {
|
|
323
|
+
changeMainTheme,
|
|
324
|
+
selectionChange
|
|
325
|
+
},
|
|
261
326
|
engine: {
|
|
262
327
|
syntax: {
|
|
263
328
|
table: {
|
|
@@ -278,6 +343,7 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
278
343
|
span.appendChild(createCherryIcon("fullscreen"));
|
|
279
344
|
const parentElement = props.disabled ? editor.editor.options.editorDom.parentElement : (_a2 = editor.editor.options.editorDom.parentElement) == null ? void 0 : _a2.querySelector(".cherry-toolbar>.toolbar-right");
|
|
280
345
|
parentElement == null ? void 0 : parentElement.appendChild(span);
|
|
346
|
+
c == null ? void 0 : c.setMDEditor(editor);
|
|
281
347
|
});
|
|
282
348
|
};
|
|
283
349
|
vue.watch(() => UIStore.theme, (newVal) => {
|
|
@@ -314,6 +380,69 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
314
380
|
resizeObserver.observe(markDownBox.value);
|
|
315
381
|
}
|
|
316
382
|
};
|
|
383
|
+
const onEnableEdit = () => {
|
|
384
|
+
isEditing.value = true;
|
|
385
|
+
defaultModel.value = "editOnly";
|
|
386
|
+
editor == null ? void 0 : editor.switchModel(defaultModel.value);
|
|
387
|
+
};
|
|
388
|
+
const onResetEditState = () => {
|
|
389
|
+
isEditing.value = false;
|
|
390
|
+
defaultModel.value = "previewOnly";
|
|
391
|
+
editor == null ? void 0 : editor.switchModel(defaultModel.value);
|
|
392
|
+
};
|
|
393
|
+
const onEditCancel = () => {
|
|
394
|
+
setCherryContent(currentVal.value);
|
|
395
|
+
onResetEditState();
|
|
396
|
+
};
|
|
397
|
+
const onEditConfirm = () => {
|
|
398
|
+
emit("change", getCherryContent(), c == null ? void 0 : c.model.id, isIgnoreChange);
|
|
399
|
+
isIgnoreChange = false;
|
|
400
|
+
onResetEditState();
|
|
401
|
+
};
|
|
402
|
+
const onFocusEditor = () => {
|
|
403
|
+
const target = document.getElementById(id);
|
|
404
|
+
target == null ? void 0 : target.focus();
|
|
405
|
+
};
|
|
406
|
+
const renderHeader = () => {
|
|
407
|
+
if (showmode === "manual" && !isEditing.value) {
|
|
408
|
+
return vue.createVNode("div", {
|
|
409
|
+
"onClick": onFocusEditor,
|
|
410
|
+
"class": [ns.e("header"), ns.is("fullscreen", isFullScreen.value)]
|
|
411
|
+
}, [!props.disabled && !props.readonly && vue.createVNode("div", {
|
|
412
|
+
"class": ns.em("header", "edit"),
|
|
413
|
+
"onClick": onEnableEdit,
|
|
414
|
+
"title": ibiz.i18n.t("editor.markdown.edit")
|
|
415
|
+
}, [vue.createVNode("i", {
|
|
416
|
+
"class": "fa fa-edit",
|
|
417
|
+
"aria-hidden": "true"
|
|
418
|
+
}, null)]), vue.createVNode("div", {
|
|
419
|
+
"class": ns.em("header", "full"),
|
|
420
|
+
"onClick": onSwitchFullscreen
|
|
421
|
+
}, [isFullScreen.value ? vue.createVNode("i", {
|
|
422
|
+
"class": "fa fa-compress",
|
|
423
|
+
"aria-hidden": "true",
|
|
424
|
+
"title": ibiz.i18n.t("editor.html.reduce")
|
|
425
|
+
}, null) : vue.createVNode("i", {
|
|
426
|
+
"class": "fa fa-expand",
|
|
427
|
+
"aria-hidden": "true",
|
|
428
|
+
"title": ibiz.i18n.t("editor.common.fullscreen")
|
|
429
|
+
}, null)])]);
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
const renderFooter = () => {
|
|
433
|
+
if (showmode === "manual" && isEditing.value && !props.disabled && !props.readonly) {
|
|
434
|
+
return vue.createVNode("div", {
|
|
435
|
+
"onClick": onFocusEditor,
|
|
436
|
+
"class": [ns.e("footer"), ns.is("fullscreen", isFullScreen.value)]
|
|
437
|
+
}, [vue.createVNode("div", {
|
|
438
|
+
"class": ns.em("footer", "cancel"),
|
|
439
|
+
"onClick": onEditCancel
|
|
440
|
+
}, [ibiz.i18n.t("editor.common.cancel")]), vue.createVNode("div", {
|
|
441
|
+
"class": ns.em("footer", "save"),
|
|
442
|
+
"onClick": onEditConfirm
|
|
443
|
+
}, [ibiz.i18n.t("editor.common.confirm")])]);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
317
446
|
vue.onMounted(() => {
|
|
318
447
|
var _a2;
|
|
319
448
|
editorInit();
|
|
@@ -340,16 +469,21 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
|
|
|
340
469
|
theme,
|
|
341
470
|
defaultModel,
|
|
342
471
|
cssVars,
|
|
472
|
+
isEditing,
|
|
473
|
+
showmode,
|
|
343
474
|
getCherryHtml,
|
|
344
475
|
getCherryContent,
|
|
345
|
-
setCherryContent
|
|
476
|
+
setCherryContent,
|
|
477
|
+
renderHeader,
|
|
478
|
+
renderFooter
|
|
346
479
|
};
|
|
347
480
|
},
|
|
348
481
|
render() {
|
|
349
482
|
return vue.createVNode("div", {
|
|
350
483
|
"ref": "markDownBox",
|
|
351
|
-
"class": [this.ns.b(), this.ns.is("disabled", this.disabled)]
|
|
352
|
-
}, [vue.createVNode("div", {
|
|
484
|
+
"class": [this.ns.b(), this.ns.is("disabled", this.disabled), this.ns.is("manual", this.showmode === "manual"), this.ns.is("editing", this.isEditing)]
|
|
485
|
+
}, [this.renderHeader(), this.renderFooter(), vue.createVNode("div", {
|
|
486
|
+
"tabindex": "-1",
|
|
353
487
|
"id": this.id,
|
|
354
488
|
"style": this.cssVars,
|
|
355
489
|
"class": this.ns.b("cherry")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ibiz-markdown .ibiz-markdown-cherry{--ibiz-markdown-width:100%;width:var(--ibiz-markdown-width)}.ibiz-markdown .ibiz-markdown-cherry .cherry{width:100
|
|
1
|
+
.ibiz-markdown{--ibiz-markdown-width:100%;--ibiz-markdown-color-manual-toolbar-bg-save:var(--ibiz-color-primary);--ibiz-markdown-color-manual-toolbar-text-save:var(--ibiz-color-primary-active-text);--ibiz-markdown-color-manual-toolbar-text-cancel:var(--ibiz-color-text-1);--ibiz-markdown-color-manual-toolbar-text-cancel-hover:var(--ibiz-color-primary);--ibiz-markdown-spacing-manual-toolbar-height:32px;--ibiz-markdown-spacing-manual-toolbar-gap:var(--ibiz-spacing-base);--ibiz-markdown-spacing-manual-toolbar-item-padding:0 var(--ibiz-spacing-base);--ibiz-markdown-spacing-manual-toolbar-margin:var(--ibiz-spacing-base-tight) var(--ibiz-spacing-tight) 0 0;--ibiz-markdown-spacing-manual-toolbar-fullscreen-height:var(--ibiz-height-control-default);--ibiz-markdown-spacing-manual-toolbar-fullscreen-padding:0 var(--ibiz-spacing-extra-loose);--ibiz-markdown-spacing-manual-toolbar-fullscreen-height-header:var(--ibiz-spacing-super-loose);--ibiz-markdown-height-manual-toolbar-height:var(--ibiz-height-control-default);--ibiz-markdown-border-radius-manual-toolbar-item:var(--ibiz-border-radius-small);--ibiz-markdown-border-manual-toolbar-fullscreen-footer:1px solid var(--ibiz-color-border)}.ibiz-markdown__header{display:flex;flex-shrink:0;gap:var(--ibiz-markdown-spacing-manual-toolbar-gap);align-items:center;justify-content:end;height:var(--ibiz-markdown-spacing-manual-toolbar-height)}.ibiz-markdown__header--edit{cursor:pointer}.ibiz-markdown__header--full{cursor:pointer}.ibiz-markdown__header.is-fullscreen{position:fixed;top:0;right:0;left:0;z-index:999;width:100%;height:calc(var(--ibiz-markdown-spacing-manual-toolbar-fullscreen-height-header));padding:var(--ibiz-markdown-spacing-manual-toolbar-fullscreen-padding);margin-top:0;background-color:var(--ibiz-view-bg-color)}.ibiz-markdown__header.is-fullscreen+.ibiz-markdown-cherry .cherry.fullscreen{top:calc(var(--ibiz-markdown-spacing-manual-toolbar-fullscreen-height-header));height:calc(100% - var(--ibiz-markdown-spacing-manual-toolbar-fullscreen-height-header))}.ibiz-markdown__footer{display:flex;gap:var(--ibiz-markdown-spacing-manual-toolbar-gap);align-items:center;justify-content:end;height:var(--ibiz-markdown-spacing-manual-toolbar-height);margin:var(--ibiz-markdown-spacing-manual-toolbar-margin)}.ibiz-markdown__footer--save{height:var(--ibiz-markdown-height-manual-toolbar-height);padding:var(--ibiz-markdown-spacing-manual-toolbar-item-padding);line-height:var(--ibiz-markdown-height-manual-toolbar-height);color:var(--ibiz-markdown-color-manual-toolbar-text-save);text-align:center;cursor:pointer;background-color:var(--ibiz-markdown-color-manual-toolbar-bg-save);border-radius:var(--ibiz-markdown-border-radius-manual-toolbar-item)}.ibiz-markdown__footer--cancel{color:var(--ibiz-markdown-color-manual-toolbar-text-cancel);cursor:pointer}.ibiz-markdown__footer--cancel:hover{color:var(--ibiz-markdown-color-manual-toolbar-text-cancel-hover)}.ibiz-markdown__footer.is-fullscreen{position:fixed;right:0;bottom:0;left:0;z-index:999;width:100%;height:calc(var(--ibiz-markdown-spacing-manual-toolbar-fullscreen-height) * 2);padding:var(--ibiz-markdown-spacing-manual-toolbar-fullscreen-padding);margin-top:0;background-color:var(--ibiz-view-bg-color);border-top:var(--ibiz-markdown-border-manual-toolbar-fullscreen-footer)}.ibiz-markdown__footer.is-fullscreen+.ibiz-markdown-cherry .cherry.fullscreen{height:calc(100% - var(--ibiz-markdown-spacing-manual-toolbar-fullscreen-height) * 2)}.ibiz-markdown .ibiz-markdown-cherry{width:var(--ibiz-markdown-width);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}
|