hy-dispatch-ui-v3 0.2.80 → 0.2.82

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 (30) hide show
  1. package/dist/tailwind.css +71 -13
  2. package/es/api/file.mjs +19 -0
  3. package/es/bussiness/hyDisplayQueryAddress/displayQueryAddress2.vue.mjs +1 -1
  4. package/es/components/hyKindEditor/index.mjs +7 -0
  5. package/es/components/hyKindEditor/kindEditor.vue.mjs +285 -0
  6. package/es/components/hyKindEditor/style/kindEditor.scss +18 -0
  7. package/es/components/hyUserAvatar/style/userAvatar.scss +18 -15
  8. package/es/components/hyUserAvatar/userAvatar.vue.mjs +157 -53
  9. package/es/components/index.mjs +1 -0
  10. package/es/index.mjs +2 -1
  11. package/es/static/hy-svg-icons/hy-icon-dispatch-share1-user-high.js +16 -0
  12. package/es/static/hy-svg-icons/hy-icon-dispatch-share1-user-off.js +20 -0
  13. package/es/utils/file.mjs +7 -1
  14. package/es/utils/index.mjs +1 -1
  15. package/es/version.mjs +1 -1
  16. package/lib/api/file.js +21 -0
  17. package/lib/bussiness/hyDisplayQueryAddress/displayQueryAddress2.vue.js +1 -1
  18. package/lib/components/hyKindEditor/index.js +12 -0
  19. package/lib/components/hyKindEditor/kindEditor.vue.js +289 -0
  20. package/lib/components/hyKindEditor/style/kindEditor.scss +18 -0
  21. package/lib/components/hyUserAvatar/style/userAvatar.scss +18 -15
  22. package/lib/components/hyUserAvatar/userAvatar.vue.js +156 -52
  23. package/lib/components/index.js +32 -30
  24. package/lib/index.js +51 -48
  25. package/lib/static/hy-svg-icons/hy-icon-dispatch-share1-user-high.js +16 -0
  26. package/lib/static/hy-svg-icons/hy-icon-dispatch-share1-user-off.js +20 -0
  27. package/lib/utils/file.js +7 -0
  28. package/lib/utils/index.js +1 -0
  29. package/lib/version.js +1 -1
  30. package/package.json +3 -1
package/dist/tailwind.css CHANGED
@@ -277,6 +277,10 @@
277
277
  z-index: 50;
278
278
  }
279
279
 
280
+ .z-\[10000\] {
281
+ z-index: 10000;
282
+ }
283
+
280
284
  .z-\[1\] {
281
285
  z-index: 1;
282
286
  }
@@ -703,6 +707,10 @@
703
707
  height: 32px;
704
708
  }
705
709
 
710
+ .h-\[33\%\] {
711
+ height: 33%;
712
+ }
713
+
706
714
  .h-\[34px\] {
707
715
  height: 34px;
708
716
  }
@@ -747,6 +755,10 @@
747
755
  height: 48px;
748
756
  }
749
757
 
758
+ .h-\[50\%\] {
759
+ height: 50%;
760
+ }
761
+
750
762
  .h-\[500px\] {
751
763
  height: 500px;
752
764
  }
@@ -887,6 +899,10 @@
887
899
  width: 80px !important;
888
900
  }
889
901
 
902
+ .\!w-full {
903
+ width: 100% !important;
904
+ }
905
+
890
906
  .w-0 {
891
907
  width: 0px;
892
908
  }
@@ -979,6 +995,10 @@
979
995
  width: 32px;
980
996
  }
981
997
 
998
+ .w-\[33\%\] {
999
+ width: 33%;
1000
+ }
1001
+
982
1002
  .w-\[38px\] {
983
1003
  width: 38px;
984
1004
  }
@@ -991,6 +1011,10 @@
991
1011
  width: 42px;
992
1012
  }
993
1013
 
1014
+ .w-\[50\%\] {
1015
+ width: 50%;
1016
+ }
1017
+
994
1018
  .w-\[54px\] {
995
1019
  width: 54px;
996
1020
  }
@@ -1144,6 +1168,10 @@
1144
1168
  flex-wrap: wrap;
1145
1169
  }
