@waline/client 2.6.1 → 2.6.2
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/component.esm.js +1 -1
- package/dist/component.esm.js.map +1 -1
- package/dist/component.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- package/dist/legacy.js +1 -1
- package/dist/legacy.js.map +1 -1
- package/dist/pageview.cjs.js +1 -1
- package/dist/pageview.cjs.js.map +1 -1
- package/dist/pageview.esm.js +1 -1
- package/dist/pageview.esm.js.map +1 -1
- package/dist/pageview.js +1 -1
- package/dist/pageview.js.map +1 -1
- package/dist/shim.d.ts +1 -0
- package/dist/shim.esm.d.ts +1 -0
- package/dist/shim.esm.js +1 -1
- package/dist/shim.esm.js.map +1 -1
- package/dist/shim.js +1 -1
- package/dist/shim.js.map +1 -1
- package/dist/waline.cjs.d.ts +1 -0
- package/dist/waline.cjs.js +1 -1
- package/dist/waline.cjs.js.map +1 -1
- package/dist/waline.css +1 -1
- package/dist/waline.css.map +1 -1
- package/dist/waline.d.ts +1 -0
- package/dist/waline.esm.d.ts +1 -0
- package/dist/waline.esm.js +1 -1
- package/dist/waline.esm.js.map +1 -1
- package/dist/waline.js +1 -1
- package/dist/waline.js.map +1 -1
- package/package.json +21 -21
- package/src/components/CommentBox.vue +48 -37
- package/src/components/CommentCard.vue +19 -17
- package/src/components/ImageWall.vue +2 -4
- package/src/composables/userInfo.ts +1 -1
- package/src/config/default.ts +2 -0
- package/src/config/i18n/en.ts +1 -0
- package/src/config/i18n/generate.ts +1 -0
- package/src/config/i18n/jp.ts +1 -0
- package/src/config/i18n/pt-BR.ts +1 -0
- package/src/config/i18n/ru.ts +1 -0
- package/src/config/i18n/vi-VN.ts +1 -0
- package/src/config/i18n/zh-CN.ts +1 -0
- package/src/config/i18n/zh-TW.ts +3 -2
- package/src/init.ts +0 -1
- package/src/styles/emoji.scss +4 -1
- package/src/styles/gif.scss +6 -5
- package/src/typings/locale.ts +1 -0
- package/src/utils/fetch.ts +3 -0
- package/src/utils/markedMathExtension.ts +1 -0
- package/LICENSE +0 -339
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waline/client",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "client for waline comment system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"valine",
|
|
@@ -56,6 +56,15 @@
|
|
|
56
56
|
"dist",
|
|
57
57
|
"src"
|
|
58
58
|
],
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "pnpm rollup && pnpm style",
|
|
61
|
+
"clean": "rimraf ./dist",
|
|
62
|
+
"dev": "vite -c config/vite.config.js",
|
|
63
|
+
"lint": "eslint --ext .ts,.vue .",
|
|
64
|
+
"prepublish": "pnpm clean && pnpm build",
|
|
65
|
+
"rollup": "rollup -c ./config/rollup.config.js",
|
|
66
|
+
"style": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed"
|
|
67
|
+
},
|
|
59
68
|
"browserslist": {
|
|
60
69
|
"production": [
|
|
61
70
|
">0.5%",
|
|
@@ -71,40 +80,31 @@
|
|
|
71
80
|
]
|
|
72
81
|
},
|
|
73
82
|
"dependencies": {
|
|
74
|
-
"@vueuse/core": "^8.
|
|
83
|
+
"@vueuse/core": "^8.9.4",
|
|
75
84
|
"autosize": "^5.0.1",
|
|
76
|
-
"marked": "^4.0.
|
|
85
|
+
"marked": "^4.0.18",
|
|
77
86
|
"vue": "^3.2.37"
|
|
78
87
|
},
|
|
79
88
|
"devDependencies": {
|
|
80
|
-
"@babel/core": "7.18.
|
|
81
|
-
"@babel/preset-env": "7.18.
|
|
89
|
+
"@babel/core": "7.18.9",
|
|
90
|
+
"@babel/preset-env": "7.18.9",
|
|
82
91
|
"@rollup/plugin-babel": "5.3.1",
|
|
83
|
-
"@rollup/plugin-commonjs": "22.0.
|
|
92
|
+
"@rollup/plugin-commonjs": "22.0.1",
|
|
84
93
|
"@rollup/plugin-node-resolve": "13.3.0",
|
|
85
94
|
"@rollup/plugin-replace": "4.0.0",
|
|
86
95
|
"@types/autosize": "4.0.1",
|
|
87
96
|
"@types/marked": "4.0.3",
|
|
88
|
-
"@types/node": "
|
|
89
|
-
"@vitejs/plugin-vue": "
|
|
97
|
+
"@types/node": "18.0.6",
|
|
98
|
+
"@vitejs/plugin-vue": "3.0.1",
|
|
90
99
|
"rimraf": "3.0.2",
|
|
91
|
-
"rollup": "2.
|
|
100
|
+
"rollup": "2.77.0",
|
|
92
101
|
"rollup-plugin-dts": "4.2.2",
|
|
93
102
|
"rollup-plugin-terser": "7.0.2",
|
|
94
103
|
"rollup-plugin-ts": "3.0.2",
|
|
95
|
-
"typescript": "4.7.
|
|
96
|
-
"vite": "
|
|
104
|
+
"typescript": "4.7.4",
|
|
105
|
+
"vite": "3.0.2"
|
|
97
106
|
},
|
|
98
107
|
"engines": {
|
|
99
108
|
"node": ">=14"
|
|
100
|
-
},
|
|
101
|
-
"scripts": {
|
|
102
|
-
"build": "pnpm rollup && pnpm style",
|
|
103
|
-
"clean": "rimraf ./dist",
|
|
104
|
-
"dev": "vite -c config/vite.config.js",
|
|
105
|
-
"lint": "eslint --ext .ts,.vue .",
|
|
106
|
-
"prepublish": "pnpm clean && pnpm build",
|
|
107
|
-
"rollup": "rollup -c ./config/rollup.config.js",
|
|
108
|
-
"style": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed"
|
|
109
109
|
}
|
|
110
|
-
}
|
|
110
|
+
}
|
|
@@ -6,12 +6,21 @@
|
|
|
6
6
|
<CloseIcon :size="14" />
|
|
7
7
|
</button>
|
|
8
8
|
|
|
9
|
-
<
|
|
9
|
+
<a
|
|
10
|
+
href="#"
|
|
11
|
+
class="wl-login-nick"
|
|
12
|
+
aria-label="Profile"
|
|
13
|
+
:title="locale.profile"
|
|
14
|
+
@click="onProfile"
|
|
15
|
+
>
|
|
16
|
+
<img :src="userInfo.avatar" alt="avatar" />
|
|
17
|
+
</a>
|
|
10
18
|
</div>
|
|
11
19
|
<a
|
|
12
20
|
href="#"
|
|
13
21
|
class="wl-login-nick"
|
|
14
22
|
aria-label="Profile"
|
|
23
|
+
:title="locale.profile"
|
|
15
24
|
@click="onProfile"
|
|
16
25
|
v-text="userInfo.display_name"
|
|
17
26
|
/>
|
|
@@ -22,7 +31,7 @@
|
|
|
22
31
|
v-if="config.login !== 'force' && config.meta.length && !isLogin"
|
|
23
32
|
:class="['wl-header', `item${config.meta.length}`]"
|
|
24
33
|
>
|
|
25
|
-
<div v-for="kind in config.meta" class="wl-header-item"
|
|
34
|
+
<div v-for="kind in config.meta" :key="kind" class="wl-header-item">
|
|
26
35
|
<label
|
|
27
36
|
:for="kind"
|
|
28
37
|
v-text="
|
|
@@ -33,34 +42,35 @@
|
|
|
33
42
|
"
|
|
34
43
|
/>
|
|
35
44
|
<input
|
|
45
|
+
:id="`wl-${kind}`"
|
|
36
46
|
:ref="
|
|
37
47
|
(element) => {
|
|
38
48
|
if (element) inputRefs[kind] = element as HTMLInputElement;
|
|
39
49
|
}
|
|
40
50
|
"
|
|
41
|
-
|
|
51
|
+
v-model="userMeta[kind]"
|
|
42
52
|
:class="['wl-input', `wl-${kind}`]"
|
|
43
53
|
:name="kind"
|
|
44
54
|
:type="kind === 'mail' ? 'email' : 'text'"
|
|
45
|
-
v-model="userMeta[kind]"
|
|
46
55
|
/>
|
|
47
56
|
</div>
|
|
48
57
|
</div>
|
|
49
58
|
|
|
50
59
|
<textarea
|
|
51
|
-
class="wl-editor"
|
|
52
|
-
ref="editorRef"
|
|
53
60
|
id="wl-edit"
|
|
54
|
-
|
|
61
|
+
ref="editorRef"
|
|
55
62
|
v-model="editor"
|
|
63
|
+
class="wl-editor"
|
|
64
|
+
:placeholder="replyUser ? `@${replyUser}` : locale.placeholder"
|
|
56
65
|
@keydown="onKeyDown"
|
|
57
66
|
@drop="onDrop"
|
|
58
67
|
@paste="onPaste"
|
|
59
68
|
/>
|
|
60
69
|
|
|
61
|
-
<div class="wl-preview"
|
|
70
|
+
<div v-show="showPreview" class="wl-preview">
|
|
62
71
|
<hr />
|
|
63
72
|
<h4>{{ locale.preview }}:</h4>
|
|
73
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
64
74
|
<div class="wl-content" v-html="previewText" />
|
|
65
75
|
</div>
|
|
66
76
|
|
|
@@ -100,9 +110,9 @@
|
|
|
100
110
|
</button>
|
|
101
111
|
|
|
102
112
|
<input
|
|
113
|
+
id="wl-image-upload"
|
|
103
114
|
ref="imageUploadRef"
|
|
104
115
|
class="upload"
|
|
105
|
-
id="wl-image-upload"
|
|
106
116
|
type="file"
|
|
107
117
|
accept=".png,.jpg,.jpeg,.webp,.bmp,.gif"
|
|
108
118
|
@change="onChange"
|
|
@@ -169,9 +179,9 @@
|
|
|
169
179
|
:class="{ display: showGif }"
|
|
170
180
|
>
|
|
171
181
|
<input
|
|
182
|
+
ref="gifSearchInputRef"
|
|
172
183
|
type="text"
|
|
173
184
|
:placeholder="locale.gifSearchPlaceholder"
|
|
174
|
-
ref="gifSearchInputRef"
|
|
175
185
|
@input="onGifSearch"
|
|
176
186
|
/>
|
|
177
187
|
|
|
@@ -193,10 +203,13 @@
|
|
|
193
203
|
class="wl-emoji-popup"
|
|
194
204
|
:class="{ display: showEmoji }"
|
|
195
205
|
>
|
|
196
|
-
<template
|
|
206
|
+
<template
|
|
207
|
+
v-for="(emojiItem, index) in emoji.tabs"
|
|
208
|
+
:key="emojiItem.name"
|
|
209
|
+
>
|
|
197
210
|
<div v-if="index === emojiTabIndex" class="wl-tab-wrapper">
|
|
198
211
|
<button
|
|
199
|
-
v-for="key in
|
|
212
|
+
v-for="key in emojiItem.items"
|
|
200
213
|
:key="key"
|
|
201
214
|
:title="key"
|
|
202
215
|
@click="insert(`:${key}:`)"
|
|
@@ -214,17 +227,17 @@
|
|
|
214
227
|
</template>
|
|
215
228
|
<div v-if="emoji.tabs.length > 1" class="wl-tabs">
|
|
216
229
|
<button
|
|
217
|
-
v-for="(
|
|
218
|
-
:key="
|
|
230
|
+
v-for="(emojiItem, index) in emoji.tabs"
|
|
231
|
+
:key="emojiItem.name"
|
|
219
232
|
class="wl-tab"
|
|
220
233
|
:class="{ active: emojiTabIndex === index }"
|
|
221
234
|
@click="emojiTabIndex = index"
|
|
222
235
|
>
|
|
223
236
|
<img
|
|
224
237
|
class="wl-emoji"
|
|
225
|
-
:src="
|
|
226
|
-
:alt="
|
|
227
|
-
:title="
|
|
238
|
+
:src="emojiItem.icon"
|
|
239
|
+
:alt="emojiItem.name"
|
|
240
|
+
:title="emojiItem.name"
|
|
228
241
|
loading="lazy"
|
|
229
242
|
referrerPolicy="no-referrer"
|
|
230
243
|
/>
|
|
@@ -454,6 +467,7 @@ export default defineComponent({
|
|
|
454
467
|
// check nick
|
|
455
468
|
if (requiredMeta.indexOf('nick') > -1 && !comment.nick) {
|
|
456
469
|
inputRefs.value.nick?.focus();
|
|
470
|
+
|
|
457
471
|
return alert(locale.value.nickError);
|
|
458
472
|
}
|
|
459
473
|
|
|
@@ -464,12 +478,14 @@ export default defineComponent({
|
|
|
464
478
|
!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(comment.mail))
|
|
465
479
|
) {
|
|
466
480
|
inputRefs.value.mail?.focus();
|
|
481
|
+
|
|
467
482
|
return alert(locale.value.mailError);
|
|
468
483
|
}
|
|
469
484
|
|
|
470
485
|
// check comment
|
|
471
486
|
if (!comment.comment) {
|
|
472
487
|
editorRef.value?.focus();
|
|
488
|
+
|
|
473
489
|
return;
|
|
474
490
|
}
|
|
475
491
|
|
|
@@ -505,7 +521,6 @@ export default defineComponent({
|
|
|
505
521
|
|
|
506
522
|
if (resp.errmsg) return alert(resp.errmsg);
|
|
507
523
|
|
|
508
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
509
524
|
emit('submit', resp.data!);
|
|
510
525
|
|
|
511
526
|
editor.value = '';
|
|
@@ -578,24 +593,7 @@ export default defineComponent({
|
|
|
578
593
|
`width=${width},height=${height},left=${left},top=${top},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`
|
|
579
594
|
);
|
|
580
595
|
|
|
581
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
582
596
|
handler?.postMessage({ type: 'TOKEN', data: userInfo.value!.token }, '*');
|
|
583
|
-
|
|
584
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
585
|
-
const receiver = ({ data }: any): void => {
|
|
586
|
-
if (!data || data.type !== 'profile') return;
|
|
587
|
-
|
|
588
|
-
userInfo.value = { ...userInfo.value, ...data };
|
|
589
|
-
|
|
590
|
-
[localStorage, sessionStorage]
|
|
591
|
-
.filter((store) => store.getItem('WALINE_USER'))
|
|
592
|
-
.forEach((store) =>
|
|
593
|
-
store.setItem('WALINE_USER', JSON.stringify(userInfo))
|
|
594
|
-
);
|
|
595
|
-
window.removeEventListener('message', receiver);
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
window.addEventListener('message', receiver);
|
|
599
597
|
};
|
|
600
598
|
|
|
601
599
|
const popupHandler = (event: MouseEvent): void => {
|
|
@@ -683,8 +681,22 @@ export default defineComponent({
|
|
|
683
681
|
searchResults.loading = false;
|
|
684
682
|
});
|
|
685
683
|
|
|
684
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
685
|
+
const onMessageRecive = ({ data }: any): void => {
|
|
686
|
+
if (!data || data.type !== 'profile') return;
|
|
687
|
+
|
|
688
|
+
userInfo.value = { ...userInfo.value, ...data.data };
|
|
689
|
+
|
|
690
|
+
[localStorage, sessionStorage]
|
|
691
|
+
.filter((store) => store.getItem('WALINE_USER'))
|
|
692
|
+
.forEach((store) =>
|
|
693
|
+
store.setItem('WALINE_USER', JSON.stringify(userInfo))
|
|
694
|
+
);
|
|
695
|
+
};
|
|
696
|
+
|
|
686
697
|
onMounted(() => {
|
|
687
698
|
document.body.addEventListener('click', popupHandler);
|
|
699
|
+
window.addEventListener('message', onMessageRecive);
|
|
688
700
|
|
|
689
701
|
// watch editor
|
|
690
702
|
watch(
|
|
@@ -700,9 +712,7 @@ export default defineComponent({
|
|
|
700
712
|
});
|
|
701
713
|
wordNumber.value = getWordNumber(value);
|
|
702
714
|
|
|
703
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
704
715
|
if (value) autosize(editorRef.value!);
|
|
705
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
706
716
|
else autosize.destroy(editorRef.value!);
|
|
707
717
|
},
|
|
708
718
|
{ immediate: true }
|
|
@@ -723,6 +733,7 @@ export default defineComponent({
|
|
|
723
733
|
|
|
724
734
|
onUnmounted(() => {
|
|
725
735
|
document.body.removeEventListener('click', popupHandler);
|
|
736
|
+
window.removeEventListener('message', onMessageRecive);
|
|
726
737
|
});
|
|
727
738
|
|
|
728
739
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div :id="comment.objectId" class="wl-item">
|
|
3
3
|
<div class="wl-user" aria-hidden="true">
|
|
4
4
|
<img v-if="comment.avatar" :src="comment.avatar" />
|
|
5
5
|
<VerifiedIcon v-if="comment.type" />
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
|
|
34
34
|
<div class="wl-comment-actions">
|
|
35
35
|
<button
|
|
36
|
-
class="wl-delete"
|
|
37
36
|
v-if="isAdmin || isOwner"
|
|
37
|
+
class="wl-delete"
|
|
38
38
|
@click="$emit('delete', comment)"
|
|
39
39
|
>
|
|
40
40
|
<DeleteIcon />
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
|
|
43
43
|
<button
|
|
44
44
|
class="wl-like"
|
|
45
|
-
@click="$emit('like', comment)"
|
|
46
45
|
:title="like ? locale.cancelLike : locale.like"
|
|
46
|
+
@click="$emit('like', comment)"
|
|
47
47
|
>
|
|
48
48
|
<LikeIcon :active="like" />
|
|
49
49
|
<span v-if="'like' in comment" v-text="comment.like" />
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
<span v-if="comment.browser" v-text="comment.browser" />
|
|
65
65
|
<span v-if="comment.os" v-text="comment.os" />
|
|
66
66
|
</div>
|
|
67
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
67
68
|
<div class="wl-content" v-html="comment.comment" />
|
|
68
69
|
|
|
69
70
|
<div v-if="isAdmin" class="wl-admin-actions">
|
|
@@ -79,8 +80,8 @@
|
|
|
79
80
|
</span>
|
|
80
81
|
|
|
81
82
|
<button
|
|
82
|
-
class="wl-btn wl-sticky"
|
|
83
83
|
v-if="isAdmin && !comment.rid"
|
|
84
|
+
class="wl-btn wl-sticky"
|
|
84
85
|
@click="$emit('sticky', comment)"
|
|
85
86
|
>
|
|
86
87
|
{{ comment.sticky ? 'unsticky' : 'sticky' }}
|
|
@@ -89,9 +90,9 @@
|
|
|
89
90
|
|
|
90
91
|
<div v-if="isReplyingCurrent" class="wl-reply-wrapper">
|
|
91
92
|
<CommentBox
|
|
92
|
-
:
|
|
93
|
-
:
|
|
94
|
-
:
|
|
93
|
+
:reply-id="comment.objectId"
|
|
94
|
+
:reply-user="comment.nick"
|
|
95
|
+
:root-id="rootId"
|
|
95
96
|
@submit="$emit('submit', $event)"
|
|
96
97
|
@cancel-reply="$emit('reply', null)"
|
|
97
98
|
/>
|
|
@@ -102,7 +103,7 @@
|
|
|
102
103
|
:key="child.objectId"
|
|
103
104
|
:comment="child"
|
|
104
105
|
:reply="reply"
|
|
105
|
-
:
|
|
106
|
+
:root-id="rootId"
|
|
106
107
|
@reply="$emit('reply', $event)"
|
|
107
108
|
@submit="$emit('submit', $event)"
|
|
108
109
|
@like="$emit('like', $event)"
|
|
@@ -129,6 +130,14 @@ import type { WalineComment, WalineCommentStatus } from '../typings';
|
|
|
129
130
|
const commentStatus: WalineCommentStatus[] = ['approved', 'waiting', 'spam'];
|
|
130
131
|
|
|
131
132
|
export default defineComponent({
|
|
133
|
+
components: {
|
|
134
|
+
CommentBox,
|
|
135
|
+
DeleteIcon,
|
|
136
|
+
LikeIcon,
|
|
137
|
+
ReplyIcon,
|
|
138
|
+
VerifiedIcon,
|
|
139
|
+
},
|
|
140
|
+
|
|
132
141
|
props: {
|
|
133
142
|
comment: {
|
|
134
143
|
type: Object as PropType<WalineComment>,
|
|
@@ -140,17 +149,10 @@ export default defineComponent({
|
|
|
140
149
|
},
|
|
141
150
|
reply: {
|
|
142
151
|
type: Object as PropType<WalineComment | null>,
|
|
152
|
+
default: null,
|
|
143
153
|
},
|
|
144
154
|
},
|
|
145
155
|
|
|
146
|
-
components: {
|
|
147
|
-
CommentBox,
|
|
148
|
-
DeleteIcon,
|
|
149
|
-
LikeIcon,
|
|
150
|
-
ReplyIcon,
|
|
151
|
-
VerifiedIcon,
|
|
152
|
-
},
|
|
153
|
-
|
|
154
156
|
emits: ['submit', 'reply', 'like', 'delete', 'status', 'sticky'],
|
|
155
157
|
|
|
156
158
|
setup(props) {
|
|
@@ -163,7 +165,7 @@ export default defineComponent({
|
|
|
163
165
|
const locale = computed(() => config.value.locale);
|
|
164
166
|
|
|
165
167
|
const link = computed(() => {
|
|
166
|
-
|
|
168
|
+
const { link } = props.comment;
|
|
167
169
|
|
|
168
170
|
return link ? (isLinkHttp(link) ? link : `https://${link}`) : '';
|
|
169
171
|
});
|
|
@@ -80,7 +80,7 @@ export default defineComponent({
|
|
|
80
80
|
gap: { type: Number, default: 0 },
|
|
81
81
|
},
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
emits: ['insert'],
|
|
84
84
|
|
|
85
85
|
setup(props) {
|
|
86
86
|
let resizeObserver: ResizeObserver | null = null;
|
|
@@ -90,7 +90,6 @@ export default defineComponent({
|
|
|
90
90
|
|
|
91
91
|
const getColumnCount = (): number => {
|
|
92
92
|
const count = Math.floor(
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
94
93
|
(wall.value!.getBoundingClientRect().width + props.gap) /
|
|
95
94
|
(props.columnWidth + props.gap)
|
|
96
95
|
);
|
|
@@ -149,11 +148,10 @@ export default defineComponent({
|
|
|
149
148
|
onMounted(() => {
|
|
150
149
|
redraw(true);
|
|
151
150
|
resizeObserver = new ResizeObserver(() => redraw());
|
|
152
|
-
|
|
151
|
+
|
|
153
152
|
resizeObserver.observe(wall.value!);
|
|
154
153
|
});
|
|
155
154
|
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
157
155
|
onBeforeUnmount(() => resizeObserver!.unobserve(wall.value!));
|
|
158
156
|
|
|
159
157
|
return {
|
package/src/config/default.ts
CHANGED
|
@@ -10,6 +10,7 @@ export const defaultLang = 'zh-CN';
|
|
|
10
10
|
export const defaultUploadImage = (file: File): Promise<string> =>
|
|
11
11
|
new Promise((resolve, reject) => {
|
|
12
12
|
const reader = new FileReader();
|
|
13
|
+
|
|
13
14
|
reader.readAsDataURL(file);
|
|
14
15
|
reader.onload = (): void => resolve(reader.result?.toString() || '');
|
|
15
16
|
reader.onerror = reject;
|
|
@@ -73,6 +74,7 @@ export const getDefaultSearchOptions = (): WalineSearchOptions => {
|
|
|
73
74
|
}: FetchGifRequest): Promise<FetchGifResponse> => {
|
|
74
75
|
const baseUrl = `https://g.tenor.com/v1/search`;
|
|
75
76
|
const query = new URLSearchParams('media_filter=minimal');
|
|
77
|
+
|
|
76
78
|
query.set('key', 'PAY5JLFIH6V6');
|
|
77
79
|
query.set('limit', '20');
|
|
78
80
|
query.set('pos', pos || '');
|
package/src/config/i18n/en.ts
CHANGED
package/src/config/i18n/jp.ts
CHANGED
package/src/config/i18n/pt-BR.ts
CHANGED
package/src/config/i18n/ru.ts
CHANGED
package/src/config/i18n/vi-VN.ts
CHANGED
package/src/config/i18n/zh-CN.ts
CHANGED
package/src/config/i18n/zh-TW.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { generateLocale } from './generate';
|
|
|
2
2
|
|
|
3
3
|
export default generateLocale([
|
|
4
4
|
'暱稱',
|
|
5
|
+
'暱稱不能少於3個字元',
|
|
5
6
|
'郵箱',
|
|
7
|
+
'請填寫正確的郵件地址',
|
|
6
8
|
'網址',
|
|
7
9
|
'可選',
|
|
8
|
-
'暱稱不能少於3個字元',
|
|
9
|
-
'請填寫正確的郵件地址',
|
|
10
10
|
'歡迎評論',
|
|
11
11
|
'來發評論吧~',
|
|
12
12
|
'提交',
|
|
@@ -41,4 +41,5 @@ export default generateLocale([
|
|
|
41
41
|
'傳說',
|
|
42
42
|
'表情包',
|
|
43
43
|
'搜索表情包',
|
|
44
|
+
'個人資料',
|
|
44
45
|
]);
|
package/src/init.ts
CHANGED
package/src/styles/emoji.scss
CHANGED
package/src/styles/gif.scss
CHANGED
|
@@ -54,17 +54,18 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.wl-gallery {
|
|
57
|
-
max-height: 80vh;
|
|
58
57
|
display: flex;
|
|
59
58
|
overflow-y: auto;
|
|
59
|
+
max-height: 80vh;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
.wl-gallery-column {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex: 1;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
|
|
67
|
+
// stylelint-disable
|
|
63
68
|
height: -webkit-max-content;
|
|
64
69
|
height: -moz-max-content;
|
|
65
70
|
height: max-content;
|
|
66
|
-
|
|
67
|
-
flex: 1;
|
|
68
|
-
display: flex;
|
|
69
|
-
flex-direction: column;
|
|
70
71
|
}
|
package/src/typings/locale.ts
CHANGED
package/src/utils/fetch.ts
CHANGED
|
@@ -37,6 +37,7 @@ export const fetchCommentCount = ({
|
|
|
37
37
|
token,
|
|
38
38
|
}: FetchCountOptions): Promise<number[]> => {
|
|
39
39
|
const headers: Record<string, string> = {};
|
|
40
|
+
|
|
40
41
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
41
42
|
|
|
42
43
|
return (
|
|
@@ -68,6 +69,7 @@ export const fetchRecentComment = ({
|
|
|
68
69
|
token,
|
|
69
70
|
}: FetchRecentOptions): Promise<WalineComment[]> => {
|
|
70
71
|
const headers: Record<string, string> = {};
|
|
72
|
+
|
|
71
73
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
72
74
|
|
|
73
75
|
return fetch(`${serverURL}/comment?type=recent&count=${count}&lang=${lang}`, {
|
|
@@ -104,6 +106,7 @@ export const fetchCommentList = ({
|
|
|
104
106
|
token,
|
|
105
107
|
}: FetchListOptions): Promise<FetchListResult> => {
|
|
106
108
|
const headers: Record<string, string> = {};
|
|
109
|
+
|
|
107
110
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
108
111
|
|
|
109
112
|
return fetch(
|