@jx3box/jx3box-editor 3.2.7 → 3.2.9
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/package.json +3 -3
- package/src/BoxResource.vue +1 -1
- package/src/assets/css/resource.less +6 -1
- package/src/assets/js/directory.js +3 -2
- package/src/components/Author.vue +16 -10
- package/src/i18n/index.js +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-editor",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.9",
|
|
4
4
|
"description": "JX3BOX Article & Editor",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@element-plus/icons-vue": "^2.0.10",
|
|
19
19
|
"@imengyu/vue3-context-menu": "^1.5.4",
|
|
20
|
-
"@jx3box/jx3box-common": "^9.2.
|
|
21
|
-
"@jx3box/jx3box-data": "^3.9.
|
|
20
|
+
"@jx3box/jx3box-common": "^9.2.9",
|
|
21
|
+
"@jx3box/jx3box-data": "^3.9.6",
|
|
22
22
|
"@jx3box/jx3box-emotion": "^1.3.1",
|
|
23
23
|
"@jx3box/jx3box-macro": "^1.0.4",
|
|
24
24
|
"@jx3box/jx3box-talent": "^1.3.14",
|
package/src/BoxResource.vue
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</el-button>
|
|
7
7
|
|
|
8
8
|
<!-- 弹出界面 -->
|
|
9
|
-
<el-dialog draggable class="c-large-dialog" title="魔盒资源库" v-model="dialogVisible" :teleported="true">
|
|
9
|
+
<el-dialog draggable class="c-large-dialog c-resource-dialog" title="魔盒资源库" v-model="dialogVisible" :teleported="true">
|
|
10
10
|
<div class="c-resource-content" v-loading="loading">
|
|
11
11
|
<div class="m-database-search">
|
|
12
12
|
<el-radio-group
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import "var.less";
|
|
2
2
|
|
|
3
|
-
.c-resource
|
|
3
|
+
.c-resource,
|
|
4
|
+
.c-resource-dialog {
|
|
4
5
|
.w-dialog,
|
|
5
6
|
.el-dialog {
|
|
6
7
|
max-width: 100%;
|
|
@@ -62,6 +63,10 @@
|
|
|
62
63
|
|
|
63
64
|
.u-item {
|
|
64
65
|
.db;
|
|
66
|
+
// 调用方常会全局设为 border-box / overflow:hidden;这里的 60px 是内容区高度,
|
|
67
|
+
// 必须保留上下 padding 与头像的空间,避免用户条目在宿主项目中被裁切。
|
|
68
|
+
box-sizing: content-box;
|
|
69
|
+
overflow: visible;
|
|
65
70
|
border: 2px solid #e1e4e8;
|
|
66
71
|
background: #fafbfc;
|
|
67
72
|
margin-bottom: 10px;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import $ from "jquery";
|
|
2
|
+
import { t } from "../../i18n";
|
|
2
3
|
const count = {
|
|
3
4
|
H1: 0,
|
|
4
5
|
H2: 0,
|
|
@@ -49,8 +50,8 @@ function directory(from, to = '#directory') {
|
|
|
49
50
|
$box.html(
|
|
50
51
|
`<div class="c-article-directory" id="c-article-directory">
|
|
51
52
|
<div class="c-article-directory-title" id="c-article-directory-title">
|
|
52
|
-
<span class="c-article-directory-title-label" class="c-go-top"><i class="u-icon el-icon-reading"></i>
|
|
53
|
-
<span class="c-article-directory-title-folder" class="c-go-top"><i class="el-icon-d-caret"></i>
|
|
53
|
+
<span class="c-article-directory-title-label" class="c-go-top"><i class="u-icon el-icon-reading"></i> ${t("directory.title", "导读")}</span>
|
|
54
|
+
<span class="c-article-directory-title-folder" class="c-go-top"><i class="el-icon-d-caret"></i> ${t("directory.collapse", "折叠")}</span>
|
|
54
55
|
</div>
|
|
55
56
|
<div class="c-article-directory-content" id="c-article-directory-content"></div>
|
|
56
57
|
</div>`
|
|
@@ -91,6 +91,8 @@ import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
|
|
|
91
91
|
import Avatar from "./Avatar.vue";
|
|
92
92
|
const ATCARD_CACHE_KEY = "skin_atcard_pc_authorcard_v2_";
|
|
93
93
|
const ATCARD_SUBTYPE = "pc_authorcard";
|
|
94
|
+
const DEFAULT_ATCARD_IMAGE = "https://cdn.jx3box.com/design/skin/default/pc_authorcard.png";
|
|
95
|
+
const DEFAULT_ATCARD_POSITION = "right top";
|
|
94
96
|
const DECORATION_JSON = "decoration_json";
|
|
95
97
|
const DECORATION_KEY = "decoration_me";
|
|
96
98
|
const HONOR_KEY = "honor_me";
|
|
@@ -132,8 +134,8 @@ export default {
|
|
|
132
134
|
data: null,
|
|
133
135
|
medals: [],
|
|
134
136
|
loading: false,
|
|
135
|
-
bg:
|
|
136
|
-
bgPosition:
|
|
137
|
+
bg: DEFAULT_ATCARD_IMAGE,
|
|
138
|
+
bgPosition: DEFAULT_ATCARD_POSITION,
|
|
137
139
|
honor: "",
|
|
138
140
|
honorStyle: {},
|
|
139
141
|
}),
|
|
@@ -215,8 +217,7 @@ export default {
|
|
|
215
217
|
},
|
|
216
218
|
getAtcard() {
|
|
217
219
|
const uid = this.uid;
|
|
218
|
-
this.
|
|
219
|
-
this.bgPosition = "right top";
|
|
220
|
+
this.setAtcardBackground();
|
|
220
221
|
|
|
221
222
|
const cached = this.getAtcardCache(uid);
|
|
222
223
|
if (cached) {
|
|
@@ -236,7 +237,7 @@ export default {
|
|
|
236
237
|
let image = this.showDecorationImage(skin?.image);
|
|
237
238
|
if (!image) {
|
|
238
239
|
this.setAtcardCache(uid, "no");
|
|
239
|
-
this.
|
|
240
|
+
this.setAtcardBackground();
|
|
240
241
|
return;
|
|
241
242
|
}
|
|
242
243
|
let payload = {
|
|
@@ -248,18 +249,23 @@ export default {
|
|
|
248
249
|
})
|
|
249
250
|
.catch(() => {
|
|
250
251
|
if (this.uid === uid) {
|
|
251
|
-
this.
|
|
252
|
+
this.setAtcardBackground();
|
|
252
253
|
}
|
|
253
254
|
});
|
|
254
255
|
},
|
|
255
|
-
setAtcardBackground(val) {
|
|
256
|
+
setAtcardBackground(val = null) {
|
|
257
|
+
if (!val) {
|
|
258
|
+
this.bg = DEFAULT_ATCARD_IMAGE;
|
|
259
|
+
this.bgPosition = DEFAULT_ATCARD_POSITION;
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
256
262
|
if (typeof val === "string") {
|
|
257
263
|
this.bg = val || "";
|
|
258
|
-
this.bgPosition =
|
|
264
|
+
this.bgPosition = DEFAULT_ATCARD_POSITION;
|
|
259
265
|
return;
|
|
260
266
|
}
|
|
261
|
-
this.bg = val?.image ||
|
|
262
|
-
this.bgPosition = val?.position ||
|
|
267
|
+
this.bg = val?.image || DEFAULT_ATCARD_IMAGE;
|
|
268
|
+
this.bgPosition = val?.position || DEFAULT_ATCARD_POSITION;
|
|
263
269
|
},
|
|
264
270
|
getAtcardCache(uid) {
|
|
265
271
|
let cached = sessionStorage.getItem(ATCARD_CACHE_KEY + uid);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const messages = {
|
|
2
|
+
"zh-cn": {
|
|
3
|
+
directory: { title: "导读", collapse: "折叠" },
|
|
4
|
+
},
|
|
5
|
+
"zh-tw": {
|
|
6
|
+
directory: { title: "導讀", collapse: "折疊" },
|
|
7
|
+
},
|
|
8
|
+
"en-us": {
|
|
9
|
+
directory: { title: "Guide", collapse: "Collapse" },
|
|
10
|
+
},
|
|
11
|
+
vi: {
|
|
12
|
+
directory: { title: "Hướng dẫn", collapse: "Thu gọn" },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function getValue(message, key) {
|
|
17
|
+
return key.split(".").reduce((value, part) => (value && value[part] !== undefined ? value[part] : undefined), message);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getLocale() {
|
|
21
|
+
const locale = (localStorage.getItem("lang") || "zh-cn").toLowerCase();
|
|
22
|
+
return locale === "en" ? "en-us" : messages[locale] ? locale : "zh-cn";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function t(key, fallback = key) {
|
|
26
|
+
return getValue(messages[getLocale()], key) ?? fallback;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getMessages() {
|
|
30
|
+
return messages;
|
|
31
|
+
}
|