1146
1170
 
1171
+ .content-center {
1172
+ align-content: center;
1173
+ }
1174
+
1147
1175
  .items-center {
1148
1176
  align-items: center;
1149
1177
  }
@@ -1279,6 +1307,10 @@
1279
1307
  border-radius: 0.75rem;
1280
1308
  }
1281
1309
 
1310
+ .\!border-0 {
1311
+ border-width: 0px !important;
1312
+ }
1313
+
1282
1314
  .border {
1283
1315
  border-width: 1px;
1284
1316
  }
@@ -1353,6 +1385,10 @@
1353
1385
  border-color: rgb(var(--hy-theme), var(--tw-border-opacity, 1));
1354
1386
  }
1355
1387
 
1388
+ .border-theme\/20 {
1389
+ border-color: rgb(var(--hy-theme), 0.2);
1390
+ }
1391
+
1356
1392
  .border-transparent {
1357
1393
  border-color: transparent;
1358
1394
  }
@@ -1371,6 +1407,11 @@
1371
1407
  background-color: rgb(var(--hy-background), var(--tw-bg-opacity, 1)) !important;
1372
1408
  }
1373
1409
 
1410
+ .\!bg-background-3 {
1411
+ --tw-bg-opacity: 1 !important;
1412
+ background-color: rgb(var(--hy-background-3), var(--tw-bg-opacity, 1)) !important;
1413
+ }
1414
+
1374
1415
  .bg-\[\#3D6286\] {
1375
1416
  --tw-bg-opacity: 1;
1376
1417
  background-color: rgb(61 98 134 / var(--tw-bg-opacity, 1));
@@ -1462,6 +1503,10 @@
1462
1503
  background-color: rgb(var(--hy-theme), var(--tw-bg-opacity, 1));
1463
1504
  }
1464
1505
 
1506
+ .bg-theme\/20 {
1507
+ background-color: rgb(var(--hy-theme), 0.2);
1508
+ }
1509
+
1465
1510
  .bg-warning {
1466
1511
  --tw-bg-opacity: 1;
1467
1512
  background-color: rgb(var(--hy-warning), var(--tw-bg-opacity, 1));
@@ -1491,6 +1536,10 @@
1491
1536
  padding: 1.25rem;
1492
1537
  }
1493
1538
 
1539
+ .p-\[0\.3\%\] {
1540
+ padding: 0.3%;
1541
+ }
1542
+
1494
1543
  .p-\[10px\] {
1495
1544
  padding: 10px;
1496
1545
  }
@@ -1503,16 +1552,15 @@
1503
1552
  padding: 1px;
1504
1553
  }
1505
1554
 
1555
+ .p-\[2\%\] {
1556
+ padding: 2%;
1557
+ }
1558
+
1506
1559
  .px-0 {
1507
1560
  padding-left: 0px;
1508
1561
  padding-right: 0px;
1509
1562
  }
1510
1563
 
1511
- .px-1 {
1512
- padding-left: 0.25rem;
1513
- padding-right: 0.25rem;
1514
- }
1515
-
1516
1564
  .px-1\.5 {
1517
1565
  padding-left: 0.375rem;
1518
1566
  padding-right: 0.375rem;
@@ -1588,6 +1636,11 @@
1588
1636
  padding-bottom: 0.25rem;
1589
1637
  }
1590
1638
 
1639
+ .py-1\.5 {
1640
+ padding-top: 0.375rem;
1641
+ padding-bottom: 0.375rem;
1642
+ }
1643
+
1591
1644
  .py-2 {
1592
1645
  padding-top: 0.5rem;
1593
1646
  padding-bottom: 0.5rem;
@@ -1783,8 +1836,8 @@
1783
1836
  line-height: 1rem;
1784
1837
  }
1785
1838
 
