@vc-shell/framework 1.0.304 → 1.0.306

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 (155) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/apl-B2DGVGxc.js +76 -0
  3. package/dist/asciiarmor-2LVJmxlE.js +34 -0
  4. package/dist/asn1-DF4fnRHj.js +93 -0
  5. package/dist/asterisk-DS281yxp.js +271 -0
  6. package/dist/{azuread-B2kotp-T.js → azuread-D074ya7M.js} +2 -2
  7. package/dist/brainfuck-C_p9pTT8.js +34 -0
  8. package/dist/clike-DxjBFHnq.js +619 -0
  9. package/dist/clojure-CCKyeQKf.js +800 -0
  10. package/dist/cmake-CuaCgAKt.js +28 -0
  11. package/dist/cobol-CJVkMW0i.js +73 -0
  12. package/dist/coffeescript-BVCvwO8I.js +179 -0
  13. package/dist/commonlisp-D_kxz07b.js +75 -0
  14. package/dist/crystal-D309uH6_.js +217 -0
  15. package/dist/css-bIlmDBTK.js +1560 -0
  16. package/dist/cypher-BMq4Fwjl.js +68 -0
  17. package/dist/d-BZcgY6La.js +127 -0
  18. package/dist/diff-Cg9d_RX2.js +18 -0
  19. package/dist/dockerfile-CFG_IPGn.js +194 -0
  20. package/dist/dtd-CtLokQ-U.js +84 -0
  21. package/dist/dylan-QYeExnWK.js +234 -0
  22. package/dist/ebnf-Xa2PN7SI.js +77 -0
  23. package/dist/ecl-CiXN-g_D.js +121 -0
  24. package/dist/eiffel-yQhjl4T1.js +110 -0
  25. package/dist/elm-CNT9vbN0.js +108 -0
  26. package/dist/erlang-CFOYdy9e.js +487 -0
  27. package/dist/{external-provider-p0gx8FPW.js → external-provider-BLZESHFH.js} +1 -1
  28. package/dist/{external-provider.vue_vue_type_script_setup_true_lang-A6uhqiX5.js → external-provider.vue_vue_type_script_setup_true_lang-ztp0o_ad.js} +1 -1
  29. package/dist/external-providers-C2FIvRa3.js +4 -0
  30. package/dist/factor-DJHfQ4a1.js +65 -0
  31. package/dist/fcl-CPC2WYrI.js +103 -0
  32. package/dist/forth-BmxRyE9S.js +60 -0
  33. package/dist/fortran-9bvPyrOW.js +442 -0
  34. package/dist/framework.js +68 -68
  35. package/dist/gas-BdfkXJT_.js +183 -0
  36. package/dist/gherkin-CJuwpceU.js +34 -0
  37. package/dist/groovy-CdgvOO23.js +146 -0
  38. package/dist/haskell-Bvt3Qq1t.js +375 -0
  39. package/dist/haxe-pdDS1aE8.js +359 -0
  40. package/dist/http-D9LttvKF.js +44 -0
  41. package/dist/idl-B6TRFYjl.js +947 -0
  42. package/dist/index-BRDJoKcp.js +156 -0
  43. package/dist/index-Bd_kPYsr.js +265 -0
  44. package/dist/index-BkacpBZ-.js +538 -0
  45. package/dist/index-By-xfM2p.js +93 -0
  46. package/dist/index-CT9Z79Tw.js +243 -0
  47. package/dist/index-DPIVWWqP.js +598 -0
  48. package/dist/index-DW2BFSnq.js +75 -0
  49. package/dist/index-DXrgLcYD.js +98 -0
  50. package/dist/index-Dl4I5m7Q.js +299 -0
  51. package/dist/index-DnZgrIMy.js +71 -0
  52. package/dist/index-DuJKSyJ6.js +341 -0
  53. package/dist/index-DzMMIaU6.js +58 -0
  54. package/dist/index-EF2ZlWq0.js +135 -0
  55. package/dist/index-NcCUk9Hy.js +105384 -0
  56. package/dist/index-OLuuTH3W.js +288 -0
  57. package/dist/index-h6p-M8W2.js +312 -0
  58. package/dist/index-zkES0xwE.js +134 -0
  59. package/dist/index.css +1 -1
  60. package/dist/javascript-CWGekh08.js +690 -0
  61. package/dist/jinja2-DnB6dQmV.js +154 -0
  62. package/dist/julia-DpvXAuO6.js +241 -0
  63. package/dist/livescript-CE_BxZmN.js +272 -0
  64. package/dist/locales/de.json +417 -0
  65. package/dist/locales/en.json +86 -1
  66. package/dist/locales/index.d.ts +2 -1
  67. package/dist/locales/index.d.ts.map +1 -1
  68. package/dist/lua-XplVlWi_.js +217 -0
  69. package/dist/mathematica-jaRHnSxC.js +35 -0
  70. package/dist/mbox-BctzC1hL.js +76 -0
  71. package/dist/mirc-CFBPAOaF.js +72 -0
  72. package/dist/mllike-1yy7Y7jE.js +275 -0
  73. package/dist/modelica-vUgVs--1.js +93 -0
  74. package/dist/mscgen-Cpl0NYLN.js +104 -0
  75. package/dist/mumps-CQoS1kWX.js +25 -0
  76. package/dist/nginx-zDPm3Z74.js +89 -0
  77. package/dist/nsis-BtA0qkjU.js +62 -0
  78. package/dist/ntriples-CsNjv2QF.js +79 -0
  79. package/dist/octave-C8PmmSRH.js +143 -0
  80. package/dist/oz-Ce8aN8oE.js +151 -0
  81. package/dist/pascal-ixanSKUz.js +77 -0
  82. package/dist/perl-B4bSCe1C.js +915 -0
  83. package/dist/pig-D24Z8EXi.js +54 -0
  84. package/dist/powershell-DkYVfTzP.js +249 -0
  85. package/dist/properties-Dn9wna3M.js +26 -0
  86. package/dist/protobuf-BPIjwpzm.js +49 -0
  87. package/dist/pug-CW1q1xhQ.js +248 -0
  88. package/dist/puppet-nyd4dhjf.js +45 -0
  89. package/dist/python-B5QdSKoL.js +313 -0
  90. package/dist/q-DXjKs-tC.js +83 -0
  91. package/dist/r-Bz1d3XP0.js +104 -0
  92. package/dist/rpm-IznJm2Xc.js +57 -0
  93. package/dist/ruby-CcYfvIk6.js +228 -0
  94. package/dist/sas-7E8yHoCW.js +105 -0
  95. package/dist/scheme-DjibxsNh.js +124 -0
  96. package/dist/shared/components/common/popup/vc-popup-info.vue.d.ts +29 -0
  97. package/dist/shared/components/common/popup/vc-popup-info.vue.d.ts.map +1 -0
  98. package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts +1 -0
  99. package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts.map +1 -1
  100. package/dist/shared/modules/dynamic/components/fields/Table.d.ts.map +1 -1
  101. package/dist/shared/modules/dynamic/types/index.d.ts +18 -0
  102. package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
  103. package/dist/shell-C0C2sNA_.js +182 -0
  104. package/dist/sieve-Bwz7vjP5.js +72 -0
  105. package/dist/simple-mode-HGTvdazT.js +88 -0
  106. package/dist/smalltalk-Bhddl2pB.js +48 -0
  107. package/dist/solr-BNlsLglM.js +41 -0
  108. package/dist/sparql-FarWu_Gb.js +197 -0
  109. package/dist/spreadsheet-C-cy4P5N.js +49 -0
  110. package/dist/sql-uoWIYwDX.js +284 -0
  111. package/dist/stex-92raWT1r.js +129 -0
  112. package/dist/stylus-DRcbY16X.js +250 -0
  113. package/dist/swift-DSxqR9R6.js +230 -0
  114. package/dist/tcl-xfoLljhY.js +81 -0
  115. package/dist/textile-D1AWE-pc.js +295 -0
  116. package/dist/tiddlywiki-5wqsXtSk.js +155 -0
  117. package/dist/tiki-D9z-T0ea.js +178 -0
  118. package/dist/toml-BHiuTcfn.js +49 -0
  119. package/dist/troff-D2UO-fKf.js +35 -0
  120. package/dist/tsconfig.tsbuildinfo +1 -1
  121. package/dist/ttcn-DmjTzZb6.js +125 -0
  122. package/dist/ttcn-cfg-B2U3U7dn.js +90 -0
  123. package/dist/turtle-xwJUxoPV.js +80 -0
  124. package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts +6051 -706
  125. package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts.map +1 -1
  126. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +2083 -0
  127. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -0
  128. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  129. package/dist/ui/components/organisms/vc-gallery/vc-gallery.stories.d.ts +1 -1
  130. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +1 -1
  131. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +2 -2
  132. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
  133. package/dist/vb-c2kQGd6-.js +74 -0
  134. package/dist/vbscript-Dz1TtKsy.js +324 -0
  135. package/dist/velocity-DJd0pTTC.js +96 -0
  136. package/dist/verilog-C4VGD9n1.js +263 -0
  137. package/dist/vhdl-T9HkrbI2.js +106 -0
  138. package/dist/webidl-CjfDENEo.js +155 -0
  139. package/dist/xquery-xQxle02u.js +426 -0
  140. package/dist/yacas-C0absKBh.js +73 -0
  141. package/dist/z80-C8rPtw-0.js +61 -0
  142. package/package.json +6 -8
  143. package/shared/components/common/popup/vc-popup-info.vue +44 -0
  144. package/shared/components/popup-handler/composables/usePopup/index.ts +24 -1
  145. package/shared/components/user-dropdown-button/user-dropdown-button.vue +2 -2
  146. package/shared/modules/dynamic/components/fields/Table.ts +21 -0
  147. package/shared/modules/dynamic/types/index.ts +18 -0
  148. package/ui/components/molecules/vc-editor/vc-editor.stories.ts +0 -1
  149. package/ui/components/molecules/vc-editor/vc-editor.vue +307 -151
  150. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +1 -1
  151. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +3 -3
  152. package/ui/components/organisms/vc-popup/vc-popup.vue +10 -1
  153. package/ui/components/organisms/vc-table/vc-table.vue +1 -1
  154. package/dist/external-providers-CiTswBGP.js +0 -4
  155. package/dist/index-_XQe2tID.js +0 -81810
