@jx3box/jx3box-editor 3.2.8 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-editor",
3
- "version": "3.2.8",
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.5",
21
- "@jx3box/jx3box-data": "^3.9.5",
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",
@@ -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> 导读</span>
53
- <span class="c-article-directory-title-folder" class="c-go-top"><i class="el-icon-d-caret"></i> 折叠</span>
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>`
@@ -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
+ }