@jx3box/jx3box-editor 1.8.7 → 1.8.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.
@@ -0,0 +1,3 @@
1
+ @import '../../node_modules/@jx3box/jx3box-common/css/var.less';
2
+ @import '../../node_modules/csslab/base.less';
3
+ @import '../../assets/css/article.less';
@@ -7,9 +7,9 @@
7
7
  <meta name="renderer" content="webkit" />
8
8
  <title><%= htmlWebpackPlugin.options.title %></title>
9
9
  <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
10
- <script src="https://cdn.jx3box.com/static/tinymce/tinymce.min.js?v=0.1.0"></script>
10
+ <!-- <script src="https://oss.jx3box.com/static/tinymce/tinymce.min.js?v=1.8.8"></script> -->
11
11
  <!-- TODO: -->
12
- <!-- <script src="http://localhost:3000/tinymce.min.js"></script> -->
12
+ <script src="http://localhost:3000/tinymce.min.js"></script>
13
13
  </head>
14
14
  <body>
15
15
  <div id="app"></div>
@@ -17,4 +17,15 @@ function getResource(type, ids, client = "std") {
17
17
  return $.post(`/resource/${client}/${type}/`, { ids });
18
18
  }
19
19
 
20
- export { getResource };
20
+ function getSkill(query, params) {
21
+ let condition = isNaN(query) ? "name" : "id";
22
+ return $node().get(`/skill/${condition}/${query}`, {
23
+ params: params,
24
+ }).then(res => {
25
+ return res.data;
26
+ }).catch((err) => {
27
+ console.log(err);
28
+ });
29
+ }
30
+
31
+ export { getResource, getSkill };
package/src/Article.vue CHANGED
@@ -65,6 +65,7 @@ import renderKatex from "../assets/js/katex";
65
65
  import renderCode from "../assets/js/code";
66
66
  import renderImgPreview from "../assets/js/renderImgPreview";
67
67
  import renderPzIframe from "../assets/js/pz_iframe";
68
+ import renderCombo from "../assets/js/combo";
68
69
 
69
70
  // 剑三
70
71
  import Item from "./Item";
@@ -183,6 +184,8 @@ export default {
183
184
  renderJx3Element(this);
184
185
  // 配装
185
186
  renderPzIframe();
187
+ // 连招
188
+ renderCombo();
186
189
  },