@@ -112,14 +112,14 @@ const { closeBlade } = useBladeNavigation();
112
112
 
113
113
  const defaultMenuItems = ref([
114
114
  {
115
- title: t("SHELL.ACCOUNT.CHANGE_PASSWORD"),
115
+ title: computed(() => t("SHELL.ACCOUNT.CHANGE_PASSWORD")),
116
116
  icon: "fas fa-key",
117
117
  clickHandler() {
118
118
  open();
119
119
  },
120
120
  },
121
121
  {
122
- title: t("SHELL.ACCOUNT.LOGOUT"),
122
+ title: computed(() => t("SHELL.ACCOUNT.LOGOUT")),
123
123
  icon: "fas fa-sign-out-alt",
124
124
  async clickHandler() {
125
125
  const isPrevented = await closeBlade(0);
@@ -82,6 +82,18 @@ export default {
82
82
  editing: enableEditComputed.value,
83
83
  enableItemActions: !!props.element.actions,
84
84
  itemActionBuilder: actionBuilder,
85
+ get selectedItemId() {
86
+ if (
87
+ props.element.selectedItemId?.method &&
88
+ props.bladeContext.scope?.[props.element.selectedItemId?.method]
89
+ ) {
90
+ if (typeof props.bladeContext.scope?.[props.element.selectedItemId?.method] === "function") {
91
+ return props.bladeContext.scope?.[props.element.selectedItemId?.method]?.();
92
+ } else {
93
+ return props.bladeContext.scope?.[props.element.selectedItemId?.method];
94
+ }
95
+ }
96
+ },
85
97
  get selectedItems() {
86
98
  if (
87
99
  props.element.selectedIds?.method &&
@@ -92,6 +104,15 @@ export default {
92
104
  }
93
105
  return [];
94
106
  },
107
+ onItemClick: (item: (typeof items)[number]) => {
108
+ if (
109
+ props.element.onItemClick?.method &&
110
+ props.bladeContext.scope?.[props.element.onItemClick?.method] &&
111
+ typeof props.bladeContext.scope?.[props.element.onItemClick?.method] === "function"
112
+ ) {
113
+ props.bladeContext.scope?.[props.element.onItemClick?.method](item);
114
+ }
115
+ },
95
116
  onOnEditComplete: (data: { event: { field: string; value: any }; index: number }) => {
96
117
  if (props.fieldContext) {
97
118
  setModel({
@@ -976,6 +976,24 @@ export type TableSchema = Omit<ListContentSchema, "filter"> &
976
976
  selectedIds?: {
977
977
  method: string;
978
978
  };
979
+ /**
980
+ * Configuration for the selected table row.
981
+ * Method should be defined in the blade `scope`.
982
+ * @description Method should return a table item id.
983
+ * @type {string}
984
+ */
985
+ selectedItemId?: {
986
+ method: string;
987
+ };
988
+ /**
989
+ * Configuration for the table item click.
990
+ * Method should be defined in the blade `scope`.
991
+ * @description Method should return a table item id.
992
+ * @type {string}
993
+ */
994
+ onItemClick?: {
995
+ method: string;
996
+ };
979
997
  };
980
998
 
981
999
  /**
@@ -1,6 +1,5 @@
1
1
  import type { Meta, StoryFn } from "@storybook/vue3";
2
2
  import { VcEditor } from "./";
3
- import { default as Delta } from "@vueup/vue-quill/node_modules/quill-delta";
4
3
 
5
4
  export default {
6
5
  title: "molecules/VcEditor",
@@ -24,23 +24,20 @@
24
24
  </VcLabel>
25
25
 
26
26
  <!-- Editor field -->
27
- <QuillEditor
28
- :id="id"
29
- :key="`${id}-${disabled}`"
30
- ref="quillRef"
31
- :content="modelValue"
32
- class="quill-editor vc-editor__quill-editor"
33
- :class="{
34
- 'vc-editor__quill-editor--disabled': disabled,
35
- }"
36
- theme="snow"
37
- :toolbar="toolbar"
38
- :modules="modules"
39
- content-type="html"
27
+ <md-editor
28
+ ref="editorRef"
29
+ v-model="model"
30
+ language="any"
31
+ :editor-id="id"
32
+ :disabled="disabled"
40
33
  :read-only="disabled"
34
+ :sanitize="sanitize"
41
35
  :placeholder="placeholder"
42
- :options="options"
43
- @ready="initializeQuill"
36
+ :toolbars="toolbars"
37
+ no-katex
38
+ no-mermaid
39
+ class="vc-editor__editor"
40
+ @on-upload-img="onUploadImage"
44
41
  />
45
42
 
46
43
  <slot
@@ -55,12 +52,15 @@
55
52
  </template>
56
53
  <!-- eslint-disable @typescript-eslint/no-explicit-any -->
57
54
  <script lang="ts" setup>
58
- import { QuillEditor } from "@vueup/vue-quill";
59
- import "@vueup/vue-quill/dist/vue-quill.snow.css";
60
- import { ref, unref, onMounted, onUpdated, getCurrentInstance, Ref } from "vue";
55
+ import { ref, getCurrentInstance, Ref, computed, ComputedRef } from "vue";
61
56
  import DOMPurify from "dompurify";
62
- import ImageUploader from "quill-image-uploader";
63
57
  import { VcLabel, VcHint } from "../..";
58
+ import { MdEditor, ToolbarNames, config } from "md-editor-v3";
59
+ import "md-editor-v3/lib/style.css";
60
+ import { useI18n } from "vue-i18n";
61
+ import { reactiveComputed } from "@vueuse/core";
62
+ import { tags } from "@lezer/highlight";
63
+ import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";
64
64
 
65
65
  export interface Props {
66
66
  placeholder?: string;
@@ -74,6 +74,7 @@ export interface Props {
74
74
  multilanguage?: boolean;
75
75
  currentLanguage?: string;
76
76
  maxlength?: number;
77
+ toolbar?: ToolbarNames[];
77
78
  }
78
79
 
79
80
  export interface Emits {
@@ -82,104 +83,286 @@ export interface Emits {
82
83
 
83
84
  const props = defineProps<Props>();
84
85
  const emit = defineEmits<Emits>();
86
+
87
+ const { t } = useI18n({ useScope: "global" });
88
+
85
89
  const uid = getCurrentInstance()?.uid;
86
90
  const id = `editor-${uid}`;
87
91
 
92
+ const editorRef = ref(null) as Ref<typeof MdEditor | null>;
88
93
  defineSlots<{
89
94
  error?: (props: any) => any;
90
95
  }>();
91
96
 
92
- const quillRef = ref(null) as Ref<typeof QuillEditor | null>;
93
- const quill = ref();
94
-
95
- const toolbar = {
96
- container: [
97
- { header: 1 },
98
- { header: 2 },
99
- "bold",
100
- "italic",
101
- "underline",
102
- "strike",
103
- "link",
104
- "image",
105
- "blockquote",
106
- { list: "ordered" },
107
- { list: "bullet" },
108
- { color: [] },
109
- { background: [] },
110
- "clean",
111
- ],
112
- handlers: {},
113
- };
114
-
115
- const options = {
116
- bounds: ".quill-editor",
117
- };
118
-
119
- const modules = {
120
- name: "imageUploader",
121
- module: ImageUploader,
122
- options: {
123
- upload: async (file: File) => {
124
- const formData = new FormData();
125
- formData.append("image", file);
126
-
127
- const result = await fetch(`/api/assets?folderUrl=/${props.assetsFolder}`, {
128
- method: "POST",
129
- body: formData,
130
- });
131
-
132
- const response = await result.json();
133
- if (response) {
134
- return response[0].url;
135
- }
97
+ const tagColors = [
98
+ { tag: tags.comment, color: "var(--neutrals-500)" },
99
+ { tag: tags.lineComment, color: "var(--neutrals-500)" },
100
+ { tag: tags.blockComment, color: "var(--neutrals-500)" },
101
+ { tag: tags.docComment, color: "var(--neutrals-500)" },
102
+
103
+ { tag: tags.name, color: "var(--primary-500)" },
104
+ { tag: tags.variableName, color: "var(--primary-500)" },
105
+ { tag: tags.propertyName, color: "var(--primary-500)" },
106
+ { tag: tags.labelName, color: "var(--primary-500)" },
107
+
108
+ { tag: tags.typeName, color: "var(--secondary-500)" },
109
+ { tag: tags.tagName, color: "var(--secondary-600)" },
110
+ { tag: tags.namespace, color: "var(--secondary-700)" },
111
+
112
+ { tag: tags.attributeName, color: "var(--primary-600)" },
113
+ { tag: tags.className, color: "var(--primary-700)" },
114
+
115
+ { tag: tags.macroName, color: "var(--accent-500)" },
116
+
117
+ { tag: tags.literal, color: "var(--info-500)" },
118
+ { tag: tags.string, color: "var(--success-500)" },
119
+ { tag: tags.docString, color: "var(--success-400)" },
120
+ { tag: tags.character, color: "var(--success-300)" },
121
+ { tag: tags.attributeValue, color: "var(--success-300)" },
122
+
123
+ { tag: tags.number, color: "var(--info-500)" },
124
+ { tag: tags.integer, color: "var(--info-500)" },
125
+ { tag: tags.float, color: "var(--info-500)" },
126
+
127
+ { tag: tags.bool, color: "var(--warning-500)" },
128
+ { tag: tags.atom, color: "var(--warning-500)" },
129
+ { tag: tags.unit, color: "var(--warning-500)" },
130
+
131
+ { tag: tags.regexp, color: "var(--accent-600)" },
132
+ { tag: tags.escape, color: "var(--accent-500)" },
133
+ { tag: tags.color, color: "var(--accent-500)" },
134
+ { tag: tags.url, color: "var(--accent-500)" },
135
+
136
+ { tag: tags.keyword, color: "var(--primary-700)" },
137
+ { tag: tags.self, color: "var(--primary-700)" },
138
+ { tag: tags.operatorKeyword, color: "var(--primary-700)" },
139
+ { tag: tags.controlKeyword, color: "var(--primary-700)" },
140
+ { tag: tags.definitionKeyword, color: "var(--primary-700)" },
141
+ { tag: tags.moduleKeyword, color: "var(--primary-700)" },
142
+
143
+ { tag: tags.null, color: "var(--warning-600)" },
144
+
145
+ { tag: tags.operator, color: "var(--primary-500)" },
146
+ { tag: tags.derefOperator, color: "var(--primary-500)" },
147
+ { tag: tags.arithmeticOperator, color: "var(--primary-500)" },
148
+ { tag: tags.logicOperator, color: "var(--primary-500)" },
149
+ { tag: tags.bitwiseOperator, color: "var(--primary-500)" },
150
+ { tag: tags.compareOperator, color: "var(--primary-500)" },
151
+ { tag: tags.updateOperator, color: "var(--primary-500)" },
152
+ { tag: tags.definitionOperator, color: "var(--primary-500)" },
153
+ { tag: tags.typeOperator, color: "var(--primary-500)" },
154
+ { tag: tags.controlOperator, color: "var(--primary-500)" },
155
+
156
+ { tag: tags.punctuation, color: "var(--neutrals-700)" },
157
+ { tag: tags.separator, color: "var(--neutrals-700)" },
158
+ { tag: tags.bracket, color: "var(--neutrals-700)" },
159
+ { tag: tags.angleBracket, color: "var(--neutrals-700)" },
160
+ { tag: tags.squareBracket, color: "var(--neutrals-700)" },
161
+ { tag: tags.paren, color: "var(--neutrals-700)" },
162
+ { tag: tags.brace, color: "var(--neutrals-700)" },
163
+
164
+ { tag: tags.content, color: "var(--neutrals-900)" },
165
+
166
+ { tag: tags.heading, color: "var(--primary-700)" },
167
+ { tag: tags.heading1, color: "var(--primary-800)" },
168
+ { tag: tags.heading2, color: "var(--primary-700)" },
169
+ { tag: tags.heading3, color: "var(--primary-600)" },
170
+ { tag: tags.heading4, color: "var(--primary-500)" },
171
+ { tag: tags.heading5, color: "var(--primary-400)" },
172
+ { tag: tags.heading6, color: "var(--primary-300)" },
173
+
174
+ { tag: tags.contentSeparator, color: "var(--neutrals-300)" },
175
+
176
+ { tag: tags.list, color: "var(--neutrals-900)" },
177
+ { tag: tags.quote, color: "var(--neutrals-700)" },
178
+
179
+ { tag: tags.emphasis, color: "var(--primary-500)" },
180
+ { tag: tags.strong, color: "var(--primary-700)" },
181
+
182
+ { tag: tags.link, color: "var(--accent-500)" },
183
+
184
+ { tag: tags.monospace, color: "var(--neutrals-900)" },
185
+
186
+ { tag: tags.strikethrough, color: "var(--danger-500)" },
187
+
188
+ { tag: tags.inserted, color: "var(--success-500)" },
189
+ { tag: tags.deleted, color: "var(--danger-500)" },
190
+ { tag: tags.changed, color: "var(--warning-500)" },
191
+
192
+ { tag: tags.invalid, color: "var(--danger-700)" },
193
+
194
+ { tag: tags.meta, color: "var(--neutrals-600)" },
195
+ { tag: tags.documentMeta, color: "var(--neutrals-600)" },
196
+ { tag: tags.annotation, color: "var(--neutrals-600)" },
197
+ { tag: tags.processingInstruction, color: "var(--neutrals-600)" },
198
+ ];
199
+
200
+ const myHighlightStyle = HighlightStyle.define(tagColors);
201
+
202
+ const toolbars: ComputedRef<ToolbarNames[]> = computed(() =>
203
+ props.disabled
204
+ ? []
205
+ : props.toolbar
206
+ ? props.toolbar
207
+ : [
208
+ "bold",
209
+ "underline",
210
+ "italic",
211
+ "-",
212
+ "title",
213
+ "strikeThrough",
214
+ "quote",
215
+ "unorderedList",
216
+ "orderedList",
217
+ "-",
218
+ "link",
219
+ "image",
220
+ "table",
221
+ "-",
222
+ "revoke",
223
+ "next",
224
+ "-",
225
+ "pageFullscreen",
226
+ "fullscreen",
227
+ "preview",
228
+ "previewOnly",
229
+ ],
230
+ );
231
+
232
+ config({
233
+ codeMirrorExtensions: (theme, extensions) => {
234
+ return [syntaxHighlighting(myHighlightStyle), ...extensions];
235
+ },
236
+ editorConfig: {
237
+ languageUserDefined: {
238
+ any: reactiveComputed(() => ({
239
+ toolbarTips: {
240
+ bold: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.BOLD"),
241
+ underline: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.UNDERLINE"),
242
+ italic: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.ITALIC"),
243
+ strikeThrough: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.STRIKE_THROUGH"),
244
+ title: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.TITLE"),
245
+ sub: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.SUB"),
246
+ sup: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.SUP"),
247
+ quote: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.QUOTE"),
248
+ unorderedList: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.UNORDERED_LIST"),
249
+ orderedList: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.ORDERED_LIST"),
250
+ task: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.TASK"),
251
+ codeRow: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.CODE_ROW"),
252
+ code: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.CODE"),
253
+ link: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.LINK"),
254
+ image: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.IMAGE"),
255
+ table: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.TABLE"),
256
+ mermaid: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.MERMAID"),
257
+ katex: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.KATEX"),
258
+ revoke: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.REVOKE"),
259
+ next: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.NEXT"),
260
+ save: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.SAVE"),
261
+ prettier: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.PRETTIER"),
262
+ pageFullscreen: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.PAGE_FULLSCREEN"),
263
+ fullscreen: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.FULLSCREEN"),
264
+ preview: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.PREVIEW"),
265
+ previewOnly: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.PREVIEW_ONLY"),
266
+ htmlPreview: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.HTML_PREVIEW"),
267
+ catalog: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.CATALOG"),
268
+ github: t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.GITHUB"),
269
+ "-": t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.DASH"),
270
+ "=": t("COMPONENTS.MOLECULES.VC_EDITOR.TOOLBAR_TIPS.EQUALS"),
271
+ },
272
+ titleItem: {
273
+ h1: t("COMPONENTS.MOLECULES.VC_EDITOR.TITLE_ITEM.H1"),
274
+ h2: t("COMPONENTS.MOLECULES.VC_EDITOR.TITLE_ITEM.H2"),
275
+ h3: t("COMPONENTS.MOLECULES.VC_EDITOR.TITLE_ITEM.H3"),
276
+ h4: t("COMPONENTS.MOLECULES.VC_EDITOR.TITLE_ITEM.H4"),
277
+ h5: t("COMPONENTS.MOLECULES.VC_EDITOR.TITLE_ITEM.H5"),
278
+ h6: t("COMPONENTS.MOLECULES.VC_EDITOR.TITLE_ITEM.H6"),
279
+ },
280
+ imgTitleItem: {
281
+ link: t("COMPONENTS.MOLECULES.VC_EDITOR.IMG_TITLE_ITEM.LINK"),
282
+ upload: t("COMPONENTS.MOLECULES.VC_EDITOR.IMG_TITLE_ITEM.UPLOAD"),
283
+ clip2upload: t("COMPONENTS.MOLECULES.VC_EDITOR.IMG_TITLE_ITEM.CLIP2UPLOAD"),
284
+ },
285
+ linkModalTips: {
286
+ linkTitle: t("COMPONENTS.MOLECULES.VC_EDITOR.LINK_MODAL_TIPS.LINK_TITLE"),
287
+ imageTitle: t("COMPONENTS.MOLECULES.VC_EDITOR.LINK_MODAL_TIPS.IMAGE_TITLE"),
288
+ descLabel: t("COMPONENTS.MOLECULES.VC_EDITOR.LINK_MODAL_TIPS.DESC_LABEL"),
289
+ descLabelPlaceHolder: t("COMPONENTS.MOLECULES.VC_EDITOR.LINK_MODAL_TIPS.DESC_LABEL_PLACEHOLDER"),
290
+ urlLabel: t("COMPONENTS.MOLECULES.VC_EDITOR.LINK_MODAL_TIPS.URL_LABEL"),
291
+ urlLabelPlaceHolder: t("COMPONENTS.MOLECULES.VC_EDITOR.LINK_MODAL_TIPS.URL_LABEL_PLACEHOLDER"),
292
+ buttonOK: t("COMPONENTS.MOLECULES.VC_EDITOR.LINK_MODAL_TIPS.BUTTON_OK"),
293
+ },
294
+ clipModalTips: {
295
+ title: t("COMPONENTS.MOLECULES.VC_EDITOR.CLIP_MODAL_TIPS.TITLE"),
296
+ buttonUpload: t("COMPONENTS.MOLECULES.VC_EDITOR.CLIP_MODAL_TIPS.BUTTON_UPLOAD"),
297
+ },
298
+ copyCode: {
299
+ text: t("COMPONENTS.MOLECULES.VC_EDITOR.COPY_CODE.TEXT"),
300
+ successTips: t("COMPONENTS.MOLECULES.VC_EDITOR.COPY_CODE.SUCCESS_TIPS"),
301
+ failTips: t("COMPONENTS.MOLECULES.VC_EDITOR.COPY_CODE.FAIL_TIPS"),
302
+ },
303
+ mermaid: {
304
+ flow: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.FLOW"),
305
+ sequence: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.SEQUENCE"),
306
+ gantt: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.GANTT"),
307
+ class: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.CLASS"),
308
+ state: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.STATE"),
309
+ pie: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.PIE"),
310
+ relationship: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.RELATIONSHIP"),
311
+ journey: t("COMPONENTS.MOLECULES.VC_EDITOR.MERMAID.JOURNEY"),
312
+ },
313
+ katex: {
314
+ inline: t("COMPONENTS.MOLECULES.VC_EDITOR.KATEX.INLINE"),
315
+ block: t("COMPONENTS.MOLECULES.VC_EDITOR.KATEX.BLOCK"),
316
+ },
317
+ footer: {
318
+ markdownTotal: t("COMPONENTS.MOLECULES.VC_EDITOR.FOOTER.MARKDOWN_TOTAL"),
319
+ scrollAuto: t("COMPONENTS.MOLECULES.VC_EDITOR.FOOTER.SCROLL_AUTO"),
320
+ },
321
+ })),
136
322
  },
137
323
  },
138
- };
139
-
140
- onMounted(() => {
141
- removeBlankClass();
142
324
  });
143
325
 
144
- onUpdated(() => {
145
- removeBlankClass();
326
+ const model = computed({
327
+ get() {
328
+ return props.modelValue;
329
+ },
330
+ set(value) {
331
+ emit("update:modelValue", value);
332
+ },
146
333
  });
147
334
 
148
- function initializeQuill() {
149
- quill.value = quillRef.value?.getQuill();
150
- if (props.modelValue) {
151
- quill.value.root.innerHTML = DOMPurify.sanitize(unref(props.modelValue));
152
- }
335
+ async function onUploadImage(files: File[], callback: (urls: string[]) => void) {
336
+ const formData = new FormData();
153
337
 
154
- quill.value.on("text-change", onTextChange);
155
- }
338
+ files.forEach((file) => {
339
+ formData.append("image", file);
340
+ });
156
341
 
157
- function removeBlankClass() {
158
- // fixes quill editor placeholder visibility issue when content is not empty
159
- const editor = document.getElementById(id)?.querySelector(".ql-editor.ql-blank");
160
- if (editor && props.modelValue) {
161
- editor.classList.remove("ql-blank");
162
- }
163
- }
342
+ const result = await fetch(`/api/assets?folderUrl=/${props.assetsFolder}`, {
343
+ method: "POST",
344
+ body: formData,
345
+ });
164
346
 
165
- function onTextChange() {
166
- const len = quill.value.getLength();
167
- if (props.maxlength !== undefined && len > props.maxlength) {
168
- quill.value.deleteText(props.maxlength, len);
169
- }
347
+ console.log(result);
170
348
 
171
- if (quill.value.getText().trim() !== props.modelValue?.trim()) {
172
- if (quill.value.root.innerHTML === "<p><br></p>") {
173
- emit("update:modelValue", "");
174
- } else {
175
- const sanitizedContent = DOMPurify.sanitize(quill.value.root.innerHTML);
176
- emit("update:modelValue", sanitizedContent);
177
- }
178
- }
349
+ const response = await result.json();
350
+
351
+ callback(
352
+ response.map((item: any) => ({
353
+ url: item.url,
354
+ alt: item.name,
355
+ title: item.name,
356
+ })),
357
+ );
358
+ }
359
+
360
+ function sanitize(html: string) {
361
+ return DOMPurify.sanitize(html);
179
362
  }
180
363
 
181
364
  defineExpose({
182
- quillRef,
365
+ editorRef,
183
366
  });
184
367
  </script>
185
368
 
@@ -194,73 +377,46 @@ defineExpose({
194
377
  }
195
378
 
196
379
  .vc-editor {
197
- & {
198
- @apply tw-flex tw-flex-col;
199
- }
380
+ @apply tw-flex tw-flex-col;
200
381
 
201
- &--disabled {
202
- @apply tw-opacity-50 tw-cursor-not-allowed;
382
+ &--error {
383
+ .md-editor {
384
+ @apply tw-border-[color:var(--editor-border-color-error)];
385
+ }
203
386
  }
204
387
 
205
388
  &__label {
206
389
  @apply tw-mb-2;
207
390
  }
208
391
 
209
- &__quill-editor {
210
- @apply tw-border tw-border-solid tw-border-[color:var(--editor-border-color)] tw-rounded-b-[var(--editor-border-radius)] tw-h-[200px];
211
- transition:
212
- background 0.3s,
213
- color 0.3s,
214
- cursor 0.3s;
215
-
216
- &--disabled {
217
- @apply tw-bg-[color:var(--editor-disabled-bg)] tw-text-[color:var(--editor-disabled-text)] tw-cursor-default;
218
- }
219
-
220
- &.vc-editor--error {
221
- @apply tw-border-[color:var(--editor-border-color-error)];
222
- }
223
- }
224
-
225
392
  &__error {
226
393
  @apply tw-text-[color:var(--editor-border-color-error)] tw-mt-1;
227
394
  }
228
395
  }
229
396
 
230
- .quill-editor .ql-editor {
231
- &.ql-blank:before {
232
- color: var(--editor-placeholder-color);
233
- content: attr(data-placeholder);
234
- font-style: inherit;
235
- left: 15px;
236
- pointer-events: none;
237
- position: absolute;
238
- right: 15px;
239
- }
240
- }
241
-
242
- .quill-editor {
243
- & .ql-tooltip {
244
- display: flex;
245
- flex-flow: wrap;
246
-
247
- &.ql-hidden {
248
- display: none !important;
249
- }
250
- }
251
- }
252
-
253
- .ql-language.ql-picker .ql-picker-label:before {
254
- padding-right: 18px;
255
- content: attr(data-value);
256
- }
257
-
258
- .ql-language.ql-picker .ql-picker-item:before {
259
- content: attr(data-value);
397
+ .md-editor {
398
+ --md-color: var(--secondary-800);
399
+ --md-hover-color: var(--additional-950);
400
+ --md-bk-color: var(--additional-50);
401
+ --md-bk-color-outstand: var(--neutrals-100);
402
+ --md-bk-hover-color: var(--secondary-50);
403
+ --md-border-color: var(--neutrals-200);
404
+ --md-border-hover-color: var(--neutrals-400);
405
+ --md-border-active-color: var(--neutrals-400);
406
+ --md-modal-mask: rgba(0, 0, 0, 0.45);
407
+ --md-modal-shadow: 0px 6px 24px 2px rgba(0, 0, 0, 0.1);
408
+ --md-scrollbar-bg-color: var(--neutrals-200);
409
+ --md-scrollbar-thumb-color: rgba(0, 0, 0, 0.3);
410
+ --md-scrollbar-thumb-hover-color: rgba(0, 0, 0, 0.35);
411
+ --md-scrollbar-thumb-active-color: rgba(0, 0, 0, 0.38);
412
+ color: var(--md-color);
413
+ font-family: inherit;
414
+ border: 1px solid var(--md-border-color);
415
+ background-color: var(--md-bk-color);
416
+ height: 350px;
260
417
  }
261
418
 
262
- .ql-toolbar,
263
- .quill-editor {
264
- border-color: var(--editor-border-color) !important;
419
+ .ͼ15 {
420
+ color: var(--secondary-900);
265
421
  }
266
422
  </style>
@@ -34,7 +34,7 @@
34
34
  @click="toggleMenu"
35
35
  >
36
36
  <VcIcon
37
- icon="fas fa-bars"
37
+ :icon="isExpanded ? 'fas fa-angle-double-left' : 'fas fa-angle-double-right'"
38
38
  size="xl"
39
39
  ></VcIcon>
40
40
  </button>
@@ -248,7 +248,7 @@ const emit = defineEmits<{
248
248
  "update:model-value": [data: { readonly value: any; readonly dictionary?: any[]; readonly locale?: string }];
249
249
  }>();
250
250
 
251
- const { locale, te, t } = useI18n({ useScope: "global" });
251
+ const { te, t } = useI18n({ useScope: "global" });
252
252
 
253
253
  const items: Ref<any[]> = ref([]);
254
254
  const loading = ref(false);
@@ -294,8 +294,8 @@ const computedProperty = computed(() => {
294
294
  }
295
295
 
296
296
  const propertyDisplayName =
297
- props.displayNames?.find((displayName) => displayName.languageCode?.startsWith(locale.value as string))?.name ||
298
- props.name;
297
+ props.displayNames?.find((displayName) => displayName.languageCode?.startsWith(props.currentLanguage as string))
298
+ ?.name || props.name;
299
299
  const propertyDisplayNameLocalized =
300
300
  propertyDisplayName && te(propertyDisplayName.toUpperCase())
301
301
  ? t(propertyDisplayName.toUpperCase())