@jx3box/jx3box-editor 1.4.10 → 1.5.0

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.
@@ -1,7 +1,11 @@
1
1
  import $ from 'jquery'
2
2
 
3
3
  function renderImgPreview(vm, selector='.c-article img'){
4
- $(selector).each((i, ele) => {
4
+ // 获取src不为空的图片
5
+ let imgs = $(selector).filter(function(){
6
+ return $(this).attr('src') != ''
7
+ })
8
+ imgs.each((i, ele) => {
5
9
  // 加载全部src(lazyload)
6
10
  vm.images.push($(ele).attr('src'))
7
11
  // 绑定事件挂钩索引位置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-editor",
3
- "version": "1.4.10",
3
+ "version": "1.5.0",
4
4
  "description": "JX3BOX Article & Editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,6 +13,10 @@
13
13
  <script>
14
14
  import markdownRender from '@jx3box/markdown/src/render.vue'
15
15
 
16
+ import Vue from "vue";
17
+ import hevueImgPreview from "hevue-img-preview";
18
+ Vue.use(hevueImgPreview);
19
+
16
20
  // 基本文本
17
21
  import execLazyload from "../assets/js/img";
18
22
  import execFilterIframe from "../assets/js/iframe";
@@ -33,6 +37,7 @@ import Buff from "./Buff";
33
37
  import Skill from "./Skill";
34
38
  import Npc from "./Npc";
35
39
  import renderJx3Element from "../assets/js/jx3_element";
40
+ import renderImgPreview from "../assets/js/renderImgPreview";
36
41
 
37
42
  import {xssOptions} from '../assets/data/markdown_whitelist.json'
38
43
 
@@ -79,6 +84,7 @@ export default {
79
84
  },
80
85
  type: "",
81
86
  },
87
+ images: [],
82
88
 
83
89
  xssOptions
84
90
  };
@@ -106,6 +112,8 @@ export default {
106
112
  renderTalent2();
107
113
  // Tatex
108
114
  renderKatex();
115
+ // 画廊
116
+ renderImgPreview(this);
109
117
  // 语法高亮
110
118
  renderCode(`code[class=^'lang-']`)
111
119
  // 物品
@@ -156,4 +164,8 @@ export default {
156
164
 
157
165
  <style lang="less">
158
166
  @import "../assets/css/article_markdown.less";
167
+
168
+ .v-note-img-wrapper {
169
+ display: none;
170
+ }
159
171
  </style>
package/src/GameText.vue CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: X3ZvaWQ
3
3
  * @Date: 2022-08-20 20:23:57
4
4
  * @LastEditors: X3ZvaWQ
5
- * @LastEditTime: 2022-08-23 20:36:40
5
+ * @LastEditTime: 2022-08-24 22:32:56
6
6
  * @Description: 用于渲染游戏内Text标签的文本
7
7
  -->
8
8
  <template>
@@ -146,6 +146,7 @@ export default {
146
146
  },
147
147
  renderEnchantResource: function () {
148
148
  const matches = this.html.match(/<ENCHANT (\d+)>/gim);
149
+ if(!matches) return;
149
150
  for (let match of matches) {
150
151
  let enchant_id = match.match(/<ENCHANT (\d+)>/i)[1];
151
152
  getResource(`enchant.${enchant_id}`, this.client)
package/src/Item.vue CHANGED
@@ -176,9 +176,9 @@
176
176
  </div>
177
177
  <!-- 描述 -->
178
178
  <p
179
- v-if="source.DescHtml"
179
+ v-if="source.Desc"
180
180
  class="u-desc u-yellow">
181
- <game-text :client="client" :text="source.DescHtml || source.Desc"></game-text>
181
+ <game-text :client="client" :text="source.Desc"></game-text>
182
182
  </p>
183
183
  <!-- 五彩石属性 -->
184
184
  <p v-if="source.WuCaiHtml" class="u-desc" v-html="source.WuCaiHtml"></p>
package/src/Resource.vue CHANGED
@@ -102,7 +102,9 @@
102
102
  <span class="u-id">ID:{{ o.id }}</span>
103
103
  <img class="u-pic" :title="'IconID:' + o.IconID" :src="iconURL(o.IconID)" />
104
104
  <span class="u-name">{{ o.Name }}</span>
105
- <span class="u-content" v-html="o.DescHtml"></span>
105
+ <span class="u-content">
106
+ <game-text :text="o.Desc"></game-text>
107
+ </span>
106
108
  <span class="u-remark">
107
109
  {{ o.Requirement }}
108
110
  </span>
@@ -202,6 +204,7 @@ import { loadEmotions } from "../service/cms";
202
204
  import { __ossRoot, __iconPath, __Root, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
203
205
  import detach_types from "../assets/data/detach_type.json";
204
206
  import { iconLink, getLink, showAvatar } from "@jx3box/jx3box-common/js/utils";
207
+ import GameText from "./GameText.vue";
205
208
  import User from "@jx3box/jx3box-common/js/user";
206
209
  import Item from './Item.vue';
207
210
  export default {
@@ -287,7 +290,7 @@ export default {
287
290
  },
288
291
  canInsertAuthor: function() {
289
292
  return User.getLevel(this.userInfo && this.userInfo.experience) >= 2;
290
- },
293
+ }
291
294
  },
292
295
  watch: {
293
296
  html: function(newval) {
@@ -502,7 +505,8 @@ export default {
502
505
  this.checkUA();
503
506
  },
504
507
  components: {
505
- 'jx3-item': Item
508
+ 'jx3-item': Item,
509
+ GameText
506
510
  },
507
511
  };
508
512
  </script>