187
190
  doDir: function () {
188
191
  // 显示局部
@@ -1,63 +1,152 @@
1
1
  <template>
2
2
  <div class="c-resource c-resource__jx3box">
3
3
  <!-- 上传触发按钮 -->
4
- <el-button class="u-switch" type="primary" @click="openDialog" :disabled="!enable"> <img class="u-icon" svg-inline :src="boxIcon" />魔盒资源 </el-button>
4
+ <el-button
5
+ class="u-switch"
6
+ type="primary"
7
+ @click="openDialog"
8
+ :disabled="!enable"
9
+ >
10
+ <img class="u-icon" svg-inline :src="boxIcon" />魔盒资源
11
+ </el-button>
5
12
 
6
13
  <!-- 弹出界面 -->
7
- <el-dialog class="c-large-dialog" title="魔盒资源库" :visible.sync="dialogVisible">
14
+ <el-dialog
15
+ class="c-large-dialog"
16
+ title="魔盒资源库"
17
+ :visible.sync="dialogVisible"
18
+ >
8
19
  <div class="c-resource-content" v-loading="loading">
9
20
  <div class="m-database-search">
10
- <el-input class="u-input" :placeholder="placeholderText" v-model="query" @change="search" @keyup.enter.native="search">
21
+ <el-radio-group
22
+ class="u-client"
23
+ v-model="comboClient"
24
+ @change="search"
25
+ v-if="type === 'combo'"
26
+ >
27
+ <el-radio-button label="std">重制</el-radio-button>
28
+ <el-radio-button label="origin">缘起</el-radio-button>
29
+ </el-radio-group>
30
+ <el-input
31
+ class="u-input"
32
+ :placeholder="placeholderText"
33
+ v-model="query"
34
+ @change="search"
35
+ @keyup.enter.native="search"
36
+ >
11
37
  <template slot="prepend">关键词</template>
12
38
  </el-input>
13
39
  </div>
14
40
 
15
- <el-tabs class="m-database-tabs" v-model="type" type="card" @tab-click="changeType">
41
+ <el-tabs
42
+ class="m-database-tabs"
43
+ v-model="type"
44
+ type="card"
45
+ @tab-click="changeType"
46
+ >
16
47
  <el-tab-pane label="魔盒用户" name="authors">
17
48
  <span slot="label" class="u-tab-label">
18
- <i class="el-icon-s-custom" style="margin-right:5px;"></i>
49
+ <i
50
+ class="el-icon-s-custom"
51
+ style="margin-right: 5px"
52
+ ></i>
19
53
  <b>用户</b>
20
54
  <i class="u-lv-box">Lv2+</i>
21
55
  </span>
22
56
  <p v-if="total && done" class="m-resource-count">
23
- <i class="el-icon-s-data"></i> 共找到 <b>{{ total }}</b> 条记录
57
+ <i class="el-icon-s-data"></i> 共找到
58
+ <b>{{ total }}</b> 条记录
24
59
  </p>
25
60
  <ul class="m-resource-list">
26
- <li v-for="(o, i) in authors" class="u-item" :key="i" :class="{ on: !!o.isSelected }" @click="selectAuthor(o, i)" ref="author">
61
+ <li
62
+ v-for="(o, i) in authors"
63
+ class="u-item"
64
+ :key="i"
65
+ :class="{ on: !!o.isSelected }"
66
+ @click="selectAuthor(o, i)"
67
+ ref="author"
68
+ >
27
69
  <span class="u-id">ID:{{ o.ID }}</span>
28
- <img class="u-pic" :title="'AuthorID:' + o.display_name" :src="userAvatar(o.user_avatar)" />
70
+ <img
71
+ class="u-pic"
72
+ :title="'AuthorID:' + o.display_name"
73
+ :src="userAvatar(o.user_avatar)"
74
+ />
29
75
  <span class="u-primary">
30
76
  <span class="u-name">
31
77
  {{ o.display_name }}
32
78
  </span>
33
79
  <div class="u-remark">
34
- {{o.user_bio}}
80
+ {{ o.user_bio }}
35
81
  </div>
36
82
  </span>
37
83
  </li>
38
84
  </ul>
39
- <el-alert v-if="!authors.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
85
+ <el-alert
86
+ v-if="!authors.length && done"
87
+ title="没有找到相关条目"
88
+ type="info"
89
+ show-icon
90
+ ></el-alert>
40
91
  </el-tab-pane>
41
92
  <el-tab-pane label="剑三趣图" name="emotions">
42
93
  <span slot="label" class="u-tab-label">
43
- <i class="el-icon-sugar" style="margin-right: 5px;"></i>
94
+ <i
95
+ class="el-icon-sugar"
96
+ style="margin-right: 5px"
97
+ ></i>
44
98
  <b>趣图</b>
45
99
  </span>
46
100
  <p v-if="total && done" class="m-resource-count">
47
- <i class="el-icon-s-data"></i> 共找到 <b>{{ total }}</b> 条记录
101
+ <i class="el-icon-s-data"></i> 共找到
102
+ <b>{{ total }}</b> 条记录
48
103
  </p>
49
104
  <ul class="m-resource-emotion">
50
- <li v-for="o in emotions" class="u-item" :key="o.id" :class="{ on: !!o.isSelected }" @click="selectEmotion(o)" ref="emotion">
51
- <img class="e-jx3-emotion" :src="resolveImagePath(o.url)" :alt="query" />
105
+ <li
106
+ v-for="o in emotions"
107
+ class="u-item"
108
+ :key="o.id"
109
+ :class="{ on: !!o.isSelected }"
110
+ @click="selectEmotion(o)"
111
+ ref="emotion"
112
+ >
113
+ <img
114
+ class="e-jx3-emotion"
115
+ :src="resolveImagePath(o.url)"
116
+ :alt="query"
117
+ />
52
118
  </li>
53
119
  </ul>
54
- <el-alert v-if="!emotions.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
120
+ <el-alert
121
+ v-if="!emotions.length && done"
122
+ title="没有找到相关条目"
123
+ type="info"
124
+ show-icon
125
+ ></el-alert>
126
+ </el-tab-pane>
127
+ <el-tab-pane label="技能连招" name="combo">
128
+ <span slot="label" class="u-tab-label">
129
+ <i
130
+ class="el-icon-tickets"
131
+ style="margin-right: 5px"
132
+ ></i>
133
+ <b>技能连招</b>
134
+ </span>
135
+ <ComboVue :query="query" ref="combo" :client="comboClient"></ComboVue>
55
136
  </el-tab-pane>
56
137
  </el-tabs>
57
138
 
58
- <template v-if="multipage">
139
+ <template v-if="multipage && type !== 'combo'">
140
+ {{ multipage && type !== "combo" }}
59
141
  <!-- 下一页 -->
60
- <el-button class="m-archive-more" :class="{ show: hasNextPage }" type="primary" icon="el-icon-arrow-down" @click="appendPage">加载更多</el-button>
142
+ <el-button
143
+ class="m-archive-more"
144
+ :class="{ show: hasNextPage }"
145
+ type="primary"
146
+ icon="el-icon-arrow-down"
147
+ @click="appendPage"
148
+ >加载更多</el-button
149
+ >
61
150
  <!-- 分页 -->
62
151
  <el-pagination
63
152
  class="m-archive-pages"
@@ -71,7 +160,9 @@
71
160
  ></el-pagination>
72
161
  </template>
73
162
 
74
- <div class="m-database-tip" v-show="isBlank">❤ 请输入搜索条件查询</div>
163
+ <div class="m-database-tip" v-show="isBlank && type !== 'combo'">
164
+ ❤ 请输入搜索条件查询
165
+ </div>
75
166
  </div>
76
167
 
77
168
  <!-- 插入按钮 -->
@@ -86,21 +177,35 @@
86
177
  </template>
87
178
 
88
179
  <script>
89
- import { loadStat, } from "../service/database";
180
+ import { loadStat } from "../service/database";
90
181
  import { loadAuthors, loadEmotions } from "../service/cms";
91
182
  import { getUserInfo } from "../service/author";
92
- import { __iconPath, __Root, __OriginRoot, __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
93
- import { getLink, showAvatar, resolveImagePath } from "@jx3box/jx3box-common/js/utils";
183
+ import {
184
+ __iconPath,
185
+ __Root,
186
+ __OriginRoot,
187
+ __imgPath,
188
+ } from "@jx3box/jx3box-common/data/jx3box.json";
189
+ import {
190
+ getLink,
191
+ showAvatar,
192
+ resolveImagePath,
193
+ } from "@jx3box/jx3box-common/js/utils";
94
194
  import User from "@jx3box/jx3box-common/js/user";
195
+
196
+ import ComboVue from "./components/Combo.vue";
95
197
  export default {
96
198
  name: "BoxResource",
199
+ components: {
200
+ ComboVue,
201
+ },
97
202
  props: {
98
203
  enable: {
99
204
  type: Boolean,
100
205
  default: true,
101
206
  },
102
207
  },
103
- data: function() {
208
+ data: function () {
104
209
  return {
105
210
  dialogVisible: false,
106
211
  actived: false,
@@ -110,6 +215,7 @@ export default {
110
215
  query: "",
111
216
  strict: false,
112
217
  client: location.hostname.includes("origin") ? "origin" : "std",
218
+ comboClient: "std",
113
219
 
114
220
  skill: [],
115
221
  buff: [],
@@ -132,57 +238,58 @@ export default {
132
238
  total: 1,
133
239
  pages: 1,
134
240
 
135
- placeholderTexts : {
136
- 'authors' : '请输入 ID 或 名称'
137
- }
138
-
241
+ placeholderTexts: {
242
+ authors: "请输入 ID 或 名称",
243
+ },
139
244
  };
140
245
  },
141
246
  computed: {
142
- placeholderText : function (){
143
- return this.placeholderTexts[this.type]
247
+ placeholderText: function () {
248
+ return this.placeholderTexts[this.type];
144
249
  },
145
- buttonTXT: function() {
250
+ buttonTXT: function () {
146
251
  return this.selectedCount ? "插 入" : "确 定";
147
252
  },
148
- isBlank: function() {
149
- return !this.query && !this[this.type]["length"];
253
+ isBlank: function () {
254
+ return !this.query && !this[this.type]?.["length"];
150
255
  },
151
- selectedCount: function() {
256
+ selectedCount: function () {
152
257
  return !!this.html;
153
258
  },
154
- isNumber: function() {
259
+ isNumber: function () {
155
260
  return !isNaN(this.query);
156
261
  },
157
- hasNextPage: function() {
262
+ hasNextPage: function () {
158
263
  return this.total > 1 && this.page < this.pages;
159
264
  },
160
- multipage: function() {
265
+ multipage: function () {
161
266
  return this.type !== "icon" && this.done && this.pages > 1;
162
267
  },
163
- iconDir: function() {
268
+ iconDir: function () {
164
269
  return this.client === "origin" ? "origin_icon" : "icon";
165
270
  },
166
- userStatus: function (){
167
- return User.getInfo().status
271
+ userStatus: function () {
272
+ return User.getInfo().status;
168
273
  },
169
- uid: function (){
170
- return User.getInfo().uid
274
+ uid: function () {
275
+ return User.getInfo().uid;
171
276
  },
172
- canInsertAuthor: function() {
173
- return User.getLevel(this.userInfo && this.userInfo.experience) >= 2;
277
+ canInsertAuthor: function () {
278
+ return (
279
+ User.getLevel(this.userInfo && this.userInfo.experience) >= 2
280
+ );
174
281
  },
175
- boxIcon: function() {
176
- return __imgPath + 'image/common/jx3box_white.svg'
282
+ boxIcon: function () {
283
+ return __imgPath + "image/common/jx3box_white.svg";
177
284
  },
178
285
  },
179
286
  watch: {
180
- html: function(newval) {
287
+ html: function (newval) {
181
288
  this.$emit("update", newval);
182
289
  },
183
290
  },
184
291
  methods: {
185
- getData: function(page = 1, append = false) {
292
+ getData: function (page = 1, append = false) {
186
293
  this.loading = true;
187
294
  this.per = 10;
188
295
  this.done = false;
@@ -195,20 +302,20 @@ export default {
195
302
  };
196
303
 
197
304
  // 图标
198
- if (this.type === 'authors') {
305
+ if (this.type === "authors") {
199
306
  if (!this.query) {
200
307
  this.loading = false;
201
308
  return;
202
- };
309
+ }
203
310
 
204
311
  params = {
205
312
  ...params,
206
313
  name: query,
207
- }
314
+ };
208
315
  loadAuthors(params)
209
316
  .then((res) => {
210
- if (!append) this.authors = [];
211
- let list = this.transformData(res.data.data.list)
317
+ if (!append) this.authors = [];
318
+ let list = this.transformData(res.data.data.list);
212
319
  this.authors = this.authors.concat(list);
213
320
  this.pages = res.data.data.pages;
214
321
  this.total = res.data.data.total;
@@ -217,18 +324,17 @@ export default {
217
324
  this.done = true;
218
325
  this.loading = false;
219
326
  });
220
-
221
- } else if (this.type === 'emotions') {
327
+ } else if (this.type === "emotions") {
222
328
  this.per = 24;
223
329
  params = {
224
330
  per: this.per,
225
331
  page: page,
226
332
  search: query,
227
- }
333
+ };
228
334
  loadEmotions(params)
229
335
  .then((res) => {
230
- if (!append) this.emotions = [];
231
- let list = this.transformData(res.data.data.list)
336
+ if (!append) this.emotions = [];
337
+ let list = this.transformData(res.data.data.list);
232
338
  this.emotions = this.emotions.concat(list);
233
339
  this.pages = res.data.data.pages;
234
340
  this.total = res.data.data.total;
@@ -239,39 +345,56 @@ export default {
239
345
  });
240
346
  }
241
347
  },
242
- search: function() {
243
- this.page = 1;
244
- this.getData();
348
+ search: function () {
349
+ if (this.type === "combo") {
350
+ this.$refs.combo?.search();
351
+ } else {
352
+ this.page = 1;
353
+ this.getData();
354
+ }
245
355
  },
246
- appendPage: function() {
356
+ appendPage: function () {
247
357
  this.getData(++this.page, true);
248
358
  },
249
- changePage: function(i) {
359
+ changePage: function (i) {
250
360
  this.getData(i);
251
361
  },
252
- changeType: function() {
362
+ changeType: function () {
253
363
  this.page = 1;
364
+ if (this.type === "combo") {
365
+ this.done = false;
366
+ return;
367
+ }
254
368
  this.getData();
255
369
  },
256
- setAuthors: function() {
370
+ setAuthors: function () {
257
371
  try {
258
372
  let author = sessionStorage.getItem("atAuthor");
259
373
  if (author) {
260
374
  author = JSON.parse(author);
261
- author = author.split(',') || [];
262
- if (this.selectedAuthor.ID && !author.includes(String(this.selectedAuthor.ID))) {
375
+ author = author.split(",") || [];
376
+ if (
377
+ this.selectedAuthor.ID &&
378
+ !author.includes(String(this.selectedAuthor.ID))
379
+ ) {
263
380
  author.push(this.selectedAuthor.ID);
264
381
  }
265
- sessionStorage.setItem("atAuthor", JSON.stringify(author.join(',')));
382
+ sessionStorage.setItem(
383
+ "atAuthor",
384
+ JSON.stringify(author.join(","))
385
+ );
266
386
  } else {
267
- sessionStorage.setItem("atAuthor", JSON.stringify(String(this.selectedAuthor.ID)));
387
+ sessionStorage.setItem(
388
+ "atAuthor",
389
+ JSON.stringify(String(this.selectedAuthor.ID))
390
+ );
268
391
  }
269
392
  } catch (error) {
270
- console.log(error)
393
+ console.log(error);
271
394
  }
272
395
  },
273
- insert: function() {
274
- if (this.type === 'authors') {
396
+ insert: function () {
397
+ if (this.type === "authors") {
275
398
  if (this.userStatus == 0 && this.canInsertAuthor) {
276
399
  if (this.selectedAuthor.ID) {
277
400
  this.setAuthors();
@@ -282,54 +405,59 @@ export default {
282
405
  this.$message.warning("请选择一个用户");
283
406
  }
284
407
  } else {
285
- this.$alert('您的等级不足或无权限(Lv2以上可用)', '消息');
408
+ this.$alert("您的等级不足或无权限(Lv2以上可用)", "消息");
286
409
  }
287
410
  } else {
288
- this.$emit("insert", this.html);
411
+ if (this.type === 'combo') {
412
+ const html = this.$refs.combo.renderVal();
413
+ this.$emit("insert", html);
414
+ } else {
415
+ this.$emit("insert", this.html);
416
+ }
289
417
  this.dialogVisible = false;
290
418
  }
291
419
  },
292
- transformData: function(data) {
420
+ transformData: function (data) {
293
421
  data.forEach((item) => {
294
422
  item.isSelected = false;
295
423
  });
296
424
  return data;
297
425
  },
298
- selectAuthor: function (o){
426
+ selectAuthor: function (o) {
299
427
  this.resetItems();
300
428
  this.selectedAuthor = o;
301
429
  o.isSelected = true;
302
- this.html = `<a data-type="author" class="e-jx3-author w-jx3-element" data-mode="" data-id="${o.ID}" target="_blank" href="/author/${o.ID}">@${o.display_name}</a>`
430
+ this.html = `<a data-type="author" class="e-jx3-author w-jx3-element" data-mode="" data-id="${o.ID}" target="_blank" href="/author/${o.ID}">@${o.display_name}</a>`;
303
431
  },
304
- selectEmotion: function (o){
432
+ selectEmotion: function (o) {
305
433
  this.resetItems();
306
434
  o.isSelected = true;
307
- this.html = `<a data-type="emotion" class="e-jx3-emotion w-jx3-element" data-id="${o.id}" target="_blank" href="/emotion/${o.id}"><img class="e-jx3-emotion-img" data-type="emotion" data-id="${o.id}" style="width:180px;" src="${o.url}" alt="${o.id}"/></a>`
435
+ this.html = `<a data-type="emotion" class="e-jx3-emotion w-jx3-element" data-id="${o.id}" target="_blank" href="/emotion/${o.id}"><img class="e-jx3-emotion-img" data-type="emotion" data-id="${o.id}" style="width:180px;" src="${o.url}" alt="${o.id}"/></a>`;
308
436
  },
309
- resetItems: function() {
437
+ resetItems: function () {
310
438
  let data = this[this.type];
311
439
  data.forEach((item) => {
312
440
  item.isSelected = false;
313
441
  });
314
442
  this.html = "";
315
443
  },
316
- getLink : function (type,id){
444
+ getLink: function (type, id) {
317
445
  let domain = this.client == "origin" ? __OriginRoot : __Root;
318
- return domain + getLink(type,id).slice(1)
446
+ return domain + getLink(type, id).slice(1);
319
447
  },
320
- userAvatar: function(url) {
321
- return showAvatar(url,'m');
448
+ userAvatar: function (url) {
449
+ return showAvatar(url, "m");
322
450
  },
323
- loadUserInfo: function (){
451
+ loadUserInfo: function () {
324
452
  if (!this.uid) return;
325
- getUserInfo(this.uid).then(res => {
326
- this.userInfo = res
327
- })
453
+ getUserInfo(this.uid).then((res) => {
454
+ this.userInfo = res;
455
+ });
328
456
  },
329
457
 
330
458
  // 杂项
331
459
  // ==============================
332
- openDialog: function() {
460
+ openDialog: function () {
333
461
  this.dialogVisible = true;
334
462
  if (!this.actived) {
335
463
  loadStat().then((data) => {
@@ -338,9 +466,9 @@ export default {
338
466
  });
339
467
  }
340
468
  },
341
- resolveImagePath
469
+ resolveImagePath,
342
470
  },
343
- created: function() {
471
+ created: function () {
344
472
  this.loadUserInfo();
345
473
  },
346
474
  };
package/src/Tinymce.vue CHANGED
@@ -63,8 +63,8 @@ export default {
63
63
 
64
64
  // 样式
65
65
  // TODO:
66
- content_css: `https://cdn.jx3box.com/static/tinymce/skins/content/default/content.min.css`,
67
- // content_css: `http://localhost:5000/skins/content/default/content.min.css`,
66
+ content_css: process.env.NODE_ENV == 'development' ? '/css/article.css' : `https://oss.jx3box.com/static/jx3box-editor/css/article.css`,
67
+ // content_css: `http://localhost:3000/skins/content/default/content.min.css`,
68
68
  body_class: "c-article c-article-editor c-article-tinymce",
69
69
  height: this.height || 800,
70
70
  autosave_ask_before_unload: false,
@@ -218,4 +218,5 @@ export default {
218
218
 
219
219
  <style lang="less">
220
220
  @import "../assets/css/tinymce.less";
221
+ @import "../assets/css/tinymce/combo.less";
221
222
  </style>