1786
- .font-\[600\] {
1787
- font-weight: 600;
1839
+ .\!font-\[100\] {
1840
+ font-weight: 100 !important;
1788
1841
  }
1789
1842
 
1790
1843
  .font-bold {
@@ -1892,9 +1945,9 @@
1892
1945
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1893
1946
  }
1894
1947
 
1895
- .shadow-\[0_0_4px_0\] {
1896
- --tw-shadow: 0 0 4px 0;
1897
- --tw-shadow-colored: 0 0 4px 0 var(--tw-shadow-color);
1948
+ .shadow-\[0_0_4px_1px\] {
1949
+ --tw-shadow: 0 0 4px 1px;
1950
+ --tw-shadow-colored: 0 0 4px 1px var(--tw-shadow-color);
1898
1951
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1899
1952
  }
1900
1953
 
@@ -1910,9 +1963,14 @@
1910
1963
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1911
1964
  }
1912
1965
 
1913
- .shadow-success {
1914
- --tw-shadow-color: rgb(var(--hy-success), 1);
1915
- --tw-shadow: var(--tw-shadow-colored);
1966
+ .\!shadow-success {
1967
+ --tw-shadow-color: rgb(var(--hy-success), 1) !important;
1968
+ --tw-shadow: var(--tw-shadow-colored) !important;
1969
+ }
1970
+
1971
+ .\!shadow-warning {
1972
+ --tw-shadow-color: rgb(var(--hy-warning), 1) !important;
1973
+ --tw-shadow: var(--tw-shadow-colored) !important;
1916
1974
  }
1917
1975
 
1918
1976
  .outline {
@@ -0,0 +1,19 @@
1
+ import { unref } from 'vue';
2
+ import '../hooks/index.mjs';
3
+ import { useApi } from '../hooks/useApi.mjs';
4
+
5
+ function preSignedUrlGetApi(params) {
6
+ return new Promise((resolve, reject) => {
7
+ const { api } = useApi();
8
+ const http = unref(api);
9
+ http.post("file/preSignedUrlGet", params, {
10
+ isJSON: true
11
+ }).then((res) => {
12
+ resolve(res);
13
+ }).catch((res) => {
14
+ resolve(res);
15
+ });
16
+ });
17
+ }
18
+
19
+ export { preSignedUrlGetApi };
@@ -156,7 +156,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
156
156
  )) : unref(lng) && unref(lat) ? (openBlock(), createElementBlock("div", {
157
157
  key: 1,
158
158
  onClick: withModifiers(($event) => unref(getAddress)(), ["stop"]),
159
- class: "w-full box-border text-center text-theme rounded border border-theme px-1 py-0.5 text-xs clickBox float-left"
159
+ class: "w-full box-border text-center border hover:border-theme border-theme/20 text-theme rounded bg-theme/20 px-2 py-1.5 text-xs clickBox float-left"
160
160
  }, toDisplayString(unref(getAddressType) ? $t$1("querying") : $t$1("queryAddress")), 9, ["onClick"])) : (openBlock(), createElementBlock(
161
161
  "span",
162
162
  {
@@ -0,0 +1,7 @@
1
+ import '../../utils/index.mjs';
2
+ import _sfc_main from './kindEditor.vue.mjs';
3
+ import { withInstall } from '../../utils/handler.mjs';
4
+
5
+ const HyKindEditor = withInstall(_sfc_main);
6
+
7
+ export { HyKindEditor, HyKindEditor as default };
@@ -0,0 +1,285 @@
1
+ import { defineComponent, useModel, shallowRef, computed, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, createBlock, unref, createCommentVNode, createVNode, normalizeStyle, mergeModels } from 'vue';
2
+ import { ElMessage } from 'element-plus';
3
+ import { Toolbar, Editor } from '@wangeditor/editor-for-vue';
4
+ import { SlateTransforms } from '@wangeditor/editor';
5
+ import '../../utils/index.mjs';
6
+ import { preSignedUrlGetApi, fileUpload } from '../../utils/file.mjs';
7
+
8
+ import "@wangeditor/editor/dist/css/style.css";
9
+
10
+ import "./style/kindEditor.scss";
11
+
12
+ const __default__ = defineComponent({
13
+ name: "HyKindEditor"
14
+ });
15
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
16
+ props: /* @__PURE__ */ mergeModels({
17
+ mode: { type: String, default: "default" },
18
+ // 'default' | 'simple'
19
+ height: { type: [String, Number], default: 300 },
20
+ // 编辑区高度
21
+ placeholder: { type: String, default: "\u8BF7\u8F93\u5165\u5185\u5BB9..." },
22
+ disabled: { type: Boolean, default: false },
23
+ // 只读
24
+ showToolbar: { type: Boolean, default: true },
25
+ toolbarConfig: { type: Object, default: () => ({}) },
26
+ // 透传 wangEditor toolbarConfig
27
+ editorConfig: { type: Object, default: () => ({}) },
28
+ // 透传 wangEditor editorConfig
29
+ maxImageSize: { type: Number, default: 10 },
30
+ // 图片大小限制,单位 MB
31
+ maxVideoSize: { type: Number, default: 100 },
32
+ // 视频大小限制,单位 MB
33
+ pasteImageFilter: { type: Function }
34
+ // (src: string) => boolean,返回 false 的图片不转存(如自家 OSS 域名)
35
+ }, {
36
+ "modelValue": { type: String, default: "" },
37
+ "modelModifiers": {}
38
+ }),
39
+ emits: /* @__PURE__ */ mergeModels(["created", "change", "focus", "blur"], ["update:modelValue"]),
40
+ setup(__props, { expose: __expose, emit: __emit }) {
41
+ const props = __props;
42
+ const emits = __emit;
43
+ const modelValue = useModel(__props, "modelValue");
44
+ const editorRef = shallowRef();
45
+ const editorHeight = computed(() => typeof props.height === "number" ? `${props.height}px` : props.height);
46
+ const fileURLList = [];
47
+ const rememberFile = ({ key, url }) => {
48
+ if (!key || !url) return;
49
+ if (fileURLList.some((item) => item.url === url)) return;
50
+ fileURLList.push({ key, url });
51
+ };
52
+ const isKnownUrl = (url) => fileURLList.some((item) => item.url === url);
53
+ const getMediaSrcList = (html) => {
54
+ const list = [];
55
+ const tags = html.match(/<(img|video|source)\b[^>]*>/gi) || [];
56
+ tags.forEach((tag) => {
57
+ for (const [, value] of tag.matchAll(/\s(?:src|poster)="([^"]*)"/gi)) {
58
+ value && list.push(value);
59
+ }
60
+ });
61
+ return [...new Set(list)];
62
+ };
63
+ const isUrl = (value) => /^(https?:|blob:|data:)/i.test(value);
64
+ const replaceSrc = (html, from, to) => html.replaceAll(`"${from}"`, `"${to}"`);
65
+ const keyToUrl = async (html) => {
66
+ if (!html) return "";
67
+ const keyList = getMediaSrcList(html).filter((value) => !isUrl(value));
68
+ if (!keyList.length) return html;
69
+ try {
70
+ const res = await preSignedUrlGetApi(keyList);
71
+ const data = res?.data || [];
72
+ data.forEach(({ key, url }) => {
73
+ if (!key || !url) return;
74
+ html = replaceSrc(html, key, url);
75
+ rememberFile({ key, url });
76
+ });
77
+ const failCount = keyList.filter((key) => !data.some((item) => item.key === key && item.url)).length;
78
+ if (failCount) {
79
+ ElMessage.warning(`\u5185\u5BB9\u4E2D\u6709 ${failCount} \u4E2A\u56FE\u7247/\u89C6\u9891\u52A0\u8F7D\u5931\u8D25`);
80
+ }
81
+ } catch (e) {
82
+ console.warn("[HyKindEditor] key \u6362 url \u5931\u8D25\uFF0C\u4FDD\u7559\u539F\u5185\u5BB9", e);
83
+ ElMessage.error(e?.msg || e?.message || "\u5185\u5BB9\u4E2D\u7684\u56FE\u7247/\u89C6\u9891\u52A0\u8F7D\u5931\u8D25");
84
+ }
85
+ return html;
86
+ };
87
+ const urlToKey = (html) => {
88
+ if (!html) return "";
89
+ fileURLList.forEach(({ key, url }) => {
90
+ html = replaceSrc(html, url, key);
91
+ });
92
+ return html;
93
+ };
94
+ const FILE_TYPES = {
95
+ image: {
96
+ name: "\u56FE\u7247",
97
+ types: ["image/jpeg", "image/png", "image/gif", "image/bmp", "image/webp"],
98
+ typesText: "jpg\u3001png\u3001gif\u3001bmp\u3001webp",
99
+ getMaxSize: () => props.maxImageSize
100
+ },
101
+ video: {
102
+ name: "\u89C6\u9891",
103
+ types: ["video/*"],
104
+ getMaxSize: () => props.maxVideoSize
105
+ }
106
+ };
107
+ const isAllowedType = (file, types) => types.some((type) => type.endsWith("/*") ? file.type.startsWith(type.slice(0, -1)) : file.type === type);
108
+ const checkFile = (file, fileType) => {
109
+ const { name, types, typesText, getMaxSize } = FILE_TYPES[fileType];
110
+ if (!isAllowedType(file, types)) {
111
+ throw new Error(typesText ? `${name}\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u4EC5\u652F\u6301 ${typesText}` : `\u8BF7\u9009\u62E9${name}\u6587\u4EF6`);
112
+ }
113
+ if (file.size === 0) {
114
+ throw new Error("\u65E0\u6CD5\u53D1\u9001\u7A7A\u6587\u4EF6(0KB)\uFF0C\u8BF7\u9009\u62E9\u5305\u542B\u5185\u5BB9\u7684\u6587\u4EF6");
115
+ }
116
+ const maxSize = getMaxSize();
117
+ if (file.size / 1024 / 1024 > maxSize) {
118
+ throw new Error(`\u4E0A\u4F20\u7684\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236(${maxSize}MB)`);
119
+ }
120
+ };
121
+ const uploadFile = async (file, fileType) => {
122
+ checkFile(file, fileType);
123
+ const fileUploadRes = await fileUpload(file);
124
+ if (fileUploadRes?.code !== 200) throw fileUploadRes;
125
+ const preSignedUrlGetApiRes = await preSignedUrlGetApi([fileUploadRes.data.key]);
126
+ const item = preSignedUrlGetApiRes?.data?.[0];
127
+ if (!item?.url) throw new Error("\u83B7\u53D6\u6587\u4EF6\u5730\u5740\u5931\u8D25");
128
+ rememberFile(item);
129
+ return item.url;
130
+ };
131
+ const createUploader = (fileType) => ({
132
+ allowedFileTypes: FILE_TYPES[fileType].types,
133
+ async customUpload(file, insertFn) {
134
+ try {
135
+ insertFn(await uploadFile(file, fileType));
136
+ } catch (e) {
137
+ ElMessage.error(e?.msg || e?.message || `${FILE_TYPES[fileType].name}\u4E0A\u4F20\u5931\u8D25`);
138
+ }
139
+ }
140
+ });
141
+ const DEFAULT_EXCLUDE_KEYS = ["emotion", "insertLink", "insertImage", "insertVideo", "fullScreen"];
142
+ const toolbarOptions = computed(() => {
143
+ const { excludeKeys = [], ...rest } = props.toolbarConfig;
144
+ return {
145
+ ...rest,
146
+ excludeKeys: [.../* @__PURE__ */ new Set([...DEFAULT_EXCLUDE_KEYS, ...excludeKeys])]
147
+ };
148
+ });
149
+ const getPasteImageSrcs = (html) => {
150
+ if (!html || !/<img/i.test(html)) return [];
151
+ const doc = new DOMParser().parseFromString(html, "text/html");
152
+ const srcs = [...doc.querySelectorAll("img")].map((img) => img.getAttribute("src") || "");
153
+ return [...new Set(srcs)].filter(
154
+ (src) => /^(https?:|data:image\/)/i.test(src) && !isKnownUrl(src) && (!props.pasteImageFilter || props.pasteImageFilter(src) !== false)
155
+ );
156
+ };
157
+ const srcToFile = async (src) => {
158
+ const res = await fetch(src, { mode: "cors", credentials: "omit" }).catch(() => {
159
+ throw new Error("\u6765\u6E90\u7F51\u7AD9\u4E0D\u5141\u8BB8\u4E0B\u8F7D\u8BE5\u56FE\u7247");
160
+ });
161
+ if (!res.ok) throw new Error(`\u4E0B\u8F7D\u5931\u8D25\uFF1A${res.status}`);
162
+ const blob = await res.blob();
163
+ const ext = blob.type.split("/")[1]?.split("+")[0] || "png";
164
+ return new File([blob], `paste-${Date.now()}.${ext}`, { type: blob.type });
165
+ };
166
+ const updateImage = (oldSrc, attrs) => {
167
+ const editor = editorRef.value;
168
+ if (!editor || editor.isDestroyed) return;
169
+ SlateTransforms.setNodes(editor, attrs, {
170
+ at: [],
171
+ voids: true,
172
+ match: (node) => node.type === "image" && node.src === oldSrc
173
+ });
174
+ };
175
+ const hasImageInEditor = (src) => !!editorRef.value?.getElemsByType("image").some((node) => node.src === src);
176
+ const transferPasteImages = async (pasteSrcs) => {
177
+ const srcs = pasteSrcs.filter(hasImageInEditor);
178
+ const reasons = [];
179
+ await Promise.all(
180
+ srcs.map(async (src) => {
181
+ try {
182
+ const url = await uploadFile(await srcToFile(src), "image");
183
+ updateImage(src, { src: url });
184
+ } catch (e) {
185
+ reasons.push(e?.msg || e?.message || "\u672A\u77E5\u539F\u56E0");
186
+ updateImage(src, { src: "", alt: "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25" });
187
+ console.warn("[HyKindEditor] \u7C98\u8D34\u56FE\u7247\u8F6C\u5B58\u5931\u8D25\uFF0C\u5DF2\u6E05\u7A7A\u5730\u5740\uFF1A", src, e);
188
+ }
189
+ })
190
+ );
191
+ if (reasons.length) {
192
+ ElMessage.error(`${reasons.length} \u5F20\u7C98\u8D34\u7684\u56FE\u7247\u8F6C\u5B58\u5931\u8D25\uFF08${reasons[0]}\uFF09\uFF0C\u8BF7\u91CD\u65B0\u4E0A\u4F20`);
193
+ }
194
+ };
195
+ const handleCustomPaste = (editor, event, callback) => {
196
+ if (props.editorConfig.customPaste?.(editor, event) === false) {
197
+ callback(false);
198
+ return;
199
+ }
200
+ const srcs = getPasteImageSrcs(event.clipboardData?.getData("text/html"));
201
+ srcs.length && setTimeout(() => transferPasteImages(srcs));
202
+ callback(true);
203
+ };
204
+ const DEFAULT_HOVERBAR_KEYS = {
205
+ image: { menuKeys: ["imageWidth30", "imageWidth50", "imageWidth100", "deleteImage"] }
206
+ };
207
+ const editorOptions = computed(() => {
208
+ const { MENU_CONF = {}, customPaste, hoverbarKeys = {}, ...rest } = props.editorConfig;
209
+ return {
210
+ placeholder: props.placeholder,
211
+ readOnly: props.disabled,
212
+ ...rest,
213
+ hoverbarKeys: { ...DEFAULT_HOVERBAR_KEYS, ...hoverbarKeys },
214
+ MENU_CONF: {
215
+ uploadImage: createUploader("image"),
216
+ uploadVideo: createUploader("video"),
217
+ ...MENU_CONF
218
+ }
219
+ };
220
+ });
221
+ const handleCreated = (editor) => {
222
+ editorRef.value = editor;
223
+ emits("created", editor);
224
+ };
225
+ watch(
226
+ () => props.disabled,
227
+ (val) => {
228
+ const editor = editorRef.value;
229
+ if (!editor) return;
230
+ val ? editor.disable() : editor.enable();
231
+ }
232
+ );
233
+ onBeforeUnmount(() => {
234
+ editorRef.value?.destroy();
235
+ editorRef.value = null;
236
+ });
237
+ __expose({
238
+ getEditor: () => editorRef.value,
239
+ getHtml: () => editorRef.value?.getHtml() ?? "",
240
+ getText: () => editorRef.value?.getText() ?? "",
241
+ isEmpty: () => editorRef.value?.isEmpty() ?? true,
242
+ clear: () => editorRef.value?.clear(),
243
+ focus: () => editorRef.value?.focus(),
244
+ insertHtml: (html) => editorRef.value?.dangerouslyInsertHtml(html),
245
+ // 回显:把内容中图片 / 视频的 key 换成 url,返回新内容
246
+ keyToUrl,
247
+ // 保存:把内容中图片 / 视频的 url 换回 key,返回新内容
248
+ urlToKey
249
+ });
250
+ return (_ctx, _cache) => {
251
+ return openBlock(), createElementBlock(
252
+ "div",
253
+ {
254
+ class: normalizeClass(["hy-kind-editor z-[10000]", { "is-disabled": __props.disabled }])
255
+ },
256
+ [
257
+ __props.showToolbar ? (openBlock(), createBlock(unref(Toolbar), {
258
+ key: 0,
259
+ class: "hy-kind-editor__toolbar",
260
+ editor: editorRef.value,
261
+ "default-config": toolbarOptions.value,
262
+ mode: __props.mode
263
+ }, null, 8, ["editor", "default-config", "mode"])) : createCommentVNode("v-if", true),
264
+ createVNode(unref(Editor), {
265
+ modelValue: modelValue.value,
266
+ "onUpdate:modelValue": ($event) => modelValue.value = $event,
267
+ class: "hy-kind-editor__content",
268
+ style: normalizeStyle({ height: editorHeight.value }),
269
+ "default-config": editorOptions.value,
270
+ mode: __props.mode,
271
+ onOnCreated: handleCreated,
272
+ onCustomPaste: handleCustomPaste,
273
+ onOnChange: (editor) => emits("change", editor),
274
+ onOnFocus: (editor) => emits("focus", editor),
275
+ onOnBlur: (editor) => emits("blur", editor)
276
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "style", "default-config", "mode", "onOnChange", "onOnFocus", "onOnBlur"])
277
+ ],
278
+ 2
279
+ /* CLASS */
280
+ );
281
+ };
282
+ }
283
+ });
284
+
285
+ export { _sfc_main as default };
@@ -0,0 +1,18 @@
1
+ .hy-kind-editor {
2
+ width: 100%;
3
+ border: 1px solid var(--el-border-color);
4
+ border-radius: var(--el-border-radius-base);
5
+ overflow: hidden;
6
+
7
+ &__toolbar {
8
+ border-bottom: 1px solid var(--el-border-color);
9
+ }
10
+
11
+ &__content {
12
+ overflow-y: hidden;
13
+ }
14
+
15
+ &.is-disabled {
16
+ background-color: var(--el-disabled-bg-color);
17
+ }
18
+ }
@@ -1,32 +1,35 @@
1
- .hy-user-avatar {
2
- background: rgb(var(--hy-background-2));
1
+ .hyUserAvatar {
2
+ container-type: inline-size;
3
+ background: rgba(var(--hy-background-2),1);
3
4
  position: relative;
4
- border: 1px solid rgb(var(--hy-main));
5
+ box-sizing: border-box;
5
6
  flex-shrink: 0;
6
- border-radius: 50%;
7
- .user-avatar {
7
+ border-radius: 10%;
8
+ .headPortrait {
8
9
  width: 100%;
9
10
  height: 100%;
10
- border-radius: 50%;
11
+ border-radius: 4%;
11
12
  overflow: hidden;
12
- display: flex;
13
- align-items: center;
14
- justify-content: center;
15
13
  img {
16
14
  height: 100%;
17
15
  }
18
16
  .svgBox {
19
- width: 90%;
20
- height: 90%;
21
- color: rgb(var(--hy-main));
17
+ width: 60%;
18
+ height: 60%;
22
19
  }
23
20
  }
24
- span {
21
+ .iconTypeBox {
25
22
  width: 32%;
26
23
  height: 32%;
27
24
  border-radius: 50%;
28
25
  position: absolute;
29
- bottom: -4%;
30
- right: -2%;
26
+ bottom: -10%;
27
+ right: -10%;
28
+ }
29
+ .nameText {
30
+ font-size: 100cqw;
31
+ transform: scale(0.4);
32
+ transform-origin: center;
33
+ white-space: nowrap;
31
34
  }
32
35
  }