@haluo/biz 2.0.37 → 2.0.39
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/README.md +1 -0
- package/dist/haluo-biz.js +2160 -790
- package/dist/haluo-biz.umd.cjs +2201 -831
- package/dist/{squire-raw.ca3d11c8.js → squire-raw-1aaeff0b.js} +18 -15
- package/dist/style.css +201 -50
- package/package.json +3 -2
package/dist/haluo-biz.umd.cjs
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("element-plus"), require("vue"), require("@element-plus/icons-vue"), require("@haluo/util"), require("vuedraggable")) : typeof define === "function" && define.amd ? define(["exports", "element-plus", "vue", "@element-plus/icons-vue", "@haluo/util", "vuedraggable"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["haluo-biz"] = {}, global2["element-plus"], global2.Vue, global2["@element-plus/icons-vue"], global2.hUtil, global2.vuedraggable));
|
|
3
3
|
})(this, function(exports2, elementPlus, vue, iconsVue, util, draggable) {
|
|
4
4
|
"use strict";
|
|
5
|
-
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
6
|
-
const util__default = /* @__PURE__ */ _interopDefaultLegacy(util);
|
|
7
|
-
const draggable__default = /* @__PURE__ */ _interopDefaultLegacy(draggable);
|
|
8
5
|
const __vite_glob_0_1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLBAMAAADKYGfZAAAAG1BMVEUAAAAAAABHcExSUlLz8/P////IyMifn5/k5OQx49C2AAAACXRSTlMzZgB/7//CpN1ci7LLAAABHUlEQVR4AY3TgUbAUBjF8e0NmiiAY28QIYCkXqB9GUBIT7AHCHvvss3l73Y4g3vx87ft3m8Yp+C5GZSxecyYMuZzZMqYz5EpYz5Hpoz5HJkS1uceP67N7TeYyF7r59xs9XmxlgNbj/W+6hmMua86c9vfCsbcXdV6xpYHsj53xF4msj7XYmB97oqB9bmlxcC6XIuBdbkWI2Nur3qfyFouqc0K3g05/6XI+f+GnD8F5NyZMmdvCHP2vjFX7vYyt7tZYO7p7f/JYs7NKXMZk2fMZUyeMZcxecZcxuQZcxmTZ8xlTJ4xlzF5xlzG5BlzGZNnzGVMnjGXMXnGXMbkGXMZk2fMZUyeMZcxecZcxuQZcxmTZ8xlTJ4xlzFlbB5+AVncQI3j46OFAAAAAElFTkSuQmCC";
|
|
9
6
|
const __vite_glob_0_2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkU2MThGQUEzOUM3QTExRThBMkI0RDI5RUQ4MzE1NUMwIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkU2MThGQUE0OUM3QTExRThBMkI0RDI5RUQ4MzE1NUMwIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6RTYxOEZBQTE5QzdBMTFFOEEyQjREMjlFRDgzMTU1QzAiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6RTYxOEZBQTI5QzdBMTFFOEEyQjREMjlFRDgzMTU1QzAiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6cZvOcAAABiklEQVR42uyXu0rEQBRAs3GxtlHEIqDFioWIkA+wUBCsFKwUGxdRrHSx8Ed8gIWlIKyICKIigu0uYmFjIbIfIFqJyhrPwC3CEIvNZEKEGThMHpAcJvcxKUVR5BV5+F7BhxN0gk7QCTpBSyMMw37oLqQgYgNMt1A3lfQtyd3AMMyYSvoW5dTcMpX0LcrNw5SpZCntdouXxU974U6Te5V7FbiCAM5hrtFofOW9gj3wJnILsAhdcu8JLuR4GiY6eXDZUKxPVu8RNuAZdmFWVnMd9mEF2lBl9S7zElQxdy2fchOacCRy6tpBgtxhLkkSS4gR+IQXTW4SVk3lUgkmZKuKuT1N7htGZU4t13EW/yG3o8n9wAOMq8xF7tQkyMuGde4dPrTPOgbLcC94uQgytkVOFd61WJ1bgkHYisXckGR2rruZmhTaQApvRa63NbkqnGXVoTqNQdWq6tK6WtLKallka2atLkEysCWXuhdrktbkTDcLSvIYTmzJGQm6nyYn6ASdoBN0gv9D8FeAAQD7bZlccR+RLgAAAABJRU5ErkJggg==";
|
|
10
7
|
const __vite_glob_0_3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAA8CAYAAAAOhRhuAAAAAXNSR0IArs4c6QAAALZJREFUaEPtlLENwCAMBGEilmAOhmNMmkTp0h1BLqzoIlGdYqzzm7rWukqir9oQTENDFFcNaYgMEDdDGiIDxM2QhsgAcTMUYmjOSXWOeGutPOf9bY2s9350If00xijP+dwQFY7kW4YiL6RaNqQhMkB8K0Pp1j7dw0iaI/nWyCIvpFo29E9D6bYs3TtEc4/kbhnZ1NA/DaVb+3QPI809krtlZFNDGiIDxM2QhsgAcTOkITJAPF2GbhF2A9gQfAOGAAAAAElFTkSuQmCC";
|
|
@@ -113,7 +110,6 @@
|
|
|
113
110
|
}
|
|
114
111
|
const D = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, R = "__vueuse_ssr_handlers__";
|
|
115
112
|
D[R] = D[R] || {};
|
|
116
|
-
D[R];
|
|
117
113
|
var q;
|
|
118
114
|
(function(e) {
|
|
119
115
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
@@ -155,7 +151,7 @@
|
|
|
155
151
|
ke({
|
|
156
152
|
linear: me
|
|
157
153
|
}, he);
|
|
158
|
-
const J = (e) => (vue.pushScopeId("data-v-b46fc003"), e = e(), vue.popScopeId(), e), we = { class: "hd" }, Oe = { class: "bd" }, Ie = /* @__PURE__ */ J(() => /* @__PURE__ */ vue.createElementVNode("h3", null, "
|
|
154
|
+
const J = (e) => (vue.pushScopeId("data-v-b46fc003"), e = e(), vue.popScopeId(), e), we = { class: "hd" }, Oe = { class: "bd" }, Ie = /* @__PURE__ */ J(() => /* @__PURE__ */ vue.createElementVNode("h3", null, "主题颜色", -1)), Ee = { class: "tColor" }, Pe = ["onMouseover", "onClick"], Me = { class: "bColor" }, Ae = ["onMouseover", "onClick"], $e = /* @__PURE__ */ J(() => /* @__PURE__ */ vue.createElementVNode("h3", null, "标准颜色", -1)), Te = { class: "tColor" }, Be = ["onMouseover", "onClick"], Ve = {
|
|
159
155
|
name: "colorPicker"
|
|
160
156
|
}, Ne = /* @__PURE__ */ vue.defineComponent({
|
|
161
157
|
...Ve,
|
|
@@ -220,13 +216,13 @@
|
|
|
220
216
|
l.stopPropagation();
|
|
221
217
|
})
|
|
222
218
|
}, [
|
|
223
|
-
vue.createCommentVNode("
|
|
219
|
+
vue.createCommentVNode(" 颜色显示小方块 "),
|
|
224
220
|
vue.createElementVNode("div", {
|
|
225
221
|
class: vue.normalizeClass(["colorBtn", { disabled: e.disabled }]),
|
|
226
222
|
style: vue.normalizeStyle(`background-color: ${vue.unref(a)}`),
|
|
227
223
|
onClick: p
|
|
228
224
|
}, null, 6),
|
|
229
|
-
vue.createCommentVNode("
|
|
225
|
+
vue.createCommentVNode(" 颜色色盘 "),
|
|
230
226
|
vue.createElementVNode("div", {
|
|
231
227
|
class: vue.normalizeClass(["box", { open: s.value }])
|
|
232
228
|
}, [
|
|
@@ -240,7 +236,7 @@
|
|
|
240
236
|
onClick: Y,
|
|
241
237
|
onMouseover: r[0] || (r[0] = (l) => d(e.defaultColor)),
|
|
242
238
|
onMouseout: r[1] || (r[1] = (l) => d(""))
|
|
243
|
-
}, "
|
|
239
|
+
}, "默认颜色", 32)
|
|
244
240
|
]),
|
|
245
241
|
vue.createElementVNode("div", Oe, [
|
|
246
242
|
Ie,
|
|
@@ -276,8 +272,8 @@
|
|
|
276
272
|
onClick: (f) => E(l)
|
|
277
273
|
}, null, 44, Be)), 64))
|
|
278
274
|
]),
|
|
279
|
-
vue.createElementVNode("h3", { onClick: X }, "
|
|
280
|
-
vue.createCommentVNode("
|
|
275
|
+
vue.createElementVNode("h3", { onClick: X }, "更多颜色..."),
|
|
276
|
+
vue.createCommentVNode(" 用以激活HTML5颜色面板 "),
|
|
281
277
|
vue.withDirectives(vue.createElementVNode("input", {
|
|
282
278
|
type: "color",
|
|
283
279
|
ref_key: "html5ColorEl",
|
|
@@ -311,7 +307,7 @@
|
|
|
311
307
|
colorPicker: O
|
|
312
308
|
};
|
|
313
309
|
const style = "";
|
|
314
|
-
const
|
|
310
|
+
const ToolBar_vue_vue_type_style_index_0_scoped_50235bb8_lang = "";
|
|
315
311
|
const ToolBar_vue_vue_type_style_index_1_lang = "";
|
|
316
312
|
const _export_sfc = (sfc, props) => {
|
|
317
313
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -320,7 +316,7 @@
|
|
|
320
316
|
}
|
|
321
317
|
return target;
|
|
322
318
|
};
|
|
323
|
-
const _sfc_main$
|
|
319
|
+
const _sfc_main$8 = {
|
|
324
320
|
components: {
|
|
325
321
|
ElTooltip: elementPlus.ElTooltip,
|
|
326
322
|
ElDivider: elementPlus.ElDivider,
|
|
@@ -341,15 +337,15 @@
|
|
|
341
337
|
activeImgType: false,
|
|
342
338
|
activeAlign: "",
|
|
343
339
|
alignMethods: [
|
|
344
|
-
{ value: "left", name: "
|
|
345
|
-
{ value: "right", name: "
|
|
346
|
-
{ value: "center", name: "
|
|
347
|
-
{ value: "justify", name: "
|
|
340
|
+
{ value: "left", name: "左对齐" },
|
|
341
|
+
{ value: "right", name: "右对齐" },
|
|
342
|
+
{ value: "center", name: "居中对齐" },
|
|
343
|
+
{ value: "justify", name: "两端对齐" }
|
|
348
344
|
],
|
|
349
345
|
activeFontsize: "17",
|
|
350
346
|
fontsizes: [
|
|
351
|
-
{ value: "17px", name: "17", desc: "
|
|
352
|
-
{ value: "18px", name: "18", desc: "
|
|
347
|
+
{ value: "17px", name: "17", desc: "默认正文字号" },
|
|
348
|
+
{ value: "18px", name: "18", desc: "默认标题字号" },
|
|
353
349
|
{ value: "19px", name: "19" },
|
|
354
350
|
{ value: "20px", name: "20" },
|
|
355
351
|
{ value: "24px", name: "24" },
|
|
@@ -430,7 +426,7 @@
|
|
|
430
426
|
this.editor.clearFormat();
|
|
431
427
|
},
|
|
432
428
|
setColor(val) {
|
|
433
|
-
console.log("
|
|
429
|
+
console.log("文字颜色");
|
|
434
430
|
this.updatePosition(() => {
|
|
435
431
|
this.editor.setColor(val);
|
|
436
432
|
});
|
|
@@ -489,6 +485,7 @@
|
|
|
489
485
|
this.popoverVisibleList = false;
|
|
490
486
|
this.popoverVisibleImg = false;
|
|
491
487
|
},
|
|
488
|
+
// todo 富文本设置样式位置会回到顶部
|
|
492
489
|
updatePosition(fn) {
|
|
493
490
|
const scrollTop = document.documentElement.scrollTop;
|
|
494
491
|
fn && fn();
|
|
@@ -521,15 +518,15 @@
|
|
|
521
518
|
}
|
|
522
519
|
}
|
|
523
520
|
};
|
|
524
|
-
const _hoisted_1$
|
|
521
|
+
const _hoisted_1$8 = {
|
|
525
522
|
key: 0,
|
|
526
523
|
class: "tools"
|
|
527
524
|
};
|
|
528
|
-
const _hoisted_2$
|
|
529
|
-
const _hoisted_3$
|
|
530
|
-
const _hoisted_4$
|
|
531
|
-
const _hoisted_5$
|
|
532
|
-
const _hoisted_6$
|
|
525
|
+
const _hoisted_2$5 = { class: "tools-content" };
|
|
526
|
+
const _hoisted_3$5 = ["src"];
|
|
527
|
+
const _hoisted_4$3 = ["src"];
|
|
528
|
+
const _hoisted_5$3 = ["src"];
|
|
529
|
+
const _hoisted_6$2 = { class: "box" };
|
|
533
530
|
const _hoisted_7$2 = ["src"];
|
|
534
531
|
const _hoisted_8$2 = {
|
|
535
532
|
key: 0,
|
|
@@ -539,10 +536,10 @@
|
|
|
539
536
|
const _hoisted_10$2 = ["src"];
|
|
540
537
|
const _hoisted_11$2 = { class: "tools-font" };
|
|
541
538
|
const _hoisted_12$2 = ["onClick"];
|
|
542
|
-
const _hoisted_13$
|
|
543
|
-
const _hoisted_14$
|
|
544
|
-
const _hoisted_15$
|
|
545
|
-
const _hoisted_16$
|
|
539
|
+
const _hoisted_13$1 = { style: { "font-size": "10px" } };
|
|
540
|
+
const _hoisted_14$1 = { class: "box" };
|
|
541
|
+
const _hoisted_15$1 = ["src"];
|
|
542
|
+
const _hoisted_16$1 = {
|
|
546
543
|
key: 0,
|
|
547
544
|
class: "box-mask"
|
|
548
545
|
};
|
|
@@ -568,12 +565,12 @@
|
|
|
568
565
|
key: 0,
|
|
569
566
|
class: "box-mask"
|
|
570
567
|
};
|
|
571
|
-
const _hoisted_30
|
|
572
|
-
const _hoisted_31
|
|
573
|
-
const _hoisted_32
|
|
574
|
-
const _hoisted_33
|
|
575
|
-
const _hoisted_34
|
|
576
|
-
const _hoisted_35
|
|
568
|
+
const _hoisted_30 = { class: "box" };
|
|
569
|
+
const _hoisted_31 = ["src"];
|
|
570
|
+
const _hoisted_32 = ["src"];
|
|
571
|
+
const _hoisted_33 = ["src"];
|
|
572
|
+
const _hoisted_34 = ["src"];
|
|
573
|
+
const _hoisted_35 = { class: "tools-title" };
|
|
577
574
|
const _hoisted_36 = ["src"];
|
|
578
575
|
const _hoisted_37 = ["src"];
|
|
579
576
|
const _hoisted_38 = { class: "tools-title_content" };
|
|
@@ -587,18 +584,18 @@
|
|
|
587
584
|
const _hoisted_43 = ["src"];
|
|
588
585
|
const _hoisted_44 = ["src"];
|
|
589
586
|
const _hoisted_45 = ["src"];
|
|
590
|
-
function _sfc_render$
|
|
587
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
591
588
|
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
592
589
|
const _component_el_divider = vue.resolveComponent("el-divider");
|
|
593
590
|
const _component_el_popover = vue.resolveComponent("el-popover");
|
|
594
591
|
const _component_colorPicker = vue.resolveComponent("colorPicker");
|
|
595
592
|
const _directive_click_outside = vue.resolveDirective("click-outside");
|
|
596
|
-
return $props.editor.fontInfo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
597
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
593
|
+
return $props.editor.fontInfo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
594
|
+
vue.createElementVNode("div", _hoisted_2$5, [
|
|
598
595
|
vue.createVNode(_component_el_tooltip, {
|
|
599
596
|
class: "item",
|
|
600
597
|
effect: "dark",
|
|
601
|
-
content: "
|
|
598
|
+
content: "撤回",
|
|
602
599
|
placement: "top"
|
|
603
600
|
}, {
|
|
604
601
|
default: vue.withCtx(() => [
|
|
@@ -610,14 +607,14 @@
|
|
|
610
607
|
height: "40",
|
|
611
608
|
alt: "",
|
|
612
609
|
onClick: _cache[0] || (_cache[0] = ($event) => $options.back($event))
|
|
613
|
-
}, null, 12, _hoisted_3$
|
|
610
|
+
}, null, 12, _hoisted_3$5)
|
|
614
611
|
]),
|
|
615
612
|
_: 1
|
|
616
613
|
}),
|
|
617
614
|
vue.createVNode(_component_el_tooltip, {
|
|
618
615
|
class: "item",
|
|
619
616
|
effect: "dark",
|
|
620
|
-
content: "
|
|
617
|
+
content: "反撤回",
|
|
621
618
|
placement: "top"
|
|
622
619
|
}, {
|
|
623
620
|
default: vue.withCtx(() => [
|
|
@@ -629,7 +626,7 @@
|
|
|
629
626
|
height: "40",
|
|
630
627
|
alt: "",
|
|
631
628
|
onClick: _cache[1] || (_cache[1] = ($event) => $options.forward($event))
|
|
632
|
-
}, null, 12, _hoisted_4$
|
|
629
|
+
}, null, 12, _hoisted_4$3)
|
|
633
630
|
]),
|
|
634
631
|
_: 1
|
|
635
632
|
}),
|
|
@@ -640,7 +637,7 @@
|
|
|
640
637
|
vue.createVNode(_component_el_tooltip, {
|
|
641
638
|
class: "item",
|
|
642
639
|
effect: "dark",
|
|
643
|
-
content: "
|
|
640
|
+
content: "清除格式",
|
|
644
641
|
placement: "top"
|
|
645
642
|
}, {
|
|
646
643
|
default: vue.withCtx(() => [
|
|
@@ -650,18 +647,18 @@
|
|
|
650
647
|
height: "40",
|
|
651
648
|
alt: "",
|
|
652
649
|
onClick: _cache[2] || (_cache[2] = (...args) => $options.clearFormat && $options.clearFormat(...args))
|
|
653
|
-
}, null, 8, _hoisted_5$
|
|
650
|
+
}, null, 8, _hoisted_5$3)
|
|
654
651
|
]),
|
|
655
652
|
_: 1
|
|
656
653
|
}),
|
|
657
654
|
vue.createVNode(_component_el_tooltip, {
|
|
658
655
|
class: "item",
|
|
659
656
|
effect: "dark",
|
|
660
|
-
content: "
|
|
657
|
+
content: "格式刷",
|
|
661
658
|
placement: "top"
|
|
662
659
|
}, {
|
|
663
660
|
default: vue.withCtx(() => [
|
|
664
|
-
vue.createElementVNode("div", _hoisted_6$
|
|
661
|
+
vue.createElementVNode("div", _hoisted_6$2, [
|
|
665
662
|
vue.createElementVNode("img", {
|
|
666
663
|
src: $options.getImageUrl("tools_refresh@3x.png"),
|
|
667
664
|
width: "40",
|
|
@@ -688,7 +685,7 @@
|
|
|
688
685
|
vue.createVNode(_component_el_tooltip, {
|
|
689
686
|
class: "item",
|
|
690
687
|
effect: "dark",
|
|
691
|
-
content: "
|
|
688
|
+
content: "字号",
|
|
692
689
|
placement: "top"
|
|
693
690
|
}, {
|
|
694
691
|
default: vue.withCtx(() => [
|
|
@@ -722,7 +719,7 @@
|
|
|
722
719
|
vue.createElementVNode("span", {
|
|
723
720
|
style: vue.normalizeStyle({ fontSize: item.value })
|
|
724
721
|
}, vue.toDisplayString(item.name), 5),
|
|
725
|
-
vue.createElementVNode("span", _hoisted_13$
|
|
722
|
+
vue.createElementVNode("span", _hoisted_13$1, vue.toDisplayString(item.desc), 1)
|
|
726
723
|
], 10, _hoisted_12$2);
|
|
727
724
|
}), 128))
|
|
728
725
|
])), [
|
|
@@ -738,11 +735,11 @@
|
|
|
738
735
|
vue.createVNode(_component_el_tooltip, {
|
|
739
736
|
class: "item",
|
|
740
737
|
effect: "dark",
|
|
741
|
-
content: "
|
|
738
|
+
content: "标题",
|
|
742
739
|
placement: "top"
|
|
743
740
|
}, {
|
|
744
741
|
default: vue.withCtx(() => [
|
|
745
|
-
vue.createElementVNode("div", _hoisted_14$
|
|
742
|
+
vue.createElementVNode("div", _hoisted_14$1, [
|
|
746
743
|
vue.createElementVNode("img", {
|
|
747
744
|
src: $options.getImageUrl("tools_title@3x.png"),
|
|
748
745
|
"data-editor-id": "makeHeader",
|
|
@@ -750,8 +747,8 @@
|
|
|
750
747
|
height: "40",
|
|
751
748
|
alt: "",
|
|
752
749
|
onClick: _cache[5] || (_cache[5] = ($event) => $options.setTitle($event, $data.statusInfo.title ? 0 : 1))
|
|
753
|
-
}, null, 8, _hoisted_15$
|
|
754
|
-
$data.statusInfo && $data.statusInfo.title ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16$
|
|
750
|
+
}, null, 8, _hoisted_15$1),
|
|
751
|
+
$data.statusInfo && $data.statusInfo.title ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16$1)) : vue.createCommentVNode("", true)
|
|
755
752
|
])
|
|
756
753
|
]),
|
|
757
754
|
_: 1
|
|
@@ -759,7 +756,7 @@
|
|
|
759
756
|
vue.createVNode(_component_el_tooltip, {
|
|
760
757
|
class: "item",
|
|
761
758
|
effect: "dark",
|
|
762
|
-
content: "
|
|
759
|
+
content: "加粗",
|
|
763
760
|
placement: "top"
|
|
764
761
|
}, {
|
|
765
762
|
default: vue.withCtx(() => [
|
|
@@ -787,7 +784,7 @@
|
|
|
787
784
|
vue.createVNode(_component_el_tooltip, {
|
|
788
785
|
class: "item",
|
|
789
786
|
effect: "dark",
|
|
790
|
-
content: "
|
|
787
|
+
content: "列表",
|
|
791
788
|
placement: "top"
|
|
792
789
|
}, {
|
|
793
790
|
default: vue.withCtx(() => [
|
|
@@ -821,13 +818,13 @@
|
|
|
821
818
|
onClick: _cache[8] || (_cache[8] = ($event) => $options.updatePosition(() => {
|
|
822
819
|
$options.setStyle("makeUnorderedList");
|
|
823
820
|
}))
|
|
824
|
-
}, "
|
|
821
|
+
}, "无序列表"),
|
|
825
822
|
vue.createElementVNode("li", {
|
|
826
823
|
"data-editor-id": "makeHeader",
|
|
827
824
|
onClick: _cache[9] || (_cache[9] = ($event) => $options.updatePosition(() => {
|
|
828
825
|
$options.setStyle("makeOrderedList");
|
|
829
826
|
}))
|
|
830
|
-
}, "
|
|
827
|
+
}, "有序列表")
|
|
831
828
|
])), [
|
|
832
829
|
[_directive_click_outside, $options.handlePopover]
|
|
833
830
|
])
|
|
@@ -838,7 +835,7 @@
|
|
|
838
835
|
vue.createVNode(_component_el_tooltip, {
|
|
839
836
|
class: "item",
|
|
840
837
|
effect: "dark",
|
|
841
|
-
content: "
|
|
838
|
+
content: "倾斜",
|
|
842
839
|
placement: "top"
|
|
843
840
|
}, {
|
|
844
841
|
default: vue.withCtx(() => [
|
|
@@ -858,7 +855,7 @@
|
|
|
858
855
|
vue.createVNode(_component_el_tooltip, {
|
|
859
856
|
class: "item",
|
|
860
857
|
effect: "dark",
|
|
861
|
-
content: "
|
|
858
|
+
content: "下划线",
|
|
862
859
|
placement: "top"
|
|
863
860
|
}, {
|
|
864
861
|
default: vue.withCtx(() => [
|
|
@@ -879,18 +876,18 @@
|
|
|
879
876
|
key: 0,
|
|
880
877
|
class: "item",
|
|
881
878
|
effect: "dark",
|
|
882
|
-
content: "
|
|
879
|
+
content: "链接",
|
|
883
880
|
placement: "top"
|
|
884
881
|
}, {
|
|
885
882
|
default: vue.withCtx(() => [
|
|
886
|
-
vue.createElementVNode("div", _hoisted_30
|
|
883
|
+
vue.createElementVNode("div", _hoisted_30, [
|
|
887
884
|
vue.createElementVNode("img", {
|
|
888
885
|
src: $options.getImageUrl("icon_web_link@2x.png"),
|
|
889
886
|
width: "40",
|
|
890
887
|
height: "40",
|
|
891
888
|
alt: "",
|
|
892
889
|
onClick: _cache[12] || (_cache[12] = (...args) => $options.insertLink && $options.insertLink(...args))
|
|
893
|
-
}, null, 8, _hoisted_31
|
|
890
|
+
}, null, 8, _hoisted_31)
|
|
894
891
|
])
|
|
895
892
|
]),
|
|
896
893
|
_: 1
|
|
@@ -898,7 +895,7 @@
|
|
|
898
895
|
vue.createVNode(_component_el_tooltip, {
|
|
899
896
|
class: "item",
|
|
900
897
|
effect: "dark",
|
|
901
|
-
content: "
|
|
898
|
+
content: "首行缩进",
|
|
902
899
|
placement: "top"
|
|
903
900
|
}, {
|
|
904
901
|
default: vue.withCtx(() => [
|
|
@@ -908,14 +905,14 @@
|
|
|
908
905
|
height: "40",
|
|
909
906
|
alt: "",
|
|
910
907
|
onClick: _cache[13] || (_cache[13] = ($event) => $options.setStyle("setIndent"))
|
|
911
|
-
}, null, 8, _hoisted_32
|
|
908
|
+
}, null, 8, _hoisted_32)
|
|
912
909
|
]),
|
|
913
910
|
_: 1
|
|
914
911
|
}),
|
|
915
912
|
vue.createVNode(_component_el_tooltip, {
|
|
916
913
|
class: "item",
|
|
917
914
|
effect: "dark",
|
|
918
|
-
content: "
|
|
915
|
+
content: "文字颜色",
|
|
919
916
|
placement: "top"
|
|
920
917
|
}, {
|
|
921
918
|
default: vue.withCtx(() => [
|
|
@@ -928,13 +925,13 @@
|
|
|
928
925
|
width: "24",
|
|
929
926
|
height: "40",
|
|
930
927
|
alt: ""
|
|
931
|
-
}, null, 8, _hoisted_33
|
|
928
|
+
}, null, 8, _hoisted_33),
|
|
932
929
|
vue.createElementVNode("img", {
|
|
933
930
|
src: $options.getImageUrl("tools_arrow@3x.png"),
|
|
934
931
|
width: "16",
|
|
935
932
|
height: "40",
|
|
936
933
|
alt: ""
|
|
937
|
-
}, null, 8, _hoisted_34
|
|
934
|
+
}, null, 8, _hoisted_34),
|
|
938
935
|
vue.createVNode(_component_colorPicker, {
|
|
939
936
|
ref: "colorPicker",
|
|
940
937
|
modelValue: $data.color,
|
|
@@ -955,11 +952,11 @@
|
|
|
955
952
|
width: "152"
|
|
956
953
|
}, {
|
|
957
954
|
reference: vue.withCtx(() => [
|
|
958
|
-
vue.createElementVNode("div", _hoisted_35
|
|
955
|
+
vue.createElementVNode("div", _hoisted_35, [
|
|
959
956
|
vue.createVNode(_component_el_tooltip, {
|
|
960
957
|
class: "item",
|
|
961
958
|
effect: "dark",
|
|
962
|
-
content: "
|
|
959
|
+
content: "对齐方式",
|
|
963
960
|
placement: "top"
|
|
964
961
|
}, {
|
|
965
962
|
default: vue.withCtx(() => [
|
|
@@ -1017,7 +1014,7 @@
|
|
|
1017
1014
|
vue.createVNode(_component_el_tooltip, {
|
|
1018
1015
|
class: "item",
|
|
1019
1016
|
effect: "dark",
|
|
1020
|
-
content: "
|
|
1017
|
+
content: "插入图片",
|
|
1021
1018
|
placement: "top"
|
|
1022
1019
|
}, {
|
|
1023
1020
|
default: vue.withCtx(() => [
|
|
@@ -1039,11 +1036,11 @@
|
|
|
1039
1036
|
vue.createElementVNode("li", {
|
|
1040
1037
|
class: vue.normalizeClass([$data.activeImgType === "normal" ? "active" : ""]),
|
|
1041
1038
|
onClick: _cache[18] || (_cache[18] = ($event) => $options.insertImg("normal"))
|
|
1042
|
-
}, vue.toDisplayString("
|
|
1039
|
+
}, vue.toDisplayString("上传图片"), 2),
|
|
1043
1040
|
vue.createElementVNode("li", {
|
|
1044
1041
|
class: vue.normalizeClass([$data.activeImgType === "seamless" ? "active" : ""]),
|
|
1045
1042
|
onClick: _cache[19] || (_cache[19] = ($event) => $options.insertImg("seamless"))
|
|
1046
|
-
}, vue.toDisplayString("
|
|
1043
|
+
}, vue.toDisplayString("上传无缝拼接图片"), 2)
|
|
1047
1044
|
])), [
|
|
1048
1045
|
[_directive_click_outside, $options.handlePopover]
|
|
1049
1046
|
])
|
|
@@ -1054,7 +1051,7 @@
|
|
|
1054
1051
|
key: 2,
|
|
1055
1052
|
class: "item",
|
|
1056
1053
|
effect: "dark",
|
|
1057
|
-
content: "
|
|
1054
|
+
content: "插入视频",
|
|
1058
1055
|
placement: "top"
|
|
1059
1056
|
}, {
|
|
1060
1057
|
default: vue.withCtx(() => [
|
|
@@ -1072,7 +1069,7 @@
|
|
|
1072
1069
|
key: 3,
|
|
1073
1070
|
class: "item",
|
|
1074
1071
|
effect: "dark",
|
|
1075
|
-
content: "
|
|
1072
|
+
content: "插入文章/视频",
|
|
1076
1073
|
placement: "top"
|
|
1077
1074
|
}, {
|
|
1078
1075
|
default: vue.withCtx(() => [
|
|
@@ -1090,7 +1087,7 @@
|
|
|
1090
1087
|
key: 4,
|
|
1091
1088
|
class: "item",
|
|
1092
1089
|
effect: "dark",
|
|
1093
|
-
content: "
|
|
1090
|
+
content: "采集文章",
|
|
1094
1091
|
placement: "top"
|
|
1095
1092
|
}, {
|
|
1096
1093
|
default: vue.withCtx(() => [
|
|
@@ -1107,20 +1104,16 @@
|
|
|
1107
1104
|
])
|
|
1108
1105
|
])) : vue.createCommentVNode("", true);
|
|
1109
1106
|
}
|
|
1110
|
-
const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1107
|
+
const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$4], ["__scopeId", "data-v-50235bb8"]]);
|
|
1111
1108
|
const __vite_glob_0_0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAmCAYAAAClI5npAAAA0UlEQVR42uWYwQnDMAxFfckAXkFDmGzgS1foDpnFS3gTb+IFtIDyA4UeBKUtNR8qwTvlkAdyfmSletySmRUwgIIJOijXs9VcLxegwNVDRFYLdHtdCg6wrRKY9l4NUFYIqH1WDeTfCXxXE9w5Ar4tQhBwh7SBjSDg2lJJAj47SAI+OwgC7pDuJAGfHQQBnx0kAZ8dBAF3SOtTgCchybjV2QLKFpihW6BAQn6GA0i4KG4g037H4QaSDiTWUMocyweQcFezBjLrer5TFxR/uaKhL6lOdeUQ8G6X1pQAAAAASUVORK5CYII=";
|
|
1112
|
-
const
|
|
1113
|
-
const
|
|
1114
|
-
const
|
|
1115
|
-
const _hoisted_3$6 = /* @__PURE__ */ vue.createElementVNode("span", { class: "basic-dialog_divider" }, null, -1);
|
|
1116
|
-
const _hoisted_4$5 = {
|
|
1109
|
+
const _hoisted_1$7 = { key: 0 };
|
|
1110
|
+
const _hoisted_2$4 = { class: "basic-dialog_title" };
|
|
1111
|
+
const _hoisted_3$4 = {
|
|
1117
1112
|
key: 0,
|
|
1118
1113
|
class: "dialog-footer"
|
|
1119
1114
|
};
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
1123
|
-
name: "index",
|
|
1115
|
+
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
1116
|
+
__name: "index",
|
|
1124
1117
|
props: {
|
|
1125
1118
|
visible: { type: Boolean, default: false },
|
|
1126
1119
|
showBtn: { type: Boolean, default: true },
|
|
@@ -1128,9 +1121,10 @@
|
|
|
1128
1121
|
showTitle: { type: Boolean, default: true }
|
|
1129
1122
|
},
|
|
1130
1123
|
emits: ["submit", "cancel"],
|
|
1131
|
-
setup(__props, { emit:
|
|
1124
|
+
setup(__props, { emit: __emit }) {
|
|
1132
1125
|
const props = __props;
|
|
1133
1126
|
const parent = vue.inject("vm");
|
|
1127
|
+
const emits = __emit;
|
|
1134
1128
|
const handleClose = () => {
|
|
1135
1129
|
var _a;
|
|
1136
1130
|
(_a = parent.setStatus) == null ? void 0 : _a.call(parent, false);
|
|
@@ -1152,31 +1146,31 @@
|
|
|
1152
1146
|
});
|
|
1153
1147
|
return (_ctx, _cache) => {
|
|
1154
1148
|
return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElDialog), {
|
|
1155
|
-
modelValue:
|
|
1156
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
1149
|
+
modelValue: dialogVisible.value,
|
|
1150
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dialogVisible.value = $event),
|
|
1157
1151
|
"before-close": handleClose,
|
|
1158
|
-
width:
|
|
1159
|
-
class: vue.normalizeClass(["basic-dialog", { "hide-title": !
|
|
1152
|
+
width: _ctx.width,
|
|
1153
|
+
class: vue.normalizeClass(["basic-dialog", { "hide-title": !_ctx.showTitle }])
|
|
1160
1154
|
}, {
|
|
1161
1155
|
header: vue.withCtx(() => [
|
|
1162
|
-
|
|
1163
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
1164
|
-
|
|
1156
|
+
_ctx.showTitle ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
|
|
1157
|
+
vue.createElementVNode("div", _hoisted_2$4, [
|
|
1158
|
+
_cache[1] || (_cache[1] = vue.createElementVNode("span", { class: "basic-dialog_divider" }, null, -1)),
|
|
1165
1159
|
vue.renderSlot(_ctx.$slots, "title")
|
|
1166
1160
|
])
|
|
1167
1161
|
])) : vue.createCommentVNode("", true)
|
|
1168
1162
|
]),
|
|
1169
1163
|
footer: vue.withCtx(() => [
|
|
1170
|
-
|
|
1164
|
+
_ctx.showBtn ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$4, [
|
|
1171
1165
|
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
1172
1166
|
style: { "width": "120px", "border-color": "#cccccc", "color": "#333333" },
|
|
1173
1167
|
plain: "",
|
|
1174
1168
|
round: "",
|
|
1175
1169
|
onClick: handleClose
|
|
1176
1170
|
}, {
|
|
1177
|
-
default: vue.withCtx(() => [
|
|
1178
|
-
|
|
1179
|
-
]),
|
|
1171
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
1172
|
+
vue.createTextVNode("取消")
|
|
1173
|
+
])),
|
|
1180
1174
|
_: 1
|
|
1181
1175
|
}),
|
|
1182
1176
|
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
@@ -1185,9 +1179,9 @@
|
|
|
1185
1179
|
type: "primary",
|
|
1186
1180
|
onClick: confirm
|
|
1187
1181
|
}, {
|
|
1188
|
-
default: vue.withCtx(() => [
|
|
1189
|
-
|
|
1190
|
-
]),
|
|
1182
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
1183
|
+
vue.createTextVNode("确认")
|
|
1184
|
+
])),
|
|
1191
1185
|
_: 1
|
|
1192
1186
|
})
|
|
1193
1187
|
])) : vue.createCommentVNode("", true)
|
|
@@ -1200,16 +1194,18 @@
|
|
|
1200
1194
|
};
|
|
1201
1195
|
}
|
|
1202
1196
|
});
|
|
1197
|
+
const index_vue_vue_type_style_index_0_lang$5 = "";
|
|
1203
1198
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1204
1199
|
function getDefaultExportFromCjs(x) {
|
|
1205
1200
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1206
1201
|
}
|
|
1207
|
-
var date$
|
|
1208
|
-
|
|
1202
|
+
var date$2 = { exports: {} };
|
|
1203
|
+
var date = date$2.exports;
|
|
1204
|
+
Object.defineProperty(date, "__esModule", { value: true });
|
|
1209
1205
|
function replacementDate(data, fmt) {
|
|
1210
1206
|
for (var k in data) {
|
|
1211
1207
|
if (new RegExp("(" + k + ")").test(fmt)) {
|
|
1212
|
-
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? data[k] :
|
|
1208
|
+
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? data[k] : "00".concat(data[k]).substr(("" + data[k]).length));
|
|
1213
1209
|
}
|
|
1214
1210
|
}
|
|
1215
1211
|
return fmt;
|
|
@@ -1220,126 +1216,130 @@
|
|
|
1220
1216
|
}
|
|
1221
1217
|
return fmt;
|
|
1222
1218
|
}
|
|
1223
|
-
var DateClass =
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
"
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1219
|
+
var DateClass = (
|
|
1220
|
+
/** @class */
|
|
1221
|
+
function() {
|
|
1222
|
+
function DateClass2() {
|
|
1223
|
+
}
|
|
1224
|
+
DateClass2.prototype.format = function(date2, fmt) {
|
|
1225
|
+
if (fmt === void 0) {
|
|
1226
|
+
fmt = "YYYY-MM-DD HH:mm:ss";
|
|
1227
|
+
}
|
|
1228
|
+
if (!date2)
|
|
1229
|
+
return "";
|
|
1230
|
+
var timeData = typeof date2 === "string" ? new Date(date2.replace(/-/g, "/")) : date2;
|
|
1231
|
+
timeData = typeof date2 === "number" ? new Date(date2) : timeData;
|
|
1232
|
+
var o = {
|
|
1233
|
+
"M+": timeData.getMonth() + 1,
|
|
1234
|
+
"D+": timeData.getDate(),
|
|
1235
|
+
"h+": timeData.getHours() % 12 === 0 ? 12 : timeData.getHours() % 12,
|
|
1236
|
+
"H+": timeData.getHours(),
|
|
1237
|
+
"m+": timeData.getMinutes(),
|
|
1238
|
+
"s+": timeData.getSeconds(),
|
|
1239
|
+
"q+": Math.floor((timeData.getMonth() + 3) / 3),
|
|
1240
|
+
"S": timeData.getMilliseconds()
|
|
1241
|
+
};
|
|
1242
|
+
var week = {
|
|
1243
|
+
"0": "日",
|
|
1244
|
+
"1": "一",
|
|
1245
|
+
"2": "二",
|
|
1246
|
+
"3": "三",
|
|
1247
|
+
"4": "四",
|
|
1248
|
+
"5": "五",
|
|
1249
|
+
"6": "六"
|
|
1250
|
+
};
|
|
1251
|
+
fmt = replacementYear(timeData, fmt);
|
|
1252
|
+
if (/(E+)/.test(fmt)) {
|
|
1253
|
+
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "星期" : "周" : "") + week["".concat(timeData.getDay(), " ")]);
|
|
1254
|
+
}
|
|
1255
|
+
return replacementDate(o, fmt);
|
|
1243
1256
|
};
|
|
1244
|
-
|
|
1245
|
-
"
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
"3": "\u4E09",
|
|
1249
|
-
"4": "\u56DB",
|
|
1250
|
-
"5": "\u4E94",
|
|
1251
|
-
"6": "\u516D"
|
|
1257
|
+
DateClass2.prototype.addDaysToDate = function(date2, days) {
|
|
1258
|
+
var d = typeof date2 === "object" ? date2 : new Date(date2);
|
|
1259
|
+
d.setDate(d.getDate() + days);
|
|
1260
|
+
return d.toISOString().split("T")[0];
|
|
1252
1261
|
};
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
var hh = Math.floor(ts / 1e3 / 60 / 60 % 24);
|
|
1271
|
-
var mm = Math.floor(ts / 1e3 / 60 % 60);
|
|
1272
|
-
var ss = Math.floor(ts / 1e3 % 60);
|
|
1273
|
-
if (ts <= 0)
|
|
1274
|
-
return false;
|
|
1275
|
-
return {
|
|
1276
|
-
dd: dd < 10 ? "0" + dd : dd,
|
|
1277
|
-
hh: hh < 10 ? "0" + hh : hh,
|
|
1278
|
-
mm: mm < 10 ? "0" + mm : mm,
|
|
1279
|
-
ss: ss < 10 ? "0" + ss : ss
|
|
1262
|
+
DateClass2.prototype.remainTime = function(endTime, startTime) {
|
|
1263
|
+
if (startTime === void 0) {
|
|
1264
|
+
startTime = /* @__PURE__ */ new Date();
|
|
1265
|
+
}
|
|
1266
|
+
var ts = Number(endTime) - Number(startTime);
|
|
1267
|
+
var dd = Math.floor(ts / 1e3 / 60 / 60 / 24);
|
|
1268
|
+
var hh = Math.floor(ts / 1e3 / 60 / 60 % 24);
|
|
1269
|
+
var mm = Math.floor(ts / 1e3 / 60 % 60);
|
|
1270
|
+
var ss = Math.floor(ts / 1e3 % 60);
|
|
1271
|
+
if (ts <= 0)
|
|
1272
|
+
return false;
|
|
1273
|
+
return {
|
|
1274
|
+
dd: dd < 10 ? "0".concat(dd) : dd,
|
|
1275
|
+
hh: hh < 10 ? "0".concat(hh) : hh,
|
|
1276
|
+
mm: mm < 10 ? "0".concat(mm) : mm,
|
|
1277
|
+
ss: ss < 10 ? "0".concat(ss) : ss
|
|
1278
|
+
};
|
|
1280
1279
|
};
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1280
|
+
DateClass2.prototype.formatPassTime = function(startTime) {
|
|
1281
|
+
var currentTime = /* @__PURE__ */ new Date();
|
|
1282
|
+
var time = currentTime - startTime;
|
|
1283
|
+
var year = Math.floor(time / (1e3 * 60 * 60 * 24) / 30 / 12);
|
|
1284
|
+
if (year)
|
|
1285
|
+
return "".concat(year, "年前");
|
|
1286
|
+
var month = Math.floor(time / (1e3 * 60 * 60 * 24) / 30);
|
|
1287
|
+
if (month)
|
|
1288
|
+
return "".concat(month, "个月前");
|
|
1289
|
+
var day = Math.floor(time / (1e3 * 60 * 60 * 24));
|
|
1290
|
+
if (day)
|
|
1291
|
+
return "".concat(day, "天前");
|
|
1292
|
+
var hour = Math.floor(time / (1e3 * 60 * 60));
|
|
1293
|
+
if (hour)
|
|
1294
|
+
return "".concat(hour, "小时前");
|
|
1295
|
+
var min = Math.floor(time / (1e3 * 60));
|
|
1296
|
+
if (min)
|
|
1297
|
+
return "".concat(min, "分钟前");
|
|
1298
|
+
else
|
|
1299
|
+
return "刚刚";
|
|
1300
|
+
};
|
|
1301
|
+
DateClass2.prototype.formatPassTimeForList = function(time) {
|
|
1302
|
+
return DateClass2.prototype.formatPassTimeForDetail(time, "YYYY年MM月DD日", true);
|
|
1303
|
+
};
|
|
1304
|
+
DateClass2.prototype.formatPassTimeForDetail = function(time, fmt, noYear) {
|
|
1305
|
+
if (fmt === void 0) {
|
|
1306
|
+
fmt = "YYYY-MM-DD";
|
|
1307
|
+
}
|
|
1308
|
+
var date2 = typeof time === "number" ? new Date(time) : new Date((time || "").replace(/-/g, "/"));
|
|
1309
|
+
var diff = ((/* @__PURE__ */ new Date()).getTime() - date2.getTime()) / 1e3;
|
|
1310
|
+
var dayDiff = Math.floor(diff / 86400);
|
|
1311
|
+
var isValidDate = Object.prototype.toString.call(date2) === "[object Date]" && !isNaN(date2.getTime());
|
|
1312
|
+
if (!isValidDate)
|
|
1313
|
+
return "";
|
|
1314
|
+
var formatDate = function() {
|
|
1315
|
+
var today = new Date(date2);
|
|
1316
|
+
var o = {
|
|
1317
|
+
"Y+": today.getFullYear(),
|
|
1318
|
+
"M+": ("0" + (today.getMonth() + 1)).slice(-2),
|
|
1319
|
+
"D+": ("0" + today.getDate()).slice(-2)
|
|
1320
|
+
};
|
|
1321
|
+
fmt = replacementYear(date2, fmt);
|
|
1322
|
+
var year = today.getFullYear();
|
|
1323
|
+
if (!((/* @__PURE__ */ new Date()).getFullYear() > year) && noYear) {
|
|
1324
|
+
var backData = replacementDate(o, fmt);
|
|
1325
|
+
return backData.split("年")[1];
|
|
1326
|
+
}
|
|
1327
|
+
return replacementDate(o, fmt);
|
|
1322
1328
|
};
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
if (
|
|
1326
|
-
|
|
1327
|
-
return backData.split("\u5E74")[1];
|
|
1329
|
+
if (dayDiff === -1) {
|
|
1330
|
+
return "刚刚";
|
|
1331
|
+
} else if (isNaN(dayDiff) || dayDiff < 0 || dayDiff >= 15) {
|
|
1332
|
+
return formatDate();
|
|
1328
1333
|
}
|
|
1329
|
-
return
|
|
1334
|
+
return dayDiff === 0 && (diff < 60 && "刚刚" || diff < 120 && "1分钟前" || diff < 3600 && Math.floor(diff / 60) + "分钟前" || diff < 7200 && "1小时前" || diff < 86400 && Math.floor(diff / 3600) + "小时前") || dayDiff < 16 && dayDiff + "天前";
|
|
1330
1335
|
};
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
return DateClass2;
|
|
1339
|
-
}();
|
|
1340
|
-
date$1.exports = new DateClass();
|
|
1341
|
-
const date = /* @__PURE__ */ getDefaultExportFromCjs(date$1.exports);
|
|
1342
|
-
var tools$1 = { exports: {} };
|
|
1336
|
+
return DateClass2;
|
|
1337
|
+
}()
|
|
1338
|
+
);
|
|
1339
|
+
date$2.exports = new DateClass();
|
|
1340
|
+
var dateExports = date$2.exports;
|
|
1341
|
+
const date$1 = /* @__PURE__ */ getDefaultExportFromCjs(dateExports);
|
|
1342
|
+
var tools$2 = { exports: {} };
|
|
1343
1343
|
var _listCacheClear;
|
|
1344
1344
|
var hasRequired_listCacheClear;
|
|
1345
1345
|
function require_listCacheClear() {
|
|
@@ -2246,6 +2246,7 @@
|
|
|
2246
2246
|
stubFalse_1 = stubFalse;
|
|
2247
2247
|
return stubFalse_1;
|
|
2248
2248
|
}
|
|
2249
|
+
isBuffer.exports;
|
|
2249
2250
|
var hasRequiredIsBuffer;
|
|
2250
2251
|
function requireIsBuffer() {
|
|
2251
2252
|
if (hasRequiredIsBuffer)
|
|
@@ -2325,6 +2326,7 @@
|
|
|
2325
2326
|
return _baseUnary;
|
|
2326
2327
|
}
|
|
2327
2328
|
var _nodeUtil = { exports: {} };
|
|
2329
|
+
_nodeUtil.exports;
|
|
2328
2330
|
var hasRequired_nodeUtil;
|
|
2329
2331
|
function require_nodeUtil() {
|
|
2330
2332
|
if (hasRequired_nodeUtil)
|
|
@@ -2374,7 +2376,11 @@
|
|
|
2374
2376
|
function arrayLikeKeys(value, inherited) {
|
|
2375
2377
|
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
2376
2378
|
for (var key in value) {
|
|
2377
|
-
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes &&
|
|
2379
|
+
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
2380
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
2381
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
2382
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
2383
|
+
isIndex(key, length)))) {
|
|
2378
2384
|
result.push(key);
|
|
2379
2385
|
}
|
|
2380
2386
|
}
|
|
@@ -2554,6 +2560,7 @@
|
|
|
2554
2560
|
return _baseAssignIn;
|
|
2555
2561
|
}
|
|
2556
2562
|
var _cloneBuffer = { exports: {} };
|
|
2563
|
+
_cloneBuffer.exports;
|
|
2557
2564
|
var hasRequired_cloneBuffer;
|
|
2558
2565
|
function require_cloneBuffer() {
|
|
2559
2566
|
if (hasRequired_cloneBuffer)
|
|
@@ -3218,296 +3225,295 @@
|
|
|
3218
3225
|
}
|
|
3219
3226
|
return clipboardCopy_1;
|
|
3220
3227
|
}
|
|
3221
|
-
|
|
3228
|
+
var tools = tools$2.exports;
|
|
3229
|
+
Object.defineProperty(tools, "__esModule", { value: true });
|
|
3222
3230
|
var previous = 0;
|
|
3223
3231
|
var timeout = null;
|
|
3224
|
-
var ToolsClass =
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3232
|
+
var ToolsClass = (
|
|
3233
|
+
/** @class */
|
|
3234
|
+
function() {
|
|
3235
|
+
function ToolsClass2() {
|
|
3236
|
+
var _this = this;
|
|
3237
|
+
this.stopScroll = function(className) {
|
|
3238
|
+
if (!(window && window.document)) {
|
|
3239
|
+
return new Error("仅支持浏览器");
|
|
3240
|
+
}
|
|
3241
|
+
var html = document.documentElement;
|
|
3242
|
+
html.style.overflow = "hidden";
|
|
3243
|
+
html.style.height = "100%";
|
|
3244
|
+
var body = document.body;
|
|
3245
|
+
body.style.overflow = "hidden";
|
|
3246
|
+
body.style.height = "100%";
|
|
3247
|
+
if (className) {
|
|
3248
|
+
var dom = document.querySelector(".".concat(className));
|
|
3249
|
+
dom && dom.addEventListener("touchmove", _this.__setDefault__);
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
this.startScroll = function(className) {
|
|
3253
|
+
if (!(window && window.document)) {
|
|
3254
|
+
return new Error("仅支持浏览器");
|
|
3255
|
+
}
|
|
3256
|
+
var html = document.documentElement;
|
|
3257
|
+
html.style.overflow = "visible";
|
|
3258
|
+
html.style.height = "auto";
|
|
3259
|
+
var body = document.body;
|
|
3260
|
+
body.style.overflow = "visible";
|
|
3261
|
+
body.style.height = "auto";
|
|
3262
|
+
if (className) {
|
|
3263
|
+
var dom = document.querySelector(".".concat(className));
|
|
3264
|
+
dom && dom.removeEventListener("touchmove", _this.__setDefault__);
|
|
3265
|
+
}
|
|
3266
|
+
};
|
|
3267
|
+
this.objectToArray = function(obj) {
|
|
3268
|
+
var arr = [];
|
|
3269
|
+
if (typeof obj === "object") {
|
|
3270
|
+
for (var key in obj) {
|
|
3271
|
+
if (obj.hasOwnProperty(key)) {
|
|
3272
|
+
arr.push([key, obj[key]].join("="));
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
return arr;
|
|
3277
|
+
};
|
|
3278
|
+
this.convertKeyValueEnum = function(obj) {
|
|
3279
|
+
var result = {};
|
|
3280
|
+
if (typeof obj === "object") {
|
|
3281
|
+
for (var key in obj) {
|
|
3282
|
+
if (obj.hasOwnProperty(key)) {
|
|
3283
|
+
result[obj[key]] = key;
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
return result;
|
|
3288
|
+
};
|
|
3289
|
+
this.isDefined = function(val) {
|
|
3290
|
+
return val !== void 0 && val !== null;
|
|
3291
|
+
};
|
|
3292
|
+
this.__loaded__ = {};
|
|
3293
|
+
this.__setDefault__ = function(e) {
|
|
3294
|
+
e && e.preventDefault();
|
|
3295
|
+
};
|
|
3296
|
+
}
|
|
3297
|
+
ToolsClass2.prototype.deepCopy = function(data) {
|
|
3298
|
+
return JSON.parse(JSON.stringify(data));
|
|
3299
|
+
};
|
|
3300
|
+
ToolsClass2.prototype.deepCopy2 = function(obj) {
|
|
3301
|
+
var _obj = Array.isArray(obj) ? [] : {};
|
|
3302
|
+
for (var i in obj) {
|
|
3303
|
+
_obj[i] = typeof obj[i] === "object" ? this.deepCopy2(obj[i]) : obj[i];
|
|
3240
3304
|
}
|
|
3305
|
+
return _obj;
|
|
3306
|
+
};
|
|
3307
|
+
ToolsClass2.prototype.deepCopy3 = function(obj) {
|
|
3308
|
+
var deepcopy = requireCloneDeep();
|
|
3309
|
+
return deepcopy(obj);
|
|
3241
3310
|
};
|
|
3242
|
-
|
|
3311
|
+
ToolsClass2.prototype.debounce = function(func, wait) {
|
|
3312
|
+
var delay = function() {
|
|
3313
|
+
var args = arguments;
|
|
3314
|
+
if (timeout)
|
|
3315
|
+
clearTimeout(timeout);
|
|
3316
|
+
timeout = setTimeout(function() {
|
|
3317
|
+
func.apply(delay, args);
|
|
3318
|
+
}, wait);
|
|
3319
|
+
};
|
|
3320
|
+
return delay;
|
|
3321
|
+
};
|
|
3322
|
+
ToolsClass2.prototype.throttle = function(func, wait) {
|
|
3323
|
+
var delay = function() {
|
|
3324
|
+
var now = Date.now();
|
|
3325
|
+
if (now - previous > wait) {
|
|
3326
|
+
func.apply(delay, arguments);
|
|
3327
|
+
previous = now;
|
|
3328
|
+
}
|
|
3329
|
+
};
|
|
3330
|
+
return delay;
|
|
3331
|
+
};
|
|
3332
|
+
ToolsClass2.prototype.getUrlName = function(url) {
|
|
3333
|
+
return url && url.split("?")[0].split("/").reverse()[0];
|
|
3334
|
+
};
|
|
3335
|
+
ToolsClass2.prototype.loadJs = function(url) {
|
|
3336
|
+
var _this = this;
|
|
3337
|
+
if (!(window && window.document)) {
|
|
3338
|
+
return new Error("仅支持浏览器");
|
|
3339
|
+
}
|
|
3340
|
+
var name = this.getUrlName(url);
|
|
3341
|
+
var id = "js_" + name;
|
|
3342
|
+
return new Promise(function(resolve, reject) {
|
|
3343
|
+
if (_this.__loaded__[id]) {
|
|
3344
|
+
return resolve();
|
|
3345
|
+
}
|
|
3346
|
+
var script = document.createElement("script");
|
|
3347
|
+
script.type = "text/javascript";
|
|
3348
|
+
script.async = true;
|
|
3349
|
+
script.src = url;
|
|
3350
|
+
script.id = id;
|
|
3351
|
+
script.onload = function() {
|
|
3352
|
+
_this.__loaded__[id] = true;
|
|
3353
|
+
resolve();
|
|
3354
|
+
};
|
|
3355
|
+
script.onerror = function(e) {
|
|
3356
|
+
reject(e);
|
|
3357
|
+
};
|
|
3358
|
+
document.body.appendChild(script);
|
|
3359
|
+
});
|
|
3360
|
+
};
|
|
3361
|
+
ToolsClass2.prototype.loadCss = function(url) {
|
|
3362
|
+
var _this = this;
|
|
3363
|
+
if (!(window && window.document)) {
|
|
3364
|
+
return new Error("仅支持浏览器");
|
|
3365
|
+
}
|
|
3366
|
+
var name = this.getUrlName(url);
|
|
3367
|
+
var id = "css_" + name;
|
|
3368
|
+
return new Promise(function(resolve, reject) {
|
|
3369
|
+
if (_this.__loaded__[id]) {
|
|
3370
|
+
return resolve();
|
|
3371
|
+
}
|
|
3372
|
+
var link = document.createElement("link");
|
|
3373
|
+
link.type = "text/css";
|
|
3374
|
+
link.rel = "stylesheet";
|
|
3375
|
+
link.href = url;
|
|
3376
|
+
link.id = id;
|
|
3377
|
+
link.onload = function() {
|
|
3378
|
+
_this.__loaded__[id] = true;
|
|
3379
|
+
resolve();
|
|
3380
|
+
};
|
|
3381
|
+
link.onerror = function(e) {
|
|
3382
|
+
reject(e);
|
|
3383
|
+
};
|
|
3384
|
+
document.head.appendChild(link);
|
|
3385
|
+
});
|
|
3386
|
+
};
|
|
3387
|
+
ToolsClass2.prototype.clipboard = function(str) {
|
|
3243
3388
|
if (!(window && window.document)) {
|
|
3244
|
-
return new Error("
|
|
3245
|
-
}
|
|
3246
|
-
var html = document.documentElement;
|
|
3247
|
-
html.style.overflow = "visible";
|
|
3248
|
-
html.style.height = "auto";
|
|
3249
|
-
var body = document.body;
|
|
3250
|
-
body.style.overflow = "visible";
|
|
3251
|
-
body.style.height = "auto";
|
|
3252
|
-
if (className) {
|
|
3253
|
-
var dom = document.querySelector("." + className);
|
|
3254
|
-
dom && dom.removeEventListener("touchmove", _this.__setDefault__);
|
|
3389
|
+
return new Error("仅支持浏览器");
|
|
3255
3390
|
}
|
|
3391
|
+
var copy = requireClipboardCopy();
|
|
3392
|
+
return copy(str);
|
|
3256
3393
|
};
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3394
|
+
ToolsClass2.prototype.firstUpperCase = function(str) {
|
|
3395
|
+
return str.charAt(0).toUpperCase() + str.toString().slice(1);
|
|
3396
|
+
};
|
|
3397
|
+
ToolsClass2.prototype.slice = function(target, length) {
|
|
3398
|
+
if (target === void 0) {
|
|
3399
|
+
target = "";
|
|
3400
|
+
}
|
|
3401
|
+
if (length === void 0) {
|
|
3402
|
+
length = 0;
|
|
3265
3403
|
}
|
|
3266
|
-
return
|
|
3404
|
+
return target.slice(0, length);
|
|
3267
3405
|
};
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
for (var key in obj) {
|
|
3272
|
-
if (obj.hasOwnProperty(key)) {
|
|
3273
|
-
result[obj[key]] = key;
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3406
|
+
ToolsClass2.prototype.guid = function() {
|
|
3407
|
+
function S4() {
|
|
3408
|
+
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
3276
3409
|
}
|
|
3277
|
-
return
|
|
3410
|
+
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
|
|
3278
3411
|
};
|
|
3279
|
-
|
|
3280
|
-
|
|
3412
|
+
ToolsClass2.prototype.getBytesOfText = function(str) {
|
|
3413
|
+
if (str === void 0) {
|
|
3414
|
+
str = "";
|
|
3415
|
+
}
|
|
3416
|
+
return str.replace(/[^\u0000-\u00ff]/g, "aa").length;
|
|
3281
3417
|
};
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
e && e.preventDefault();
|
|
3418
|
+
ToolsClass2.prototype.uniqueArr = function(arr) {
|
|
3419
|
+
return Array.from(new Set(arr));
|
|
3285
3420
|
};
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
ToolsClass2.prototype.deepCopy2 = function(obj) {
|
|
3291
|
-
var _obj = Array.isArray(obj) ? [] : {};
|
|
3292
|
-
for (var i in obj) {
|
|
3293
|
-
_obj[i] = typeof obj[i] === "object" ? this.deepCopy2(obj[i]) : obj[i];
|
|
3294
|
-
}
|
|
3295
|
-
return _obj;
|
|
3296
|
-
};
|
|
3297
|
-
ToolsClass2.prototype.deepCopy3 = function(obj) {
|
|
3298
|
-
var deepcopy = requireCloneDeep();
|
|
3299
|
-
return deepcopy(obj);
|
|
3300
|
-
};
|
|
3301
|
-
ToolsClass2.prototype.debounce = function(func, wait) {
|
|
3302
|
-
var delay = function() {
|
|
3303
|
-
var args = arguments;
|
|
3304
|
-
if (timeout)
|
|
3305
|
-
clearTimeout(timeout);
|
|
3306
|
-
timeout = setTimeout(function() {
|
|
3307
|
-
func.apply(delay, args);
|
|
3308
|
-
}, wait);
|
|
3421
|
+
ToolsClass2.prototype.swapArray = function(array, index1, index2) {
|
|
3422
|
+
var _a;
|
|
3423
|
+
_a = [array[index2], array[index1]], array[index1] = _a[0], array[index2] = _a[1];
|
|
3424
|
+
return array;
|
|
3309
3425
|
};
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
ToolsClass2.prototype.throttle = function(func, wait) {
|
|
3313
|
-
var delay = function() {
|
|
3314
|
-
var now = Date.now();
|
|
3315
|
-
if (now - previous > wait) {
|
|
3316
|
-
func.apply(delay, arguments);
|
|
3317
|
-
previous = now;
|
|
3318
|
-
}
|
|
3426
|
+
ToolsClass2.prototype.filterEmoji = function(str) {
|
|
3427
|
+
return str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg, "");
|
|
3319
3428
|
};
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
if (
|
|
3334
|
-
return
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
};
|
|
3351
|
-
ToolsClass2.prototype.loadCss = function(url) {
|
|
3352
|
-
var _this = this;
|
|
3353
|
-
if (!(window && window.document)) {
|
|
3354
|
-
return new Error("\u4EC5\u652F\u6301\u6D4F\u89C8\u5668");
|
|
3355
|
-
}
|
|
3356
|
-
var name = this.getUrlName(url);
|
|
3357
|
-
var id = "css_" + name;
|
|
3358
|
-
return new Promise(function(resolve, reject) {
|
|
3359
|
-
if (_this.__loaded__[id]) {
|
|
3360
|
-
return resolve();
|
|
3361
|
-
}
|
|
3362
|
-
var link = document.createElement("link");
|
|
3363
|
-
link.type = "text/css";
|
|
3364
|
-
link.rel = "stylesheet";
|
|
3365
|
-
link.href = url;
|
|
3366
|
-
link.id = id;
|
|
3367
|
-
link.onload = function() {
|
|
3368
|
-
_this.__loaded__[id] = true;
|
|
3369
|
-
resolve();
|
|
3370
|
-
};
|
|
3371
|
-
link.onerror = function(e) {
|
|
3372
|
-
reject(e);
|
|
3373
|
-
};
|
|
3374
|
-
document.head.appendChild(link);
|
|
3375
|
-
});
|
|
3376
|
-
};
|
|
3377
|
-
ToolsClass2.prototype.clipboard = function(str) {
|
|
3378
|
-
if (!(window && window.document)) {
|
|
3379
|
-
return new Error("\u4EC5\u652F\u6301\u6D4F\u89C8\u5668");
|
|
3380
|
-
}
|
|
3381
|
-
var copy = requireClipboardCopy();
|
|
3382
|
-
return copy(str);
|
|
3383
|
-
};
|
|
3384
|
-
ToolsClass2.prototype.firstUpperCase = function(str) {
|
|
3385
|
-
return str.charAt(0).toUpperCase() + str.toString().slice(1);
|
|
3386
|
-
};
|
|
3387
|
-
ToolsClass2.prototype.slice = function(target, length) {
|
|
3388
|
-
if (target === void 0) {
|
|
3389
|
-
target = "";
|
|
3390
|
-
}
|
|
3391
|
-
if (length === void 0) {
|
|
3392
|
-
length = 0;
|
|
3393
|
-
}
|
|
3394
|
-
return target.slice(0, length);
|
|
3395
|
-
};
|
|
3396
|
-
ToolsClass2.prototype.guid = function() {
|
|
3397
|
-
function S4() {
|
|
3398
|
-
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
3399
|
-
}
|
|
3400
|
-
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
|
|
3401
|
-
};
|
|
3402
|
-
ToolsClass2.prototype.getBytesOfText = function(str) {
|
|
3403
|
-
if (str === void 0) {
|
|
3404
|
-
str = "";
|
|
3405
|
-
}
|
|
3406
|
-
return str.replace(/[^\u0000-\u00ff]/g, "aa").length;
|
|
3407
|
-
};
|
|
3408
|
-
ToolsClass2.prototype.uniqueArr = function(arr) {
|
|
3409
|
-
return Array.from(new Set(arr));
|
|
3410
|
-
};
|
|
3411
|
-
ToolsClass2.prototype.swapArray = function(array, index1, index2) {
|
|
3412
|
-
var _a;
|
|
3413
|
-
_a = [array[index2], array[index1]], array[index1] = _a[0], array[index2] = _a[1];
|
|
3414
|
-
return array;
|
|
3415
|
-
};
|
|
3416
|
-
ToolsClass2.prototype.filterEmoji = function(str) {
|
|
3417
|
-
return str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg, "");
|
|
3418
|
-
};
|
|
3419
|
-
ToolsClass2.prototype.containsEmoji = function(str) {
|
|
3420
|
-
var reg = /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg;
|
|
3421
|
-
return reg.test(str);
|
|
3422
|
-
};
|
|
3423
|
-
ToolsClass2.prototype.containsHanZi = function(str) {
|
|
3424
|
-
var reg = /[\u4e00-\u9fa5]/mg;
|
|
3425
|
-
return reg.test(str);
|
|
3426
|
-
};
|
|
3427
|
-
ToolsClass2.prototype.isEmpty = function(val) {
|
|
3428
|
-
if (val == null)
|
|
3429
|
-
return true;
|
|
3430
|
-
if (typeof val === "boolean")
|
|
3429
|
+
ToolsClass2.prototype.containsEmoji = function(str) {
|
|
3430
|
+
var reg = /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg;
|
|
3431
|
+
return reg.test(str);
|
|
3432
|
+
};
|
|
3433
|
+
ToolsClass2.prototype.containsHanZi = function(str) {
|
|
3434
|
+
var reg = /[\u4e00-\u9fa5]/mg;
|
|
3435
|
+
return reg.test(str);
|
|
3436
|
+
};
|
|
3437
|
+
ToolsClass2.prototype.isEmpty = function(val) {
|
|
3438
|
+
if (val == null)
|
|
3439
|
+
return true;
|
|
3440
|
+
if (typeof val === "boolean")
|
|
3441
|
+
return false;
|
|
3442
|
+
if (typeof val === "number")
|
|
3443
|
+
return !val;
|
|
3444
|
+
if (val instanceof Error)
|
|
3445
|
+
return val.message === "";
|
|
3446
|
+
switch (Object.prototype.toString.call(val)) {
|
|
3447
|
+
case "[object String]":
|
|
3448
|
+
case "[object Array]":
|
|
3449
|
+
return !val.length;
|
|
3450
|
+
case "[object File]":
|
|
3451
|
+
case "[object Map]":
|
|
3452
|
+
case "[object Set]": {
|
|
3453
|
+
return !val.size;
|
|
3454
|
+
}
|
|
3455
|
+
case "[object Object]": {
|
|
3456
|
+
return !Object.keys(val).length;
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3431
3459
|
return false;
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
switch (Object.prototype.toString.call(val)) {
|
|
3437
|
-
case "[object String]":
|
|
3438
|
-
case "[object Array]":
|
|
3439
|
-
return !val.length;
|
|
3440
|
-
case "[object File]":
|
|
3441
|
-
case "[object Map]":
|
|
3442
|
-
case "[object Set]": {
|
|
3443
|
-
return !val.size;
|
|
3444
|
-
}
|
|
3445
|
-
case "[object Object]": {
|
|
3446
|
-
return !Object.keys(val).length;
|
|
3460
|
+
};
|
|
3461
|
+
ToolsClass2.prototype.sensitiveField = function(field, before, after) {
|
|
3462
|
+
if (before === void 0) {
|
|
3463
|
+
before = 3;
|
|
3447
3464
|
}
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
}
|
|
3473
|
-
|
|
3474
|
-
const tools = /* @__PURE__ */ getDefaultExportFromCjs(tools$1.exports);
|
|
3475
|
-
const index_vue_vue_type_style_index_0_lang$3 = "";
|
|
3476
|
-
const _hoisted_1$5 = /* @__PURE__ */ vue.createTextVNode("\u63D2\u5165\u6587\u7AE0/\u89C6\u9891");
|
|
3477
|
-
const _hoisted_2$5 = { style: { "margin-left": "20px", "color": "#FF5A25" } };
|
|
3478
|
-
const _hoisted_3$5 = { class: "insert-article" };
|
|
3479
|
-
const _hoisted_4$4 = /* @__PURE__ */ vue.createTextVNode("\u4ECE\u6211\u7684\u6587\u7AE0\u4E2D\u9009\u62E9");
|
|
3480
|
-
const _hoisted_5$3 = /* @__PURE__ */ vue.createTextVNode("\u4ECE\u6211\u7684\u89C6\u9891\u4E2D\u9009\u62E9");
|
|
3481
|
-
const _hoisted_6$1 = /* @__PURE__ */ vue.createTextVNode("\u4ECE\u6240\u6709\u6587\u7AE0\u4E2D\u9009\u62E9");
|
|
3482
|
-
const _hoisted_7$1 = { class: "insert-article_input" };
|
|
3483
|
-
const _hoisted_8$1 = {
|
|
3465
|
+
if (after === void 0) {
|
|
3466
|
+
after = 4;
|
|
3467
|
+
}
|
|
3468
|
+
if (!field) {
|
|
3469
|
+
return "";
|
|
3470
|
+
}
|
|
3471
|
+
field = String(field);
|
|
3472
|
+
var sensitiveLen = field.length - before - after;
|
|
3473
|
+
if (sensitiveLen < 0) {
|
|
3474
|
+
sensitiveLen = 0;
|
|
3475
|
+
}
|
|
3476
|
+
var regItem = "[一-龥a-zA-Z0-9]";
|
|
3477
|
+
var regExp = "(".concat(regItem, "{").concat(before, "})").concat(regItem, "*(").concat(regItem, "{").concat(after, "})");
|
|
3478
|
+
var reg = new RegExp(regExp);
|
|
3479
|
+
return field.replace(reg, "$1".concat("*".repeat(sensitiveLen), "$2"));
|
|
3480
|
+
};
|
|
3481
|
+
return ToolsClass2;
|
|
3482
|
+
}()
|
|
3483
|
+
);
|
|
3484
|
+
tools$2.exports = new ToolsClass();
|
|
3485
|
+
var toolsExports = tools$2.exports;
|
|
3486
|
+
const tools$1 = /* @__PURE__ */ getDefaultExportFromCjs(toolsExports);
|
|
3487
|
+
const _hoisted_1$6 = { style: { "margin-left": "20px", "color": "#FF5A25" } };
|
|
3488
|
+
const _hoisted_2$3 = { class: "insert-article" };
|
|
3489
|
+
const _hoisted_3$3 = { class: "insert-article_input" };
|
|
3490
|
+
const _hoisted_4$2 = {
|
|
3484
3491
|
key: 0,
|
|
3485
3492
|
class: "nodata"
|
|
3486
3493
|
};
|
|
3487
|
-
const
|
|
3488
|
-
const
|
|
3494
|
+
const _hoisted_5$2 = ["infinite-scroll-disabled"];
|
|
3495
|
+
const _hoisted_6$1 = {
|
|
3489
3496
|
key: 0,
|
|
3490
3497
|
class: "video-item"
|
|
3491
3498
|
};
|
|
3492
|
-
const
|
|
3493
|
-
const
|
|
3494
|
-
const
|
|
3495
|
-
const
|
|
3496
|
-
const
|
|
3497
|
-
const
|
|
3499
|
+
const _hoisted_7$1 = { class: "video-pic" };
|
|
3500
|
+
const _hoisted_8$1 = ["src"];
|
|
3501
|
+
const _hoisted_9$1 = ["src"];
|
|
3502
|
+
const _hoisted_10$1 = { class: "video-text" };
|
|
3503
|
+
const _hoisted_11$1 = { class: "dotdotdot2" };
|
|
3504
|
+
const _hoisted_12$1 = {
|
|
3498
3505
|
key: 1,
|
|
3499
3506
|
style: { "display": "inline-flex", "flex-direction": "column" }
|
|
3500
3507
|
};
|
|
3501
|
-
const _sfc_main$
|
|
3502
|
-
|
|
3508
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
3509
|
+
__name: "index",
|
|
3503
3510
|
props: {
|
|
3504
3511
|
visible: { type: Boolean, default: false },
|
|
3505
|
-
getList:
|
|
3512
|
+
getList: {}
|
|
3506
3513
|
},
|
|
3507
3514
|
emits: ["change", "submit", "update:visible"],
|
|
3508
|
-
setup(__props, { emit:
|
|
3509
|
-
const
|
|
3510
|
-
const { debounce } = tools;
|
|
3515
|
+
setup(__props, { emit: __emit }) {
|
|
3516
|
+
const { debounce } = tools$1;
|
|
3511
3517
|
const vInfiniteScroll = elementPlus.ElInfiniteScroll;
|
|
3512
3518
|
const Radio_Type = {
|
|
3513
3519
|
MY_ARITICLE: "1",
|
|
@@ -3525,7 +3531,9 @@
|
|
|
3525
3531
|
emits("update:visible", val);
|
|
3526
3532
|
}
|
|
3527
3533
|
});
|
|
3534
|
+
const props = __props;
|
|
3528
3535
|
const { visible, getList } = vue.toRefs(props);
|
|
3536
|
+
const emits = __emit;
|
|
3529
3537
|
const data = vue.reactive({
|
|
3530
3538
|
params: {
|
|
3531
3539
|
autherid: "",
|
|
@@ -3556,7 +3564,7 @@
|
|
|
3556
3564
|
};
|
|
3557
3565
|
const confirm = () => {
|
|
3558
3566
|
if (!data.article) {
|
|
3559
|
-
elementPlus.ElMessage.error(
|
|
3567
|
+
elementPlus.ElMessage.error(`请选择${isVideo ? "视频" : "文章"}`);
|
|
3560
3568
|
return;
|
|
3561
3569
|
}
|
|
3562
3570
|
data.article.isVideo = isVideo;
|
|
@@ -3573,11 +3581,14 @@
|
|
|
3573
3581
|
data.busy = true;
|
|
3574
3582
|
const userInfo = JSON.parse(localStorage.getItem("user")) || JSON.parse(localStorage.getItem("userInfo"));
|
|
3575
3583
|
const userId = userInfo.uid || userInfo.userid;
|
|
3584
|
+
if (!getList.value)
|
|
3585
|
+
return;
|
|
3576
3586
|
const res = await getList.value({
|
|
3577
3587
|
uid: data.params.radio !== Radio_Type.ALL_ARITICLE ? userId : "",
|
|
3578
3588
|
autherid: data.params.radio !== Radio_Type.ALL_ARITICLE ? userId : "",
|
|
3579
3589
|
limit: 20,
|
|
3580
3590
|
allType: data.params.radio,
|
|
3591
|
+
// 只有4 是查视频 其他是文章
|
|
3581
3592
|
title: data.params.title,
|
|
3582
3593
|
page: ++data.page
|
|
3583
3594
|
});
|
|
@@ -3591,27 +3602,27 @@
|
|
|
3591
3602
|
data.busy = false;
|
|
3592
3603
|
}, 1e3);
|
|
3593
3604
|
return (_ctx, _cache) => {
|
|
3594
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3605
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$7, {
|
|
3595
3606
|
visible: vue.unref(visible),
|
|
3596
3607
|
onSubmit: confirm
|
|
3597
3608
|
}, {
|
|
3598
3609
|
title: vue.withCtx(() => [
|
|
3599
3610
|
vue.createElementVNode("span", null, [
|
|
3600
|
-
|
|
3601
|
-
vue.createElementVNode("strong",
|
|
3611
|
+
_cache[8] || (_cache[8] = vue.createTextVNode("插入文章/视频")),
|
|
3612
|
+
vue.createElementVNode("strong", _hoisted_1$6, "平台仅支持插入" + vue.toDisplayString(`${isVideo.value ? "2年" : "18个月"}`) + "内的推荐内容", 1)
|
|
3602
3613
|
])
|
|
3603
3614
|
]),
|
|
3604
3615
|
default: vue.withCtx(() => [
|
|
3605
|
-
vue.createElementVNode("div",
|
|
3616
|
+
vue.createElementVNode("div", _hoisted_2$3, [
|
|
3606
3617
|
vue.createElementVNode("div", null, [
|
|
3607
3618
|
vue.createVNode(vue.unref(elementPlus.ElRadio), {
|
|
3608
3619
|
modelValue: data.params.radio,
|
|
3609
3620
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => data.params.radio = $event),
|
|
3610
3621
|
label: Radio_Type.MY_ARITICLE
|
|
3611
3622
|
}, {
|
|
3612
|
-
default: vue.withCtx(() => [
|
|
3613
|
-
|
|
3614
|
-
]),
|
|
3623
|
+
default: vue.withCtx(() => _cache[9] || (_cache[9] = [
|
|
3624
|
+
vue.createTextVNode("从我的文章中选择")
|
|
3625
|
+
])),
|
|
3615
3626
|
_: 1
|
|
3616
3627
|
}, 8, ["modelValue", "label"]),
|
|
3617
3628
|
vue.createVNode(vue.unref(elementPlus.ElRadio), {
|
|
@@ -3619,9 +3630,9 @@
|
|
|
3619
3630
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => data.params.radio = $event),
|
|
3620
3631
|
label: Radio_Type.MY_VIDEO
|
|
3621
3632
|
}, {
|
|
3622
|
-
default: vue.withCtx(() => [
|
|
3623
|
-
|
|
3624
|
-
]),
|
|
3633
|
+
default: vue.withCtx(() => _cache[10] || (_cache[10] = [
|
|
3634
|
+
vue.createTextVNode("从我的视频中选择")
|
|
3635
|
+
])),
|
|
3625
3636
|
_: 1
|
|
3626
3637
|
}, 8, ["modelValue", "label"]),
|
|
3627
3638
|
vue.createVNode(vue.unref(elementPlus.ElRadio), {
|
|
@@ -3629,17 +3640,17 @@
|
|
|
3629
3640
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => data.params.radio = $event),
|
|
3630
3641
|
label: Radio_Type.ALL_ARITICLE
|
|
3631
3642
|
}, {
|
|
3632
|
-
default: vue.withCtx(() => [
|
|
3633
|
-
|
|
3634
|
-
]),
|
|
3643
|
+
default: vue.withCtx(() => _cache[11] || (_cache[11] = [
|
|
3644
|
+
vue.createTextVNode("从所有文章中选择")
|
|
3645
|
+
])),
|
|
3635
3646
|
_: 1
|
|
3636
3647
|
}, 8, ["modelValue", "label"])
|
|
3637
3648
|
]),
|
|
3638
|
-
vue.createElementVNode("div",
|
|
3649
|
+
vue.createElementVNode("div", _hoisted_3$3, [
|
|
3639
3650
|
vue.createVNode(vue.unref(elementPlus.ElInput), {
|
|
3640
3651
|
modelValue: data.params.title,
|
|
3641
3652
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => data.params.title = $event),
|
|
3642
|
-
placeholder:
|
|
3653
|
+
placeholder: isVideo.value ? "输入视频描述查找平台发布过的视频" : "输入标题名查找平台发过的文章",
|
|
3643
3654
|
onKeyup: _cache[5] || (_cache[5] = vue.withKeys(($event) => vue.unref(getArticleList)(true), ["enter", "native"])),
|
|
3644
3655
|
onInput: _cache[6] || (_cache[6] = ($event) => vue.unref(getArticleList)(true))
|
|
3645
3656
|
}, {
|
|
@@ -3653,11 +3664,11 @@
|
|
|
3653
3664
|
_: 1
|
|
3654
3665
|
}, 8, ["modelValue", "placeholder"])
|
|
3655
3666
|
]),
|
|
3656
|
-
data.data.length === 0 && !data.busy ? (vue.openBlock(), vue.createElementBlock("div",
|
|
3667
|
+
data.data.length === 0 && !data.busy ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, vue.toDisplayString(`没有符合条件的${isVideo.value ? "视频" : "文章"}哦,你可以试试搜索其他${isVideo.value ? "视频" : "文章"}~`), 1)) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
3657
3668
|
key: 1,
|
|
3658
3669
|
"infinite-scroll-immediate": false,
|
|
3659
3670
|
class: "insert-article_list",
|
|
3660
|
-
"infinite-scroll-disabled":
|
|
3671
|
+
"infinite-scroll-disabled": disable.value
|
|
3661
3672
|
}, [
|
|
3662
3673
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.data, (item, index) => {
|
|
3663
3674
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -3673,24 +3684,24 @@
|
|
|
3673
3684
|
default: vue.withCtx(() => {
|
|
3674
3685
|
var _a;
|
|
3675
3686
|
return [
|
|
3676
|
-
|
|
3677
|
-
vue.createElementVNode("div",
|
|
3687
|
+
isVideo.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
|
|
3688
|
+
vue.createElementVNode("div", _hoisted_7$1, [
|
|
3678
3689
|
vue.createElementVNode("img", {
|
|
3679
3690
|
class: "video-pic",
|
|
3680
3691
|
src: (_a = item == null ? void 0 : item.mediaInfo[0]) == null ? void 0 : _a.img
|
|
3681
|
-
}, null, 8,
|
|
3692
|
+
}, null, 8, _hoisted_8$1),
|
|
3682
3693
|
vue.createElementVNode("img", {
|
|
3683
3694
|
class: "play",
|
|
3684
3695
|
src: getImageUrl("play.png")
|
|
3685
|
-
}, null, 8,
|
|
3696
|
+
}, null, 8, _hoisted_9$1)
|
|
3686
3697
|
]),
|
|
3687
|
-
vue.createElementVNode("div",
|
|
3688
|
-
vue.createElementVNode("span",
|
|
3689
|
-
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(date).format(item.createTime * 1e3, "YYYY-MM-DD hh-mm")), 1)
|
|
3698
|
+
vue.createElementVNode("div", _hoisted_10$1, [
|
|
3699
|
+
vue.createElementVNode("span", _hoisted_11$1, vue.toDisplayString(item.content || "[无标题]"), 1),
|
|
3700
|
+
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(date$1).format(item.createTime * 1e3, "YYYY-MM-DD hh-mm")), 1)
|
|
3690
3701
|
])
|
|
3691
|
-
])) : (vue.openBlock(), vue.createElementBlock("div",
|
|
3692
|
-
vue.createElementVNode("span", null, vue.toDisplayString(item.title || "[
|
|
3693
|
-
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(date).format(item.createTime * 1e3, "YYYY-MM-DD")), 1)
|
|
3702
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$1, [
|
|
3703
|
+
vue.createElementVNode("span", null, vue.toDisplayString(item.title || "[无标题]"), 1),
|
|
3704
|
+
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(date$1).format(item.createTime * 1e3, "YYYY-MM-DD")), 1)
|
|
3694
3705
|
]))
|
|
3695
3706
|
];
|
|
3696
3707
|
}),
|
|
@@ -3698,7 +3709,7 @@
|
|
|
3698
3709
|
}, 1032, ["modelValue", "label", "onChange"])
|
|
3699
3710
|
]);
|
|
3700
3711
|
}), 128))
|
|
3701
|
-
], 8,
|
|
3712
|
+
], 8, _hoisted_5$2)), [
|
|
3702
3713
|
[vue.unref(vInfiniteScroll), vue.unref(getArticleList)]
|
|
3703
3714
|
])
|
|
3704
3715
|
])
|
|
@@ -3708,6 +3719,7 @@
|
|
|
3708
3719
|
};
|
|
3709
3720
|
}
|
|
3710
3721
|
});
|
|
3722
|
+
const index_vue_vue_type_style_index_0_lang$4 = "";
|
|
3711
3723
|
let getRandomValues;
|
|
3712
3724
|
const rnds8 = new Uint8Array(16);
|
|
3713
3725
|
function rng() {
|
|
@@ -3724,7 +3736,7 @@
|
|
|
3724
3736
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
3725
3737
|
}
|
|
3726
3738
|
function unsafeStringify(arr, offset = 0) {
|
|
3727
|
-
return
|
|
3739
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
3728
3740
|
}
|
|
3729
3741
|
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3730
3742
|
const native = {
|
|
@@ -3747,15 +3759,14 @@
|
|
|
3747
3759
|
}
|
|
3748
3760
|
return unsafeStringify(rnds);
|
|
3749
3761
|
}
|
|
3750
|
-
const
|
|
3751
|
-
const
|
|
3752
|
-
const
|
|
3753
|
-
const
|
|
3754
|
-
const _hoisted_4$3 = {
|
|
3762
|
+
const _hoisted_1$5 = { class: "img-upload-content" };
|
|
3763
|
+
const _hoisted_2$2 = { class: "title-box" };
|
|
3764
|
+
const _hoisted_3$2 = ["onClick"];
|
|
3765
|
+
const _hoisted_4$1 = {
|
|
3755
3766
|
key: 0,
|
|
3756
3767
|
class: "line"
|
|
3757
3768
|
};
|
|
3758
|
-
const _hoisted_5$
|
|
3769
|
+
const _hoisted_5$1 = {
|
|
3759
3770
|
key: 0,
|
|
3760
3771
|
class: "prompt-restriction"
|
|
3761
3772
|
};
|
|
@@ -3779,45 +3790,39 @@
|
|
|
3779
3790
|
key: 0,
|
|
3780
3791
|
class: "upload-wrap"
|
|
3781
3792
|
};
|
|
3782
|
-
const _hoisted_14 =
|
|
3783
|
-
const _hoisted_15 = /* @__PURE__ */ vue.createElementVNode("span", { class: "remark" }, "\u652F\u6301jpg\u3001jpeg\u3001png\u7B49\u591A\u79CD\u683C\u5F0F\uFF0C\u5355\u5F20\u56FE\u7247\u6700\u5927\u652F\u630120MB", -1);
|
|
3784
|
-
const _hoisted_16 = {
|
|
3793
|
+
const _hoisted_14 = {
|
|
3785
3794
|
key: 1,
|
|
3786
3795
|
class: "img-list"
|
|
3787
3796
|
};
|
|
3788
|
-
const
|
|
3789
|
-
const
|
|
3790
|
-
const
|
|
3797
|
+
const _hoisted_15 = ["src"];
|
|
3798
|
+
const _hoisted_16 = { class: "upload-btn" };
|
|
3799
|
+
const _hoisted_17 = {
|
|
3791
3800
|
key: 2,
|
|
3792
3801
|
class: "map-depot"
|
|
3793
3802
|
};
|
|
3794
|
-
const
|
|
3795
|
-
const
|
|
3796
|
-
const
|
|
3797
|
-
const
|
|
3798
|
-
const
|
|
3799
|
-
const _hoisted_25 = {
|
|
3803
|
+
const _hoisted_18 = { class: "screen" };
|
|
3804
|
+
const _hoisted_19 = { key: 0 };
|
|
3805
|
+
const _hoisted_20 = { class: "tab-box" };
|
|
3806
|
+
const _hoisted_21 = ["onClick"];
|
|
3807
|
+
const _hoisted_22 = {
|
|
3800
3808
|
key: 0,
|
|
3801
3809
|
class: "line"
|
|
3802
3810
|
};
|
|
3803
|
-
const
|
|
3804
|
-
const
|
|
3805
|
-
const
|
|
3806
|
-
const
|
|
3811
|
+
const _hoisted_23 = { class: "image-list depot-image" };
|
|
3812
|
+
const _hoisted_24 = ["onClick"];
|
|
3813
|
+
const _hoisted_25 = ["src"];
|
|
3814
|
+
const _hoisted_26 = {
|
|
3807
3815
|
key: 0,
|
|
3808
3816
|
class: "shade"
|
|
3809
3817
|
};
|
|
3810
|
-
const
|
|
3811
|
-
const
|
|
3818
|
+
const _hoisted_27 = { class: "num" };
|
|
3819
|
+
const _hoisted_28 = {
|
|
3812
3820
|
key: 1,
|
|
3813
3821
|
class: "protocol-box"
|
|
3814
3822
|
};
|
|
3815
|
-
const
|
|
3816
|
-
const
|
|
3817
|
-
|
|
3818
|
-
const _hoisted_35 = /* @__PURE__ */ vue.createTextVNode(",\u60A8\u7684\u884C\u4E3A\u89C6\u4E3A\u60A8\u5DF2\u540C\u610F\u8BE5\u534F\u8BAE\u3002 ");
|
|
3819
|
-
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
3820
|
-
name: "index",
|
|
3823
|
+
const _hoisted_29 = ["href"];
|
|
3824
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
3825
|
+
__name: "index",
|
|
3821
3826
|
props: {
|
|
3822
3827
|
visible: { type: Boolean, default: false },
|
|
3823
3828
|
imgList: { default: [] },
|
|
@@ -3826,7 +3831,8 @@
|
|
|
3826
3831
|
imgNum: { default: 20 }
|
|
3827
3832
|
},
|
|
3828
3833
|
emits: ["update:imgList", "update:visible", "submit"],
|
|
3829
|
-
setup(__props, { emit:
|
|
3834
|
+
setup(__props, { emit: __emit }) {
|
|
3835
|
+
const emits = __emit;
|
|
3830
3836
|
const props = __props;
|
|
3831
3837
|
const drag = vue.ref(false);
|
|
3832
3838
|
const imgListTemp = vue.computed({
|
|
@@ -3850,7 +3856,7 @@
|
|
|
3850
3856
|
const tempImgs = [...props.imgList];
|
|
3851
3857
|
Array.from(imgFile).forEach((file) => {
|
|
3852
3858
|
if (file.size > 20 * 1024 * 1024) {
|
|
3853
|
-
elementPlus.ElMessage.error("
|
|
3859
|
+
elementPlus.ElMessage.error("单张图片最大支持20M");
|
|
3854
3860
|
return;
|
|
3855
3861
|
}
|
|
3856
3862
|
const id = v4();
|
|
@@ -3880,14 +3886,14 @@
|
|
|
3880
3886
|
const list = [
|
|
3881
3887
|
{
|
|
3882
3888
|
id: 2,
|
|
3883
|
-
value: "
|
|
3889
|
+
value: "上传图片"
|
|
3884
3890
|
}
|
|
3885
3891
|
];
|
|
3886
3892
|
activeTitle.value = 2;
|
|
3887
3893
|
if (props.imgNum < 20) {
|
|
3888
3894
|
list.unshift({
|
|
3889
3895
|
id: 1,
|
|
3890
|
-
value: "
|
|
3896
|
+
value: "正文图片"
|
|
3891
3897
|
});
|
|
3892
3898
|
activeTitle.value = 1;
|
|
3893
3899
|
getContentImgList();
|
|
@@ -3895,7 +3901,7 @@
|
|
|
3895
3901
|
if (props.chartGallery) {
|
|
3896
3902
|
list.push({
|
|
3897
3903
|
id: 3,
|
|
3898
|
-
value: isEmotofine ? "
|
|
3904
|
+
value: isEmotofine ? "电摩范图库" : "摩托范图库"
|
|
3899
3905
|
});
|
|
3900
3906
|
}
|
|
3901
3907
|
titleList.value = list;
|
|
@@ -4040,13 +4046,13 @@
|
|
|
4040
4046
|
const tabList = vue.ref([]);
|
|
4041
4047
|
const search = () => {
|
|
4042
4048
|
if (!selectData.brandId) {
|
|
4043
|
-
return elementPlus.ElMessage.error("
|
|
4049
|
+
return elementPlus.ElMessage.error("请选择品牌");
|
|
4044
4050
|
}
|
|
4045
4051
|
if (!selectData.goodId) {
|
|
4046
|
-
return elementPlus.ElMessage.error("
|
|
4052
|
+
return elementPlus.ElMessage.error("请选择车型");
|
|
4047
4053
|
}
|
|
4048
4054
|
if (!selectData.carId) {
|
|
4049
|
-
return elementPlus.ElMessage.error("
|
|
4055
|
+
return elementPlus.ElMessage.error("请选择款型");
|
|
4050
4056
|
}
|
|
4051
4057
|
tabList.value = [];
|
|
4052
4058
|
emits("update:imgList", []);
|
|
@@ -4097,13 +4103,13 @@
|
|
|
4097
4103
|
emits("update:imgList", list);
|
|
4098
4104
|
};
|
|
4099
4105
|
return (_ctx, _cache) => {
|
|
4100
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4106
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$7, {
|
|
4101
4107
|
visible: props.visible,
|
|
4102
4108
|
showTitle: false
|
|
4103
4109
|
}, {
|
|
4104
4110
|
default: vue.withCtx(() => [
|
|
4105
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4106
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
4111
|
+
vue.createElementVNode("div", _hoisted_1$5, [
|
|
4112
|
+
vue.createElementVNode("div", _hoisted_2$2, [
|
|
4107
4113
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(titleList.value, (item, index) => {
|
|
4108
4114
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4109
4115
|
key: index,
|
|
@@ -4111,15 +4117,15 @@
|
|
|
4111
4117
|
onClick: ($event) => changeTab(item)
|
|
4112
4118
|
}, [
|
|
4113
4119
|
vue.createTextVNode(vue.toDisplayString(item.value) + " ", 1),
|
|
4114
|
-
item.id === activeTitle.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$
|
|
4115
|
-
], 10, _hoisted_3$
|
|
4120
|
+
item.id === activeTitle.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1)) : vue.createCommentVNode("", true)
|
|
4121
|
+
], 10, _hoisted_3$2);
|
|
4116
4122
|
}), 128)),
|
|
4117
|
-
[1, 3].includes(activeTitle.value) && props.imgList.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$
|
|
4118
|
-
activeTitle.value === 2 && props.imgList.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, vue.toDisplayString(props.imgList.length) + "
|
|
4123
|
+
[1, 3].includes(activeTitle.value) && props.imgList.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, " 最多可选" + vue.toDisplayString(props.imgNum) + "张图片,已选" + vue.toDisplayString(props.imgList.length) + "张 ", 1)) : vue.createCommentVNode("", true),
|
|
4124
|
+
activeTitle.value === 2 && props.imgList.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, vue.toDisplayString(props.imgList.length) + "张上传成功 拖动可调整顺序 ", 1)) : vue.createCommentVNode("", true)
|
|
4119
4125
|
]),
|
|
4120
4126
|
activeTitle.value === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
|
|
4121
4127
|
vue.createElementVNode("div", _hoisted_8, [
|
|
4122
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
4128
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(contentImgList.value, (item, index) => {
|
|
4123
4129
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4124
4130
|
key: index,
|
|
4125
4131
|
class: "image-item",
|
|
@@ -4152,13 +4158,13 @@
|
|
|
4152
4158
|
]),
|
|
4153
4159
|
_: 1
|
|
4154
4160
|
}),
|
|
4155
|
-
|
|
4161
|
+
_cache[7] || (_cache[7] = vue.createElementVNode("span", null, "本地上传", -1))
|
|
4156
4162
|
]),
|
|
4157
|
-
|
|
4158
|
-
])) : (vue.openBlock(), vue.createElementBlock("div",
|
|
4159
|
-
vue.createVNode(vue.unref(
|
|
4160
|
-
modelValue:
|
|
4161
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
4163
|
+
_cache[8] || (_cache[8] = vue.createElementVNode("span", { class: "remark" }, "支持jpg、jpeg、png等多种格式,单张图片最大支持20MB", -1))
|
|
4164
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
|
|
4165
|
+
vue.createVNode(vue.unref(draggable), {
|
|
4166
|
+
modelValue: imgListTemp.value,
|
|
4167
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => imgListTemp.value = $event),
|
|
4162
4168
|
handle: ".img-item",
|
|
4163
4169
|
class: "img-wrap",
|
|
4164
4170
|
group: "people",
|
|
@@ -4176,7 +4182,7 @@
|
|
|
4176
4182
|
style: { "object-fit": "contain" },
|
|
4177
4183
|
width: "120",
|
|
4178
4184
|
height: "120"
|
|
4179
|
-
}, null, 8,
|
|
4185
|
+
}, null, 8, _hoisted_15),
|
|
4180
4186
|
vue.createVNode(vue.unref(iconsVue.CircleCloseFilled), {
|
|
4181
4187
|
class: "icon pointer",
|
|
4182
4188
|
onClick: ($event) => deleteImg(element)
|
|
@@ -4199,7 +4205,7 @@
|
|
|
4199
4205
|
_: 1
|
|
4200
4206
|
}, 8, ["modelValue"])
|
|
4201
4207
|
])),
|
|
4202
|
-
vue.createElementVNode("div",
|
|
4208
|
+
vue.createElementVNode("div", _hoisted_16, [
|
|
4203
4209
|
vue.createElementVNode("input", {
|
|
4204
4210
|
type: "file",
|
|
4205
4211
|
name: "file",
|
|
@@ -4210,13 +4216,13 @@
|
|
|
4210
4216
|
}, null, 32)
|
|
4211
4217
|
])
|
|
4212
4218
|
], 2)) : vue.createCommentVNode("", true),
|
|
4213
|
-
activeTitle.value === 3 ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4214
|
-
vue.createElementVNode("div",
|
|
4219
|
+
activeTitle.value === 3 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17, [
|
|
4220
|
+
vue.createElementVNode("div", _hoisted_18, [
|
|
4215
4221
|
vue.createElementVNode("div", null, [
|
|
4216
4222
|
vue.createVNode(vue.unref(elementPlus.ElSelect), {
|
|
4217
4223
|
modelValue: selectData.brandId,
|
|
4218
4224
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => selectData.brandId = $event),
|
|
4219
|
-
placeholder: "
|
|
4225
|
+
placeholder: "请选择品牌",
|
|
4220
4226
|
size: "large",
|
|
4221
4227
|
class: "select_1",
|
|
4222
4228
|
filterable: "",
|
|
@@ -4237,7 +4243,7 @@
|
|
|
4237
4243
|
vue.createVNode(vue.unref(elementPlus.ElSelect), {
|
|
4238
4244
|
modelValue: selectData.goodId,
|
|
4239
4245
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => selectData.goodId = $event),
|
|
4240
|
-
placeholder: "
|
|
4246
|
+
placeholder: "请选择车型",
|
|
4241
4247
|
size: "large",
|
|
4242
4248
|
class: "select_1",
|
|
4243
4249
|
filterable: "",
|
|
@@ -4258,7 +4264,7 @@
|
|
|
4258
4264
|
vue.createVNode(vue.unref(elementPlus.ElSelect), {
|
|
4259
4265
|
modelValue: selectData.carId,
|
|
4260
4266
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => selectData.carId = $event),
|
|
4261
|
-
placeholder: "
|
|
4267
|
+
placeholder: "请选择款型",
|
|
4262
4268
|
size: "large",
|
|
4263
4269
|
class: "select_2",
|
|
4264
4270
|
filterable: "",
|
|
@@ -4282,14 +4288,14 @@
|
|
|
4282
4288
|
style: { "width": "80px" },
|
|
4283
4289
|
onClick: search
|
|
4284
4290
|
}, {
|
|
4285
|
-
default: vue.withCtx(() => [
|
|
4286
|
-
|
|
4287
|
-
]),
|
|
4291
|
+
default: vue.withCtx(() => _cache[9] || (_cache[9] = [
|
|
4292
|
+
vue.createTextVNode("搜索")
|
|
4293
|
+
])),
|
|
4288
4294
|
_: 1
|
|
4289
4295
|
})
|
|
4290
4296
|
]),
|
|
4291
|
-
tabList.value && tabList.value.length ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4292
|
-
vue.createElementVNode("div",
|
|
4297
|
+
tabList.value && tabList.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_19, [
|
|
4298
|
+
vue.createElementVNode("div", _hoisted_20, [
|
|
4293
4299
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tabList.value, (item, index) => {
|
|
4294
4300
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4295
4301
|
key: index,
|
|
@@ -4297,12 +4303,12 @@
|
|
|
4297
4303
|
onClick: ($event) => activeTab.value = item.type
|
|
4298
4304
|
}, [
|
|
4299
4305
|
vue.createTextVNode(vue.toDisplayString(item.name) + " ", 1),
|
|
4300
|
-
item.type === activeTab.value ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4301
|
-
], 10,
|
|
4306
|
+
item.type === activeTab.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_22)) : vue.createCommentVNode("", true)
|
|
4307
|
+
], 10, _hoisted_21);
|
|
4302
4308
|
}), 128))
|
|
4303
4309
|
]),
|
|
4304
|
-
vue.createElementVNode("div",
|
|
4305
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
4310
|
+
vue.createElementVNode("div", _hoisted_23, [
|
|
4311
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(imageList.value, (item, index) => {
|
|
4306
4312
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4307
4313
|
key: index,
|
|
4308
4314
|
class: "image-item",
|
|
@@ -4312,25 +4318,25 @@
|
|
|
4312
4318
|
src: item.imgOrgUrl,
|
|
4313
4319
|
alt: "",
|
|
4314
4320
|
class: "image"
|
|
4315
|
-
}, null, 8,
|
|
4316
|
-
item.num ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4317
|
-
vue.createElementVNode("div",
|
|
4321
|
+
}, null, 8, _hoisted_25),
|
|
4322
|
+
item.num ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_26, [
|
|
4323
|
+
vue.createElementVNode("div", _hoisted_27, vue.toDisplayString(item.num), 1)
|
|
4318
4324
|
])) : vue.createCommentVNode("", true)
|
|
4319
|
-
], 8,
|
|
4325
|
+
], 8, _hoisted_24);
|
|
4320
4326
|
}), 128))
|
|
4321
4327
|
])
|
|
4322
|
-
])) : (vue.openBlock(), vue.createElementBlock("div",
|
|
4328
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_28, [
|
|
4323
4329
|
vue.createElementVNode("div", null, [
|
|
4324
|
-
|
|
4330
|
+
_cache[12] || (_cache[12] = vue.createElementVNode("div", null, " 图库中的图片仅限下载摩托范以编辑发布文章使用,不得用于其他任何平台及用途 ", -1)),
|
|
4325
4331
|
vue.createElementVNode("div", null, [
|
|
4326
|
-
|
|
4332
|
+
_cache[10] || (_cache[10] = vue.createTextVNode(" 请阅读")),
|
|
4327
4333
|
vue.createElementVNode("a", {
|
|
4328
4334
|
href: `https://${vue.unref(hostName)}/about?type=imageLicenseAgreement`,
|
|
4329
4335
|
target: "_blank",
|
|
4330
4336
|
rel: "noopener noreferrer",
|
|
4331
4337
|
class: "link"
|
|
4332
|
-
}, "
|
|
4333
|
-
|
|
4338
|
+
}, "《摩托范图片许可使用协议》", 8, _hoisted_29),
|
|
4339
|
+
_cache[11] || (_cache[11] = vue.createTextVNode(",您的行为视为您已同意该协议。 "))
|
|
4334
4340
|
])
|
|
4335
4341
|
])
|
|
4336
4342
|
]))
|
|
@@ -4342,25 +4348,23 @@
|
|
|
4342
4348
|
};
|
|
4343
4349
|
}
|
|
4344
4350
|
});
|
|
4345
|
-
const index_vue_vue_type_style_index_0_lang$
|
|
4346
|
-
const _hoisted_1$
|
|
4347
|
-
const
|
|
4348
|
-
|
|
4349
|
-
const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("span", { class: "remark" }, "\u4E3A\u4E86\u83B7\u5F97\u66F4\u9AD8\u7684\u63A8\u8350\u91CF\u548C\u70B9\u51FB\u91CF\uFF0C\u5EFA\u8BAE\u4E0A\u4F20720p\uFF081280*720\uFF09\u6216\u66F4\u9AD8\u5206\u8FA8\u7387\u7684\u89C6\u9891\uFF0C\u89C6\u9891\u683C\u5F0F\u4E3A.mp4\u6216.mov\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC71G", -1);
|
|
4350
|
-
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
4351
|
-
name: "index",
|
|
4351
|
+
const index_vue_vue_type_style_index_0_lang$3 = "";
|
|
4352
|
+
const _hoisted_1$4 = { class: "insert-video" };
|
|
4353
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
4354
|
+
__name: "index",
|
|
4352
4355
|
props: {
|
|
4353
4356
|
visible: { type: Boolean, default: false },
|
|
4354
|
-
fileSelected:
|
|
4357
|
+
fileSelected: {}
|
|
4355
4358
|
},
|
|
4356
4359
|
emits: ["update:visible"],
|
|
4357
|
-
setup(__props, { emit:
|
|
4358
|
-
const
|
|
4360
|
+
setup(__props, { emit: __emit }) {
|
|
4361
|
+
const emits = __emit;
|
|
4359
4362
|
vue.provide("vm", {
|
|
4360
4363
|
setStatus(val) {
|
|
4361
4364
|
emits("update:visible", val);
|
|
4362
4365
|
}
|
|
4363
4366
|
});
|
|
4367
|
+
const props = __props;
|
|
4364
4368
|
const { visible, fileSelected } = vue.toRefs(props);
|
|
4365
4369
|
const emitEvent = () => {
|
|
4366
4370
|
var event = new MouseEvent("click");
|
|
@@ -4368,29 +4372,29 @@
|
|
|
4368
4372
|
ele[0].dispatchEvent(event);
|
|
4369
4373
|
};
|
|
4370
4374
|
return (_ctx, _cache) => {
|
|
4371
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4375
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$7, {
|
|
4372
4376
|
"show-btn": false,
|
|
4373
4377
|
visible: vue.unref(visible),
|
|
4374
4378
|
width: "600px",
|
|
4375
4379
|
height: "100px"
|
|
4376
4380
|
}, {
|
|
4377
|
-
title: vue.withCtx(() => [
|
|
4378
|
-
|
|
4379
|
-
]),
|
|
4381
|
+
title: vue.withCtx(() => _cache[1] || (_cache[1] = [
|
|
4382
|
+
vue.createElementVNode("span", null, "插入视频", -1)
|
|
4383
|
+
])),
|
|
4380
4384
|
default: vue.withCtx(() => [
|
|
4381
|
-
vue.createElementVNode("div",
|
|
4385
|
+
vue.createElementVNode("div", _hoisted_1$4, [
|
|
4382
4386
|
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
4383
4387
|
style: { "width": "120px" },
|
|
4384
4388
|
round: "",
|
|
4385
4389
|
type: "primary",
|
|
4386
4390
|
onClick: emitEvent
|
|
4387
4391
|
}, {
|
|
4388
|
-
default: vue.withCtx(() => [
|
|
4389
|
-
|
|
4390
|
-
]),
|
|
4392
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
4393
|
+
vue.createTextVNode("选择视频")
|
|
4394
|
+
])),
|
|
4391
4395
|
_: 1
|
|
4392
4396
|
}),
|
|
4393
|
-
|
|
4397
|
+
_cache[3] || (_cache[3] = vue.createElementVNode("span", { class: "remark" }, "为了获得更高的推荐量和点击量,建议上传720p(1280*720)或更高分辨率的视频,视频格式为.mp4或.mov,大小不超过1G", -1)),
|
|
4394
4398
|
vue.createElementVNode("input", {
|
|
4395
4399
|
type: "file",
|
|
4396
4400
|
accept: "video/*",
|
|
@@ -4405,123 +4409,821 @@
|
|
|
4405
4409
|
};
|
|
4406
4410
|
}
|
|
4407
4411
|
});
|
|
4408
|
-
const index_vue_vue_type_style_index_0_lang = "";
|
|
4409
|
-
const
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
vm: this
|
|
4413
|
-
};
|
|
4414
|
-
},
|
|
4415
|
-
components: {
|
|
4416
|
-
ElInput: elementPlus.ElInput,
|
|
4417
|
-
BasicDialog: _sfc_main$6,
|
|
4418
|
-
draggable: draggable__default.default
|
|
4419
|
-
},
|
|
4412
|
+
const index_vue_vue_type_style_index_0_lang$2 = "";
|
|
4413
|
+
const index_vue_vue_type_style_index_0_lang$1 = "";
|
|
4414
|
+
const _sfc_main$3 = {
|
|
4415
|
+
name: "TopicManager",
|
|
4420
4416
|
props: {
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
linkContent: {
|
|
4426
|
-
type: String,
|
|
4427
|
-
default: ""
|
|
4417
|
+
// 编辑器DOM引用
|
|
4418
|
+
editorDom: {
|
|
4419
|
+
type: Object,
|
|
4420
|
+
default: null
|
|
4428
4421
|
},
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4422
|
+
// 话题API请求方法
|
|
4423
|
+
request: {
|
|
4424
|
+
type: Object,
|
|
4425
|
+
default: null
|
|
4433
4426
|
}
|
|
4434
4427
|
},
|
|
4435
4428
|
data() {
|
|
4436
|
-
return {
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4429
|
+
return {
|
|
4430
|
+
// 话题弹框相关数据
|
|
4431
|
+
topicPopover: {
|
|
4432
|
+
visible: false,
|
|
4433
|
+
type: "hot",
|
|
4434
|
+
// 'hot' 热门话题, 'search' 搜索话题
|
|
4435
|
+
activeTab: "hot",
|
|
4436
|
+
// 'hot' 热门话题, 'recent' 最近使用
|
|
4437
|
+
position: { top: 0, left: 0 },
|
|
4438
|
+
searchKeyword: "",
|
|
4439
|
+
hotTopics: [],
|
|
4440
|
+
searchTopics: [],
|
|
4441
|
+
recentTopics: [],
|
|
4442
|
+
loading: false,
|
|
4443
|
+
page: 1,
|
|
4444
|
+
hasMore: true,
|
|
4445
|
+
searchPage: 1,
|
|
4446
|
+
searchHasMore: true,
|
|
4447
|
+
// 保存原始的selection和range信息
|
|
4448
|
+
originalRange: null,
|
|
4449
|
+
originalSelection: null,
|
|
4450
|
+
// 保存触发位置信息
|
|
4451
|
+
triggerInfo: {
|
|
4452
|
+
paragraph: null,
|
|
4453
|
+
hashIndex: -1,
|
|
4454
|
+
cursorPosition: 0
|
|
4455
|
+
},
|
|
4456
|
+
// 全局弹框DOM引用
|
|
4457
|
+
globalContainer: null,
|
|
4458
|
+
globalMask: null
|
|
4445
4459
|
}
|
|
4446
|
-
}
|
|
4447
|
-
},
|
|
4448
|
-
mounted() {
|
|
4449
|
-
},
|
|
4450
|
-
methods: {
|
|
4451
|
-
emitEvent() {
|
|
4452
|
-
var event = new MouseEvent("click");
|
|
4453
|
-
var ele = document.getElementsByClassName("video-input");
|
|
4454
|
-
ele[0].dispatchEvent(event);
|
|
4455
|
-
},
|
|
4456
|
-
setStatus(val) {
|
|
4457
|
-
this.$emit("update:visible", val);
|
|
4458
|
-
}
|
|
4459
|
-
}
|
|
4460
|
-
};
|
|
4461
|
-
const _hoisted_1$2 = /* @__PURE__ */ vue.createElementVNode("div", null, [
|
|
4462
|
-
/* @__PURE__ */ vue.createElementVNode("span", null, "\u91C7\u96C6\u6587\u7AE0"),
|
|
4463
|
-
/* @__PURE__ */ vue.createElementVNode("span", { class: "collect-article_lable" }, "\u5982\u9700\u83B7\u5F97\u6B63\u5F0F\u4F7F\u7528\u6743\uFF0C\u8BF7\u81EA\u884C\u8054\u7CFB\u7248\u6743\u6240\u6709\u8005")
|
|
4464
|
-
], -1);
|
|
4465
|
-
const _hoisted_2$2 = { class: "collect-article_content" };
|
|
4466
|
-
const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "tip" }, "\u8BF7\u628A\u9700\u8981\u91C7\u96C6\u7684\u6587\u7AE0\u94FE\u63A5\u7C98\u8D34\u5728\u4E0B\u65B9\u7684\u8F93\u5165\u6846\uFF1A", -1);
|
|
4467
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4468
|
-
const _component_el_input = vue.resolveComponent("el-input");
|
|
4469
|
-
const _component_BasicDialog = vue.resolveComponent("BasicDialog");
|
|
4470
|
-
return vue.openBlock(), vue.createBlock(_component_BasicDialog, {
|
|
4471
|
-
visible: $props.visible,
|
|
4472
|
-
width: "600px",
|
|
4473
|
-
height: "50px"
|
|
4474
|
-
}, {
|
|
4475
|
-
title: vue.withCtx(() => [
|
|
4476
|
-
_hoisted_1$2
|
|
4477
|
-
]),
|
|
4478
|
-
default: vue.withCtx(() => [
|
|
4479
|
-
vue.createElementVNode("div", _hoisted_2$2, [
|
|
4480
|
-
_hoisted_3$2,
|
|
4481
|
-
vue.createVNode(_component_el_input, {
|
|
4482
|
-
modelValue: $options.input,
|
|
4483
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.input = $event),
|
|
4484
|
-
placeholder: "\u4EC5\u652F\u6301\u5FAE\u4FE1\u94FE\u63A5"
|
|
4485
|
-
}, null, 8, ["modelValue"])
|
|
4486
|
-
])
|
|
4487
|
-
]),
|
|
4488
|
-
_: 1
|
|
4489
|
-
}, 8, ["visible"]);
|
|
4490
|
-
}
|
|
4491
|
-
const CollectArticle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
4492
|
-
const index_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
4493
|
-
const _sfc_main$1 = {
|
|
4494
|
-
components: {
|
|
4495
|
-
ElIconError: iconsVue.CircleCloseFilled
|
|
4496
|
-
},
|
|
4497
|
-
props: {
|
|
4498
|
-
article: {
|
|
4499
|
-
type: Object,
|
|
4500
|
-
default: () => ({})
|
|
4501
|
-
}
|
|
4460
|
+
};
|
|
4502
4461
|
},
|
|
4503
4462
|
methods: {
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
break;
|
|
4510
|
-
}
|
|
4511
|
-
child = child.parentNode;
|
|
4463
|
+
// 初始化话题管理器
|
|
4464
|
+
init() {
|
|
4465
|
+
if (!this.editorDom) {
|
|
4466
|
+
console.warn("TopicManager: editorDom is required");
|
|
4467
|
+
return;
|
|
4512
4468
|
}
|
|
4513
|
-
this
|
|
4514
|
-
}
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4469
|
+
setTimeout(() => this.bindEditorEvents(), 0);
|
|
4470
|
+
},
|
|
4471
|
+
// 绑定编辑器事件
|
|
4472
|
+
bindEditorEvents() {
|
|
4473
|
+
if (!this.editorDom)
|
|
4474
|
+
return;
|
|
4475
|
+
this.editorDom.addEventListener("keydown", this.handleTopicInput.bind(this));
|
|
4476
|
+
},
|
|
4477
|
+
// 解绑编辑器事件
|
|
4478
|
+
unbindEditorEvents() {
|
|
4479
|
+
if (!this.editorDom)
|
|
4480
|
+
return;
|
|
4481
|
+
this.editorDom.removeEventListener("keydown", this.handleTopicInput.bind(this));
|
|
4482
|
+
},
|
|
4483
|
+
// 话题输入处理
|
|
4484
|
+
handleTopicInput(event) {
|
|
4485
|
+
var _a;
|
|
4486
|
+
const activeElement = document.activeElement;
|
|
4487
|
+
if (activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA")) {
|
|
4488
|
+
return;
|
|
4489
|
+
}
|
|
4490
|
+
const selection = window.getSelection();
|
|
4491
|
+
if (selection.rangeCount === 0)
|
|
4492
|
+
return;
|
|
4493
|
+
const range = selection.getRangeAt(0);
|
|
4494
|
+
const container = range.startContainer;
|
|
4495
|
+
if (!this.editorDom.contains(container))
|
|
4496
|
+
return;
|
|
4497
|
+
let currentNode = container;
|
|
4498
|
+
while (currentNode && currentNode !== this.editorDom) {
|
|
4499
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.tagName === "MDD-TOPIC") {
|
|
4500
|
+
return;
|
|
4501
|
+
}
|
|
4502
|
+
currentNode = currentNode.parentNode;
|
|
4503
|
+
}
|
|
4504
|
+
let paragraph = container;
|
|
4505
|
+
while (paragraph && paragraph.nodeType !== Node.ELEMENT_NODE) {
|
|
4506
|
+
paragraph = paragraph.parentNode;
|
|
4507
|
+
}
|
|
4508
|
+
while (paragraph && !((_a = paragraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
4509
|
+
paragraph = paragraph.parentNode;
|
|
4510
|
+
}
|
|
4511
|
+
if (!paragraph)
|
|
4512
|
+
return;
|
|
4513
|
+
const { textContent: paragraphText, cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
4514
|
+
if (event.key === "#") {
|
|
4515
|
+
const afterCursor = paragraphText.substring(cursorPosition);
|
|
4516
|
+
if (afterCursor.length > 0 && (afterCursor[0] === "@" || afterCursor[0] === " ")) {
|
|
4517
|
+
return;
|
|
4518
|
+
}
|
|
4519
|
+
setTimeout(() => {
|
|
4520
|
+
const position = this.getCaretPosition();
|
|
4521
|
+
const triggerInfo = {
|
|
4522
|
+
paragraph,
|
|
4523
|
+
hashIndex: cursorPosition,
|
|
4524
|
+
// #号的位置
|
|
4525
|
+
cursorPosition: cursorPosition + 1
|
|
4526
|
+
// #号后的位置
|
|
4527
|
+
};
|
|
4528
|
+
this.showTopicPopover("hot", position, "", triggerInfo);
|
|
4529
|
+
}, 10);
|
|
4530
|
+
} else if (this.shouldTriggerSearch(event.key)) {
|
|
4531
|
+
setTimeout(() => {
|
|
4532
|
+
this.checkAndTriggerSearch(paragraph);
|
|
4533
|
+
}, 10);
|
|
4534
|
+
}
|
|
4535
|
+
},
|
|
4536
|
+
shouldTriggerSearch(key) {
|
|
4537
|
+
return key.length === 1 || key === "Backspace" || key === "Delete";
|
|
4538
|
+
},
|
|
4539
|
+
checkAndTriggerSearch(paragraph) {
|
|
4540
|
+
const selection = window.getSelection();
|
|
4541
|
+
if (selection.rangeCount === 0)
|
|
4542
|
+
return;
|
|
4543
|
+
const range = selection.getRangeAt(0);
|
|
4544
|
+
let currentNode = range.startContainer;
|
|
4545
|
+
while (currentNode && currentNode !== paragraph) {
|
|
4546
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.tagName === "MDD-TOPIC") {
|
|
4547
|
+
this.hideTopicPopover();
|
|
4548
|
+
return;
|
|
4549
|
+
}
|
|
4550
|
+
currentNode = currentNode.parentNode;
|
|
4551
|
+
}
|
|
4552
|
+
const { textContent: paragraphText, cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
4553
|
+
const beforeCursor = paragraphText.substring(0, cursorPosition);
|
|
4554
|
+
const hashIndex = beforeCursor.lastIndexOf("#");
|
|
4555
|
+
if (hashIndex !== -1) {
|
|
4556
|
+
const afterHash = beforeCursor.substring(hashIndex + 1);
|
|
4557
|
+
if (afterHash.indexOf(" ") === -1 && afterHash.indexOf("@") === -1) {
|
|
4558
|
+
if (afterHash.length <= 15) {
|
|
4559
|
+
const position = this.getCaretPosition();
|
|
4560
|
+
const triggerInfo = {
|
|
4561
|
+
paragraph,
|
|
4562
|
+
hashIndex,
|
|
4563
|
+
cursorPosition
|
|
4564
|
+
};
|
|
4565
|
+
if (afterHash.length === 0) {
|
|
4566
|
+
this.showTopicPopover("hot", position, "", triggerInfo);
|
|
4567
|
+
} else {
|
|
4568
|
+
this.showTopicPopover("search", position, afterHash, triggerInfo);
|
|
4569
|
+
}
|
|
4570
|
+
} else if (afterHash.length > 15) {
|
|
4571
|
+
this.hideTopicPopover();
|
|
4572
|
+
}
|
|
4573
|
+
} else {
|
|
4574
|
+
this.hideTopicPopover();
|
|
4575
|
+
}
|
|
4576
|
+
} else {
|
|
4577
|
+
this.hideTopicPopover();
|
|
4578
|
+
}
|
|
4579
|
+
},
|
|
4580
|
+
getParagraphTextExcludingTopics(paragraph, range) {
|
|
4581
|
+
let textContent = "";
|
|
4582
|
+
let cursorPosition = 0;
|
|
4583
|
+
let foundCursor = false;
|
|
4584
|
+
const walker = document.createTreeWalker(
|
|
4585
|
+
paragraph,
|
|
4586
|
+
NodeFilter.SHOW_ALL,
|
|
4587
|
+
{
|
|
4588
|
+
acceptNode: function(node2) {
|
|
4589
|
+
if (node2.nodeType === Node.ELEMENT_NODE && node2.tagName === "MDD-TOPIC") {
|
|
4590
|
+
return NodeFilter.FILTER_REJECT;
|
|
4591
|
+
}
|
|
4592
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
4593
|
+
}
|
|
4594
|
+
},
|
|
4595
|
+
false
|
|
4596
|
+
);
|
|
4597
|
+
let node;
|
|
4598
|
+
while (node = walker.nextNode()) {
|
|
4599
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
4600
|
+
const nodeText = node.textContent;
|
|
4601
|
+
if (!foundCursor && node === range.startContainer) {
|
|
4602
|
+
cursorPosition = textContent.length + range.startOffset;
|
|
4603
|
+
foundCursor = true;
|
|
4604
|
+
}
|
|
4605
|
+
textContent += nodeText;
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
return { textContent, cursorPosition };
|
|
4609
|
+
},
|
|
4610
|
+
getCaretPosition() {
|
|
4611
|
+
const selection = window.getSelection();
|
|
4612
|
+
if (selection.rangeCount === 0)
|
|
4613
|
+
return { top: 0, left: 0 };
|
|
4614
|
+
const range = selection.getRangeAt(0);
|
|
4615
|
+
const rect = range.getBoundingClientRect();
|
|
4616
|
+
return {
|
|
4617
|
+
top: rect.bottom + window.scrollY,
|
|
4618
|
+
left: rect.left + window.scrollX
|
|
4619
|
+
};
|
|
4620
|
+
},
|
|
4621
|
+
// 话题弹框相关方法
|
|
4622
|
+
showTopicPopover(type, position, searchKeyword = "", triggerInfo = null) {
|
|
4623
|
+
if (!this.request || !this.request.getTopic) {
|
|
4624
|
+
console.warn("话题功能需要提供 request.getTopic 方法");
|
|
4625
|
+
return;
|
|
4626
|
+
}
|
|
4627
|
+
const selection = window.getSelection();
|
|
4628
|
+
if (selection.rangeCount > 0) {
|
|
4629
|
+
this.topicPopover.originalRange = selection.getRangeAt(0).cloneRange();
|
|
4630
|
+
this.topicPopover.originalSelection = selection;
|
|
4631
|
+
}
|
|
4632
|
+
if (triggerInfo) {
|
|
4633
|
+
this.topicPopover.triggerInfo = triggerInfo;
|
|
4634
|
+
}
|
|
4635
|
+
this.topicPopover.visible = true;
|
|
4636
|
+
this.topicPopover.type = type;
|
|
4637
|
+
this.topicPopover.position = position;
|
|
4638
|
+
this.topicPopover.searchKeyword = searchKeyword;
|
|
4639
|
+
if (type === "hot") {
|
|
4640
|
+
this.topicPopover.activeTab = "hot";
|
|
4641
|
+
this.loadHotTopics();
|
|
4642
|
+
this.loadRecentTopics();
|
|
4643
|
+
} else if (type === "search") {
|
|
4644
|
+
this.searchTopics(searchKeyword);
|
|
4645
|
+
}
|
|
4646
|
+
this.createGlobalTopicPopover();
|
|
4647
|
+
},
|
|
4648
|
+
hideTopicPopover() {
|
|
4649
|
+
this.topicPopover.visible = false;
|
|
4650
|
+
this.topicPopover.hotTopics = [];
|
|
4651
|
+
this.topicPopover.searchTopics = [];
|
|
4652
|
+
this.topicPopover.page = 1;
|
|
4653
|
+
this.topicPopover.searchPage = 1;
|
|
4654
|
+
this.topicPopover.hasMore = true;
|
|
4655
|
+
this.topicPopover.searchHasMore = true;
|
|
4656
|
+
this.topicPopover.originalRange = null;
|
|
4657
|
+
this.topicPopover.originalSelection = null;
|
|
4658
|
+
this.topicPopover.triggerInfo = {
|
|
4659
|
+
paragraph: null,
|
|
4660
|
+
hashIndex: -1,
|
|
4661
|
+
cursorPosition: 0
|
|
4662
|
+
};
|
|
4663
|
+
this.removeGlobalTopicPopover();
|
|
4664
|
+
},
|
|
4665
|
+
switchTopicTab(tab) {
|
|
4666
|
+
this.topicPopover.activeTab = tab;
|
|
4667
|
+
this.updateGlobalTopicPopover();
|
|
4668
|
+
},
|
|
4669
|
+
async loadHotTopics() {
|
|
4670
|
+
if (this.topicPopover.loading || !this.topicPopover.hasMore)
|
|
4671
|
+
return;
|
|
4672
|
+
this.topicPopover.loading = true;
|
|
4673
|
+
try {
|
|
4674
|
+
const response = await this.request.getTopic({
|
|
4675
|
+
action: "201023",
|
|
4676
|
+
page: this.topicPopover.page,
|
|
4677
|
+
limit: 50,
|
|
4678
|
+
hoopId: 0,
|
|
4679
|
+
type: 0,
|
|
4680
|
+
orderBy: "view"
|
|
4681
|
+
});
|
|
4682
|
+
if (response && response.data && response.data.code === 0) {
|
|
4683
|
+
const topics = response.data.data || [];
|
|
4684
|
+
if (topics.length === 0) {
|
|
4685
|
+
this.topicPopover.hasMore = false;
|
|
4686
|
+
} else {
|
|
4687
|
+
const existingIds = new Set(this.topicPopover.hotTopics.map((t) => t.id));
|
|
4688
|
+
const newTopics = topics.filter((t) => !existingIds.has(t.id));
|
|
4689
|
+
this.topicPopover.hotTopics = [...this.topicPopover.hotTopics, ...newTopics];
|
|
4690
|
+
this.topicPopover.page++;
|
|
4691
|
+
if (newTopics.length === 0) {
|
|
4692
|
+
this.topicPopover.hasMore = false;
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
} else {
|
|
4696
|
+
console.warn("加载热门话题失败:", response);
|
|
4697
|
+
this.topicPopover.hasMore = false;
|
|
4698
|
+
}
|
|
4699
|
+
} catch (error) {
|
|
4700
|
+
console.error("加载热门话题失败:", error);
|
|
4701
|
+
this.topicPopover.hasMore = false;
|
|
4702
|
+
} finally {
|
|
4703
|
+
this.topicPopover.loading = false;
|
|
4704
|
+
this.updateGlobalTopicPopover();
|
|
4705
|
+
}
|
|
4706
|
+
},
|
|
4707
|
+
async searchTopics(keyword) {
|
|
4708
|
+
this.topicPopover.searchKeyword = keyword;
|
|
4709
|
+
this.topicPopover.searchTopics = [];
|
|
4710
|
+
this.topicPopover.searchPage = 1;
|
|
4711
|
+
this.topicPopover.searchHasMore = true;
|
|
4712
|
+
if (this.topicPopover.loading) {
|
|
4713
|
+
this.topicPopover.loading = false;
|
|
4714
|
+
}
|
|
4715
|
+
this.topicPopover.loading = true;
|
|
4716
|
+
try {
|
|
4717
|
+
const response = await this.request.getTopic({
|
|
4718
|
+
action: "201023",
|
|
4719
|
+
title: keyword,
|
|
4720
|
+
highlightTitle: "title",
|
|
4721
|
+
page: this.topicPopover.searchPage,
|
|
4722
|
+
limit: 50
|
|
4723
|
+
});
|
|
4724
|
+
if (response && response.data && response.data.code === 0) {
|
|
4725
|
+
const topics = response.data.data || [];
|
|
4726
|
+
this.topicPopover.searchTopics = topics;
|
|
4727
|
+
this.topicPopover.searchPage++;
|
|
4728
|
+
if (topics.length === 0) {
|
|
4729
|
+
this.topicPopover.searchHasMore = false;
|
|
4730
|
+
} else {
|
|
4731
|
+
this.topicPopover.searchHasMore = topics.length >= 50;
|
|
4732
|
+
}
|
|
4733
|
+
} else {
|
|
4734
|
+
console.warn("搜索话题失败:", response);
|
|
4735
|
+
this.topicPopover.searchHasMore = false;
|
|
4736
|
+
}
|
|
4737
|
+
} catch (error) {
|
|
4738
|
+
console.error("搜索话题失败:", error);
|
|
4739
|
+
this.topicPopover.searchHasMore = false;
|
|
4740
|
+
} finally {
|
|
4741
|
+
this.topicPopover.loading = false;
|
|
4742
|
+
this.updateGlobalTopicPopover();
|
|
4743
|
+
}
|
|
4744
|
+
},
|
|
4745
|
+
loadRecentTopics() {
|
|
4746
|
+
try {
|
|
4747
|
+
const localTopics = JSON.parse(localStorage.getItem("localTopic") || "[]");
|
|
4748
|
+
this.topicPopover.recentTopics = localTopics;
|
|
4749
|
+
} catch (error) {
|
|
4750
|
+
console.error("加载最近使用话题失败:", error);
|
|
4751
|
+
this.topicPopover.recentTopics = [];
|
|
4752
|
+
}
|
|
4753
|
+
},
|
|
4754
|
+
selectTopic(topic) {
|
|
4755
|
+
this.saveToRecentTopics(topic);
|
|
4756
|
+
this.insertTopicToEditor(topic);
|
|
4757
|
+
this.hideTopicPopover();
|
|
4758
|
+
this.$emit("topic-inserted", topic);
|
|
4759
|
+
},
|
|
4760
|
+
saveToRecentTopics(topic) {
|
|
4761
|
+
try {
|
|
4762
|
+
let recentTopics = JSON.parse(localStorage.getItem("localTopic") || "[]");
|
|
4763
|
+
recentTopics = recentTopics.filter((item) => item.id !== topic.id);
|
|
4764
|
+
recentTopics.unshift(topic);
|
|
4765
|
+
if (recentTopics.length > 20) {
|
|
4766
|
+
recentTopics = recentTopics.slice(0, 20);
|
|
4767
|
+
}
|
|
4768
|
+
localStorage.setItem("localTopic", JSON.stringify(recentTopics));
|
|
4769
|
+
} catch (error) {
|
|
4770
|
+
console.error("保存最近使用话题失败:", error);
|
|
4771
|
+
}
|
|
4772
|
+
},
|
|
4773
|
+
// 创建全局话题弹框
|
|
4774
|
+
createGlobalTopicPopover() {
|
|
4775
|
+
this.removeGlobalTopicPopover();
|
|
4776
|
+
const mask = document.createElement("div");
|
|
4777
|
+
mask.className = "topic-popover-mask";
|
|
4778
|
+
mask.addEventListener("click", () => {
|
|
4779
|
+
this.hideTopicPopover();
|
|
4780
|
+
});
|
|
4781
|
+
const container = document.createElement("div");
|
|
4782
|
+
container.className = "topic-popover";
|
|
4783
|
+
container.style.position = "fixed";
|
|
4784
|
+
container.style.top = this.topicPopover.position.top + "px";
|
|
4785
|
+
container.style.left = this.topicPopover.position.left + "px";
|
|
4786
|
+
container.style.zIndex = "9999";
|
|
4787
|
+
container.addEventListener("click", (e) => {
|
|
4788
|
+
e.stopPropagation();
|
|
4789
|
+
});
|
|
4790
|
+
container.innerHTML = this.createTopicPopoverContent();
|
|
4791
|
+
document.body.appendChild(mask);
|
|
4792
|
+
document.body.appendChild(container);
|
|
4793
|
+
this.topicPopover.globalMask = mask;
|
|
4794
|
+
this.topicPopover.globalContainer = container;
|
|
4795
|
+
this.bindTopicPopoverEvents();
|
|
4796
|
+
},
|
|
4797
|
+
// 移除全局话题弹框
|
|
4798
|
+
removeGlobalTopicPopover() {
|
|
4799
|
+
if (this.topicPopover.globalMask) {
|
|
4800
|
+
document.body.removeChild(this.topicPopover.globalMask);
|
|
4801
|
+
this.topicPopover.globalMask = null;
|
|
4802
|
+
}
|
|
4803
|
+
if (this.topicPopover.globalContainer) {
|
|
4804
|
+
document.body.removeChild(this.topicPopover.globalContainer);
|
|
4805
|
+
this.topicPopover.globalContainer = null;
|
|
4806
|
+
}
|
|
4807
|
+
},
|
|
4808
|
+
// 更新全局话题弹框内容
|
|
4809
|
+
updateGlobalTopicPopover() {
|
|
4810
|
+
if (!this.topicPopover.globalContainer)
|
|
4811
|
+
return;
|
|
4812
|
+
this.topicPopover.globalContainer.innerHTML = this.createTopicPopoverContent();
|
|
4813
|
+
this.bindTopicPopoverEvents();
|
|
4814
|
+
},
|
|
4815
|
+
// 创建话题弹框内容
|
|
4816
|
+
createTopicPopoverContent() {
|
|
4817
|
+
if (this.topicPopover.type === "hot") {
|
|
4818
|
+
return this.getHotTopicPopoverHTML();
|
|
4819
|
+
} else if (this.topicPopover.type === "search") {
|
|
4820
|
+
return this.getSearchTopicPopoverHTML();
|
|
4821
|
+
}
|
|
4822
|
+
return "";
|
|
4823
|
+
},
|
|
4824
|
+
// 获取热门话题弹框HTML
|
|
4825
|
+
getHotTopicPopoverHTML() {
|
|
4826
|
+
const activeTab = this.topicPopover.activeTab;
|
|
4827
|
+
const hotTopics = this.topicPopover.hotTopics;
|
|
4828
|
+
const recentTopics = this.topicPopover.recentTopics;
|
|
4829
|
+
const loading = this.topicPopover.loading;
|
|
4830
|
+
const hasMore = this.topicPopover.hasMore;
|
|
4831
|
+
let topicListHTML = "";
|
|
4832
|
+
if (activeTab === "hot") {
|
|
4833
|
+
if (loading && hotTopics.length === 0) {
|
|
4834
|
+
topicListHTML = '<div class="topic-loading">加载中...</div>';
|
|
4835
|
+
} else if (hotTopics.length === 0) {
|
|
4836
|
+
topicListHTML = '<div class="topic-empty">暂无热门话题</div>';
|
|
4837
|
+
} else {
|
|
4838
|
+
topicListHTML = hotTopics.map(
|
|
4839
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
4840
|
+
).join("");
|
|
4841
|
+
if (loading) {
|
|
4842
|
+
topicListHTML += '<div class="topic-loading">加载更多...</div>';
|
|
4843
|
+
} else if (!hasMore) {
|
|
4844
|
+
topicListHTML += '<div class="topic-empty">没有更多了</div>';
|
|
4845
|
+
}
|
|
4846
|
+
}
|
|
4847
|
+
} else {
|
|
4848
|
+
if (recentTopics.length === 0) {
|
|
4849
|
+
topicListHTML = '<div class="topic-empty">暂无最近使用记录</div>';
|
|
4850
|
+
} else {
|
|
4851
|
+
topicListHTML = recentTopics.map(
|
|
4852
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
4853
|
+
).join("");
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
return `
|
|
4857
|
+
<div class="topic-popover-content">
|
|
4858
|
+
<div class="topic-tabs">
|
|
4859
|
+
<div class="topic-tab ${activeTab === "hot" ? "active" : ""}" data-tab="hot">
|
|
4860
|
+
热门话题
|
|
4861
|
+
</div>
|
|
4862
|
+
<div class="topic-tab ${activeTab === "recent" ? "active" : ""}" data-tab="recent">
|
|
4863
|
+
最近使用
|
|
4864
|
+
</div>
|
|
4865
|
+
</div>
|
|
4866
|
+
<div class="topic-list-container">
|
|
4867
|
+
<div class="topic-list">
|
|
4868
|
+
${topicListHTML}
|
|
4869
|
+
</div>
|
|
4870
|
+
</div>
|
|
4871
|
+
</div>
|
|
4872
|
+
`;
|
|
4873
|
+
},
|
|
4874
|
+
// 获取搜索话题弹框HTML
|
|
4875
|
+
getSearchTopicPopoverHTML() {
|
|
4876
|
+
const searchKeyword = this.topicPopover.searchKeyword;
|
|
4877
|
+
const searchTopics = this.topicPopover.searchTopics;
|
|
4878
|
+
const loading = this.topicPopover.loading;
|
|
4879
|
+
const searchHasMore = this.topicPopover.searchHasMore;
|
|
4880
|
+
let topicListHTML = "";
|
|
4881
|
+
if (loading && searchTopics.length === 0) {
|
|
4882
|
+
topicListHTML = '<div class="topic-loading">搜索中...</div>';
|
|
4883
|
+
} else if (searchTopics.length === 0) {
|
|
4884
|
+
topicListHTML = '<div class="topic-empty">没有匹配到话题,请重新输入</div>';
|
|
4885
|
+
} else {
|
|
4886
|
+
topicListHTML = searchTopics.map(
|
|
4887
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
4888
|
+
).join("");
|
|
4889
|
+
if (loading) {
|
|
4890
|
+
topicListHTML += '<div class="topic-loading">加载更多...</div>';
|
|
4891
|
+
} else if (!searchHasMore) {
|
|
4892
|
+
topicListHTML += '<div class="topic-empty">没有更多了</div>';
|
|
4893
|
+
}
|
|
4894
|
+
}
|
|
4895
|
+
return `
|
|
4896
|
+
<div class="topic-popover-content">
|
|
4897
|
+
<div class="topic-search-header">
|
|
4898
|
+
<span class="topic-search-title">#${searchKeyword}</span>
|
|
4899
|
+
</div>
|
|
4900
|
+
<div class="topic-list-container">
|
|
4901
|
+
<div class="topic-list">
|
|
4902
|
+
${topicListHTML}
|
|
4903
|
+
</div>
|
|
4904
|
+
</div>
|
|
4905
|
+
</div>
|
|
4906
|
+
`;
|
|
4907
|
+
},
|
|
4908
|
+
// 绑定话题弹框事件
|
|
4909
|
+
bindTopicPopoverEvents() {
|
|
4910
|
+
if (!this.topicPopover.globalContainer)
|
|
4911
|
+
return;
|
|
4912
|
+
const tabs = this.topicPopover.globalContainer.querySelectorAll(".topic-tab");
|
|
4913
|
+
tabs.forEach((tab) => {
|
|
4914
|
+
tab.addEventListener("click", (e) => {
|
|
4915
|
+
const tabType = e.target.getAttribute("data-tab");
|
|
4916
|
+
this.switchTopicTab(tabType);
|
|
4917
|
+
});
|
|
4918
|
+
});
|
|
4919
|
+
const topicItems = this.topicPopover.globalContainer.querySelectorAll(".topic-item");
|
|
4920
|
+
topicItems.forEach((item) => {
|
|
4921
|
+
item.addEventListener("click", (e) => {
|
|
4922
|
+
const topicId = parseInt(e.target.getAttribute("data-topic-id"));
|
|
4923
|
+
const topic = this.findTopicById(topicId);
|
|
4924
|
+
if (topic) {
|
|
4925
|
+
this.selectTopic(topic);
|
|
4926
|
+
}
|
|
4927
|
+
});
|
|
4928
|
+
});
|
|
4929
|
+
const listContainer = this.topicPopover.globalContainer.querySelector(".topic-list-container");
|
|
4930
|
+
if (listContainer) {
|
|
4931
|
+
listContainer.addEventListener("scroll", (e) => {
|
|
4932
|
+
if (this.topicPopover.type === "hot") {
|
|
4933
|
+
this.handleTopicScroll(e);
|
|
4934
|
+
} else if (this.topicPopover.type === "search") {
|
|
4935
|
+
this.handleSearchTopicScroll(e);
|
|
4936
|
+
}
|
|
4937
|
+
});
|
|
4938
|
+
}
|
|
4939
|
+
},
|
|
4940
|
+
// 根据ID查找话题
|
|
4941
|
+
findTopicById(topicId) {
|
|
4942
|
+
let topic = this.topicPopover.hotTopics.find((t) => t.id === topicId);
|
|
4943
|
+
if (topic)
|
|
4944
|
+
return topic;
|
|
4945
|
+
topic = this.topicPopover.searchTopics.find((t) => t.id === topicId);
|
|
4946
|
+
if (topic)
|
|
4947
|
+
return topic;
|
|
4948
|
+
topic = this.topicPopover.recentTopics.find((t) => t.id === topicId);
|
|
4949
|
+
if (topic)
|
|
4950
|
+
return topic;
|
|
4951
|
+
return null;
|
|
4952
|
+
},
|
|
4953
|
+
handleTopicScroll(event) {
|
|
4954
|
+
if (this.topicPopover.activeTab !== "hot")
|
|
4955
|
+
return;
|
|
4956
|
+
const container = event.target;
|
|
4957
|
+
const scrollTop = container.scrollTop;
|
|
4958
|
+
const scrollHeight = container.scrollHeight;
|
|
4959
|
+
const clientHeight = container.clientHeight;
|
|
4960
|
+
if (scrollTop + clientHeight >= scrollHeight - 10) {
|
|
4961
|
+
this.loadHotTopics();
|
|
4962
|
+
}
|
|
4963
|
+
},
|
|
4964
|
+
handleSearchTopicScroll(event) {
|
|
4965
|
+
const container = event.target;
|
|
4966
|
+
const scrollTop = container.scrollTop;
|
|
4967
|
+
const scrollHeight = container.scrollHeight;
|
|
4968
|
+
const clientHeight = container.clientHeight;
|
|
4969
|
+
if (scrollTop + clientHeight >= scrollHeight - 10) {
|
|
4970
|
+
this.searchTopics(this.topicPopover.searchKeyword);
|
|
4971
|
+
}
|
|
4972
|
+
},
|
|
4973
|
+
insertTopicToEditor(topic) {
|
|
4974
|
+
const originalRange = this.topicPopover.originalRange;
|
|
4975
|
+
const triggerInfo = this.topicPopover.triggerInfo;
|
|
4976
|
+
const popoverType = this.topicPopover.type;
|
|
4977
|
+
this.hideTopicPopover();
|
|
4978
|
+
let range = originalRange;
|
|
4979
|
+
if (!range) {
|
|
4980
|
+
const selection2 = window.getSelection();
|
|
4981
|
+
if (selection2.rangeCount === 0)
|
|
4982
|
+
return;
|
|
4983
|
+
range = selection2.getRangeAt(0);
|
|
4984
|
+
}
|
|
4985
|
+
const topicText = `#${topic.exactlyMatchTitle}`;
|
|
4986
|
+
if (popoverType === "search" && triggerInfo && triggerInfo.paragraph) {
|
|
4987
|
+
const paragraph = triggerInfo.paragraph;
|
|
4988
|
+
const hashIndex = triggerInfo.hashIndex;
|
|
4989
|
+
const deleteRange = document.createRange();
|
|
4990
|
+
const walker = document.createTreeWalker(
|
|
4991
|
+
paragraph,
|
|
4992
|
+
NodeFilter.SHOW_TEXT,
|
|
4993
|
+
{
|
|
4994
|
+
acceptNode: function(node2) {
|
|
4995
|
+
let parent = node2.parentNode;
|
|
4996
|
+
while (parent && parent !== paragraph) {
|
|
4997
|
+
if (parent.tagName === "MDD-TOPIC") {
|
|
4998
|
+
return NodeFilter.FILTER_REJECT;
|
|
4999
|
+
}
|
|
5000
|
+
parent = parent.parentNode;
|
|
5001
|
+
}
|
|
5002
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
5003
|
+
}
|
|
5004
|
+
},
|
|
5005
|
+
false
|
|
5006
|
+
);
|
|
5007
|
+
let position = 0;
|
|
5008
|
+
let startNode = null;
|
|
5009
|
+
let startOffset = 0;
|
|
5010
|
+
let endNode = null;
|
|
5011
|
+
let endOffset = 0;
|
|
5012
|
+
let node;
|
|
5013
|
+
while (node = walker.nextNode()) {
|
|
5014
|
+
if (position + node.textContent.length > hashIndex) {
|
|
5015
|
+
startNode = node;
|
|
5016
|
+
startOffset = hashIndex - position;
|
|
5017
|
+
break;
|
|
5018
|
+
}
|
|
5019
|
+
position += node.textContent.length;
|
|
5020
|
+
}
|
|
5021
|
+
const currentCursorPosition = triggerInfo.cursorPosition;
|
|
5022
|
+
position = 0;
|
|
5023
|
+
walker.currentNode = paragraph;
|
|
5024
|
+
while (node = walker.nextNode()) {
|
|
5025
|
+
if (position + node.textContent.length >= currentCursorPosition) {
|
|
5026
|
+
endNode = node;
|
|
5027
|
+
endOffset = currentCursorPosition - position;
|
|
5028
|
+
break;
|
|
5029
|
+
}
|
|
5030
|
+
position += node.textContent.length;
|
|
5031
|
+
}
|
|
5032
|
+
if (startNode && endNode) {
|
|
5033
|
+
deleteRange.setStart(startNode, startOffset);
|
|
5034
|
+
deleteRange.setEnd(endNode, endOffset);
|
|
5035
|
+
deleteRange.deleteContents();
|
|
5036
|
+
range = document.createRange();
|
|
5037
|
+
range.setStart(startNode, startOffset);
|
|
5038
|
+
range.collapse(true);
|
|
5039
|
+
}
|
|
5040
|
+
} else if (popoverType === "hot") {
|
|
5041
|
+
const container = range.startContainer;
|
|
5042
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent) {
|
|
5043
|
+
const offset = range.startOffset;
|
|
5044
|
+
if (offset > 0 && container.textContent[offset - 1] === "#") {
|
|
5045
|
+
const deleteRange = document.createRange();
|
|
5046
|
+
deleteRange.setStart(container, offset - 1);
|
|
5047
|
+
deleteRange.setEnd(container, offset);
|
|
5048
|
+
deleteRange.deleteContents();
|
|
5049
|
+
range.setStart(container, offset - 1);
|
|
5050
|
+
range.collapse(true);
|
|
5051
|
+
}
|
|
5052
|
+
}
|
|
5053
|
+
}
|
|
5054
|
+
const topicElement = document.createElement("mdd-topic");
|
|
5055
|
+
topicElement.setAttribute("data-topic", JSON.stringify({
|
|
5056
|
+
topicId: topic.id,
|
|
5057
|
+
topicType: 0,
|
|
5058
|
+
startIndex: 0,
|
|
5059
|
+
// 会在updateTopicPosition中更新
|
|
5060
|
+
endIndex: 0
|
|
5061
|
+
// 会在updateTopicPosition中更新
|
|
5062
|
+
}));
|
|
5063
|
+
topicElement.textContent = topicText;
|
|
5064
|
+
topicElement.setAttribute("contenteditable", "false");
|
|
5065
|
+
range.deleteContents();
|
|
5066
|
+
range.insertNode(topicElement);
|
|
5067
|
+
const spaceNode = document.createTextNode(" ");
|
|
5068
|
+
range.setStartAfter(topicElement);
|
|
5069
|
+
range.insertNode(spaceNode);
|
|
5070
|
+
const newRange = document.createRange();
|
|
5071
|
+
newRange.setStartAfter(spaceNode);
|
|
5072
|
+
newRange.collapse(true);
|
|
5073
|
+
const selection = window.getSelection();
|
|
5074
|
+
selection.removeAllRanges();
|
|
5075
|
+
selection.addRange(newRange);
|
|
5076
|
+
setTimeout(() => {
|
|
5077
|
+
const currentSelection = window.getSelection();
|
|
5078
|
+
if (currentSelection.rangeCount > 0) {
|
|
5079
|
+
const currentRange = currentSelection.getRangeAt(0);
|
|
5080
|
+
if (currentRange.startContainer !== spaceNode.nextSibling) {
|
|
5081
|
+
const correctRange = document.createRange();
|
|
5082
|
+
correctRange.setStartAfter(spaceNode);
|
|
5083
|
+
correctRange.collapse(true);
|
|
5084
|
+
currentSelection.removeAllRanges();
|
|
5085
|
+
currentSelection.addRange(correctRange);
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5088
|
+
}, 0);
|
|
5089
|
+
this.$emit("update-topic-position");
|
|
5090
|
+
},
|
|
5091
|
+
// 销毁话题管理器
|
|
5092
|
+
destroy() {
|
|
5093
|
+
this.unbindEditorEvents();
|
|
5094
|
+
this.hideTopicPopover();
|
|
5095
|
+
}
|
|
5096
|
+
},
|
|
5097
|
+
mounted() {
|
|
5098
|
+
this.init();
|
|
5099
|
+
},
|
|
5100
|
+
beforeUnmount() {
|
|
5101
|
+
this.destroy();
|
|
5102
|
+
}
|
|
5103
|
+
};
|
|
5104
|
+
const _hoisted_1$3 = { class: "topic-manager" };
|
|
5105
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5106
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3);
|
|
5107
|
+
}
|
|
5108
|
+
const TopicManager = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
5109
|
+
const index_vue_vue_type_style_index_0_lang = "";
|
|
5110
|
+
const _sfc_main$2 = {
|
|
5111
|
+
provide() {
|
|
5112
|
+
return {
|
|
5113
|
+
vm: this
|
|
5114
|
+
};
|
|
5115
|
+
},
|
|
5116
|
+
components: {
|
|
5117
|
+
ElInput: elementPlus.ElInput,
|
|
5118
|
+
BasicDialog: _sfc_main$7,
|
|
5119
|
+
draggable
|
|
5120
|
+
},
|
|
5121
|
+
props: {
|
|
5122
|
+
visible: {
|
|
5123
|
+
type: Boolean,
|
|
5124
|
+
default: false
|
|
5125
|
+
},
|
|
5126
|
+
linkContent: {
|
|
5127
|
+
type: String,
|
|
5128
|
+
default: ""
|
|
5129
|
+
},
|
|
5130
|
+
fileSelected: {
|
|
5131
|
+
type: Function,
|
|
5132
|
+
default: () => {
|
|
5133
|
+
}
|
|
5134
|
+
}
|
|
5135
|
+
},
|
|
5136
|
+
data() {
|
|
5137
|
+
return {};
|
|
5138
|
+
},
|
|
5139
|
+
computed: {
|
|
5140
|
+
input: {
|
|
5141
|
+
get() {
|
|
5142
|
+
return this.linkContent;
|
|
5143
|
+
},
|
|
5144
|
+
set(val) {
|
|
5145
|
+
this.$emit("update:linkContent", val);
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
},
|
|
5149
|
+
mounted() {
|
|
5150
|
+
},
|
|
5151
|
+
methods: {
|
|
5152
|
+
emitEvent() {
|
|
5153
|
+
var event = new MouseEvent("click");
|
|
5154
|
+
var ele = document.getElementsByClassName("video-input");
|
|
5155
|
+
ele[0].dispatchEvent(event);
|
|
5156
|
+
},
|
|
5157
|
+
setStatus(val) {
|
|
5158
|
+
this.$emit("update:visible", val);
|
|
5159
|
+
}
|
|
5160
|
+
// submit() {
|
|
5161
|
+
// this.$emit('submit')
|
|
5162
|
+
// }
|
|
5163
|
+
}
|
|
5164
|
+
};
|
|
5165
|
+
const _hoisted_1$2 = { class: "collect-article_content" };
|
|
5166
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5167
|
+
const _component_el_input = vue.resolveComponent("el-input");
|
|
5168
|
+
const _component_BasicDialog = vue.resolveComponent("BasicDialog");
|
|
5169
|
+
return vue.openBlock(), vue.createBlock(_component_BasicDialog, {
|
|
5170
|
+
visible: $props.visible,
|
|
5171
|
+
width: "600px",
|
|
5172
|
+
height: "50px"
|
|
5173
|
+
}, {
|
|
5174
|
+
title: vue.withCtx(() => _cache[1] || (_cache[1] = [
|
|
5175
|
+
vue.createElementVNode("div", null, [
|
|
5176
|
+
vue.createElementVNode("span", null, "采集文章"),
|
|
5177
|
+
vue.createElementVNode("span", { class: "collect-article_lable" }, "如需获得正式使用权,请自行联系版权所有者")
|
|
5178
|
+
], -1)
|
|
5179
|
+
])),
|
|
5180
|
+
default: vue.withCtx(() => [
|
|
5181
|
+
vue.createElementVNode("div", _hoisted_1$2, [
|
|
5182
|
+
_cache[2] || (_cache[2] = vue.createElementVNode("div", { class: "tip" }, "请把需要采集的文章链接粘贴在下方的输入框:", -1)),
|
|
5183
|
+
vue.createVNode(_component_el_input, {
|
|
5184
|
+
modelValue: $options.input,
|
|
5185
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.input = $event),
|
|
5186
|
+
placeholder: "仅支持微信链接"
|
|
5187
|
+
}, null, 8, ["modelValue"])
|
|
5188
|
+
])
|
|
5189
|
+
]),
|
|
5190
|
+
_: 1
|
|
5191
|
+
}, 8, ["visible"]);
|
|
5192
|
+
}
|
|
5193
|
+
const CollectArticle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
5194
|
+
const index_vue_vue_type_style_index_0_scoped_4ebe06df_lang = "";
|
|
5195
|
+
const _sfc_main$1 = {
|
|
5196
|
+
components: {
|
|
5197
|
+
ElIconError: iconsVue.CircleCloseFilled
|
|
5198
|
+
},
|
|
5199
|
+
props: {
|
|
5200
|
+
article: {
|
|
5201
|
+
type: Object,
|
|
5202
|
+
default: () => ({})
|
|
5203
|
+
}
|
|
5204
|
+
},
|
|
5205
|
+
methods: {
|
|
5206
|
+
close(e) {
|
|
5207
|
+
let child = e.target;
|
|
5208
|
+
while (child) {
|
|
5209
|
+
if (child.dataset.article) {
|
|
5210
|
+
child.parentNode.removeChild(child);
|
|
5211
|
+
break;
|
|
5212
|
+
}
|
|
5213
|
+
child = child.parentNode;
|
|
5214
|
+
}
|
|
5215
|
+
this.$emit("delete");
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5218
|
+
};
|
|
5219
|
+
const _hoisted_1$1 = {
|
|
4518
5220
|
class: "article-item",
|
|
4519
5221
|
contenteditable: "false"
|
|
4520
5222
|
};
|
|
4521
5223
|
const _hoisted_2$1 = ["src"];
|
|
4522
5224
|
const _hoisted_3$1 = { class: "article-item_right" };
|
|
4523
|
-
const _hoisted_4
|
|
4524
|
-
const _hoisted_5
|
|
5225
|
+
const _hoisted_4 = { class: "name" };
|
|
5226
|
+
const _hoisted_5 = { class: "score" };
|
|
4525
5227
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4526
5228
|
const _component_el_icon_error = vue.resolveComponent("el-icon-error");
|
|
4527
5229
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
|
|
@@ -4531,11 +5233,11 @@
|
|
|
4531
5233
|
alt: ""
|
|
4532
5234
|
}, null, 8, _hoisted_2$1)) : vue.createCommentVNode("", true),
|
|
4533
5235
|
vue.createElementVNode("div", _hoisted_3$1, [
|
|
4534
|
-
vue.createElementVNode("div", _hoisted_4
|
|
4535
|
-
vue.createElementVNode("div", _hoisted_5
|
|
5236
|
+
vue.createElementVNode("div", _hoisted_4, vue.toDisplayString($props.article.title), 1),
|
|
5237
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
4536
5238
|
vue.createElementVNode("span", null, vue.toDisplayString($props.article.author), 1),
|
|
4537
|
-
vue.createElementVNode("span", null, vue.toDisplayString($props.article.viewNum) + "
|
|
4538
|
-
vue.createElementVNode("span", null, vue.toDisplayString($props.article.replycnt) + "
|
|
5239
|
+
vue.createElementVNode("span", null, vue.toDisplayString($props.article.viewNum) + "浏览", 1),
|
|
5240
|
+
vue.createElementVNode("span", null, vue.toDisplayString($props.article.replycnt) + "评论", 1)
|
|
4539
5241
|
])
|
|
4540
5242
|
]),
|
|
4541
5243
|
vue.createVNode(_component_el_icon_error, {
|
|
@@ -4547,10 +5249,10 @@
|
|
|
4547
5249
|
class: vue.normalizeClass([{
|
|
4548
5250
|
"article-bg-height": $props.article.img || $props.article.mediaInfo && $props.article.mediaInfo.length
|
|
4549
5251
|
}, "article-bg"])
|
|
4550
|
-
}, "
|
|
5252
|
+
}, " 平台仅支持展示18个月的推荐内容 ", 2)) : vue.createCommentVNode("", true)
|
|
4551
5253
|
]);
|
|
4552
5254
|
}
|
|
4553
|
-
const Item = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
|
5255
|
+
const Item = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-4ebe06df"]]);
|
|
4554
5256
|
const mountArticleDom = (props, del) => {
|
|
4555
5257
|
const className = "article-wrap";
|
|
4556
5258
|
const article = props.article;
|
|
@@ -4584,14 +5286,15 @@
|
|
|
4584
5286
|
name: "Edit",
|
|
4585
5287
|
components: {
|
|
4586
5288
|
ElInput: elementPlus.ElInput,
|
|
4587
|
-
InsertArticle: _sfc_main$
|
|
4588
|
-
ImgUpload: _sfc_main$
|
|
4589
|
-
VideoUpload: _sfc_main$
|
|
5289
|
+
InsertArticle: _sfc_main$6,
|
|
5290
|
+
ImgUpload: _sfc_main$5,
|
|
5291
|
+
VideoUpload: _sfc_main$4,
|
|
4590
5292
|
CollectArticle,
|
|
4591
5293
|
ElFormItem: elementPlus.ElFormItem,
|
|
4592
5294
|
ElForm: elementPlus.ElForm,
|
|
4593
5295
|
ElDialog: elementPlus.ElDialog,
|
|
4594
|
-
ElButton: elementPlus.ElButton
|
|
5296
|
+
ElButton: elementPlus.ElButton,
|
|
5297
|
+
TopicManager
|
|
4595
5298
|
},
|
|
4596
5299
|
props: [
|
|
4597
5300
|
"disabled",
|
|
@@ -4601,13 +5304,15 @@
|
|
|
4601
5304
|
"importEssay",
|
|
4602
5305
|
"uploadImageByOther",
|
|
4603
5306
|
"chartGallery",
|
|
4604
|
-
"request"
|
|
5307
|
+
"request",
|
|
5308
|
+
"placeholder"
|
|
4605
5309
|
],
|
|
4606
5310
|
data() {
|
|
4607
5311
|
return {
|
|
4608
5312
|
hasArticleCard: false,
|
|
4609
5313
|
cursorStyle: "auto",
|
|
4610
5314
|
titleCount: 0,
|
|
5315
|
+
// 标题数量
|
|
4611
5316
|
viewLinkDialog: false,
|
|
4612
5317
|
linkForm: {
|
|
4613
5318
|
linkAddress: "",
|
|
@@ -4615,39 +5320,54 @@
|
|
|
4615
5320
|
},
|
|
4616
5321
|
setAlignFlag: true,
|
|
4617
5322
|
article: {},
|
|
5323
|
+
// 插入的文章
|
|
4618
5324
|
imgList: [],
|
|
4619
5325
|
imgNum: 20,
|
|
4620
5326
|
videoList: [],
|
|
4621
5327
|
visibleVideo: false,
|
|
4622
5328
|
visibleCollectArticle: false,
|
|
4623
5329
|
visibleArticle: false,
|
|
5330
|
+
// 插入文章
|
|
4624
5331
|
visibleImg: false,
|
|
5332
|
+
// 插入图片
|
|
4625
5333
|
imgType: "normal",
|
|
5334
|
+
//
|
|
4626
5335
|
typeEnum: {
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
5336
|
+
文字: "1",
|
|
5337
|
+
图片: "2",
|
|
5338
|
+
图文: "3",
|
|
5339
|
+
段落标题: "4",
|
|
5340
|
+
关联: "5",
|
|
5341
|
+
// 关联车辆、轨迹、活动、商家、话题
|
|
5342
|
+
单视频: "6",
|
|
5343
|
+
视频文字: "7",
|
|
4634
5344
|
URL: "8",
|
|
4635
|
-
|
|
5345
|
+
文章卡片: "11"
|
|
4636
5346
|
},
|
|
4637
5347
|
fontInfo: {
|
|
4638
5348
|
size: ""
|
|
4639
5349
|
},
|
|
4640
5350
|
user: {},
|
|
5351
|
+
// 用户
|
|
4641
5352
|
editor: {},
|
|
5353
|
+
// 编辑器实例对象
|
|
4642
5354
|
editorDom: {},
|
|
5355
|
+
// 编辑器Dom
|
|
4643
5356
|
uploadStore: {},
|
|
5357
|
+
// 待上传的图片池
|
|
4644
5358
|
linkContent: "",
|
|
5359
|
+
// 插入链接的地址
|
|
4645
5360
|
loadingText: "",
|
|
5361
|
+
// loaing的提示文字
|
|
4646
5362
|
progressPercent: "",
|
|
5363
|
+
// 上传进度
|
|
4647
5364
|
currentIndex: 0,
|
|
4648
5365
|
loading: false,
|
|
5366
|
+
// 是否提交中
|
|
4649
5367
|
viewStatus: false,
|
|
5368
|
+
// todo: 改名
|
|
4650
5369
|
linkStatus: false,
|
|
5370
|
+
// todo: 改名
|
|
4651
5371
|
styleStatus: {
|
|
4652
5372
|
bold: false,
|
|
4653
5373
|
italic: false,
|
|
@@ -4671,6 +5391,7 @@
|
|
|
4671
5391
|
targetMove: "",
|
|
4672
5392
|
moverClasses: ["halo-img-content", "halo-video-content"],
|
|
4673
5393
|
selectDom: null
|
|
5394
|
+
//选中的dom
|
|
4674
5395
|
};
|
|
4675
5396
|
},
|
|
4676
5397
|
computed: {
|
|
@@ -4687,12 +5408,12 @@
|
|
|
4687
5408
|
watch: {
|
|
4688
5409
|
progressPercent(val) {
|
|
4689
5410
|
const inner = document.querySelector(".video-progress .inner");
|
|
4690
|
-
console.log(val, "
|
|
5411
|
+
console.log(val, "视频上传进度");
|
|
4691
5412
|
if (inner) {
|
|
4692
5413
|
inner.style.width = val + "%";
|
|
4693
5414
|
if (val === 100) {
|
|
4694
5415
|
document.querySelector(".video-progress").innerHTML = `
|
|
4695
|
-
<div class="no-calc" style="text-align:center;color:#999999;font-size:18px;"
|
|
5416
|
+
<div class="no-calc" style="text-align:center;color:#999999;font-size:18px;">正在获取视频封面</div>
|
|
4696
5417
|
`;
|
|
4697
5418
|
}
|
|
4698
5419
|
}
|
|
@@ -4711,7 +5432,7 @@
|
|
|
4711
5432
|
me2.user = JSON.parse(
|
|
4712
5433
|
window.localStorage.getItem("user") || window.localStorage.getItem("userInfo") || "{}"
|
|
4713
5434
|
);
|
|
4714
|
-
me2.guid = me2.user.uid + "|" +
|
|
5435
|
+
me2.guid = me2.user.uid + "|" + util.tools.guid();
|
|
4715
5436
|
},
|
|
4716
5437
|
beforeDestroy() {
|
|
4717
5438
|
this.editorDom && this.editorDom.removeEventListener("blur", this.canSetAlign);
|
|
@@ -4744,7 +5465,6 @@
|
|
|
4744
5465
|
},
|
|
4745
5466
|
setCursor() {
|
|
4746
5467
|
this.cursorStyle = this.cursorStyle === cursorImg ? "auto" : cursorImg;
|
|
4747
|
-
console.log(this.styleStatus, 999);
|
|
4748
5468
|
this.curStyle = { ...this.styleStatus };
|
|
4749
5469
|
this.editorDom.addEventListener("mouseup", this.handleCopyFormatUp);
|
|
4750
5470
|
},
|
|
@@ -4782,10 +5502,10 @@
|
|
|
4782
5502
|
this.visibleVideo = false;
|
|
4783
5503
|
const fileName = (files[0] && files[0].name || "").toLowerCase();
|
|
4784
5504
|
if (files[0].size > 1 * 1024 * 1024 * 1024) {
|
|
4785
|
-
return me2.setToast("
|
|
5505
|
+
return me2.setToast("视频大小不能超过1GB");
|
|
4786
5506
|
}
|
|
4787
5507
|
if (fileName.indexOf(".mp4") === -1 && fileName.indexOf(".mov") === -1) {
|
|
4788
|
-
return me2.setToast("
|
|
5508
|
+
return me2.setToast("视频格式不是mp4或mov");
|
|
4789
5509
|
}
|
|
4790
5510
|
const me2 = this;
|
|
4791
5511
|
if (me2.loading)
|
|
@@ -4805,7 +5525,9 @@
|
|
|
4805
5525
|
id: result.videoId,
|
|
4806
5526
|
desc: "",
|
|
4807
5527
|
vodSize: result.vodSize || "",
|
|
5528
|
+
// 视频大小
|
|
4808
5529
|
vodType: result.vodType || ""
|
|
5530
|
+
// 图片尺寸
|
|
4809
5531
|
};
|
|
4810
5532
|
me2.$emit("updateAddVideo", true);
|
|
4811
5533
|
me2.editor["insertVideo"](result.videoUrl, video);
|
|
@@ -4859,11 +5581,11 @@
|
|
|
4859
5581
|
},
|
|
4860
5582
|
insertLink() {
|
|
4861
5583
|
if (!this.linkForm.linkAddress)
|
|
4862
|
-
return elementPlus.ElMessage.error("
|
|
5584
|
+
return elementPlus.ElMessage.error("请输入链接地址");
|
|
4863
5585
|
if (!this.linkForm.linkWriting)
|
|
4864
|
-
return elementPlus.ElMessage.error("
|
|
5586
|
+
return elementPlus.ElMessage.error("请输入链接文案");
|
|
4865
5587
|
if (!this.validUrl(this.linkForm.linkAddress)) {
|
|
4866
|
-
return this.setToast("URL
|
|
5588
|
+
return this.setToast("URL无效");
|
|
4867
5589
|
}
|
|
4868
5590
|
this.editor.insertLink(
|
|
4869
5591
|
this.linkForm.linkAddress,
|
|
@@ -4892,6 +5614,10 @@
|
|
|
4892
5614
|
});
|
|
4893
5615
|
});
|
|
4894
5616
|
},
|
|
5617
|
+
// TopicManager事件处理
|
|
5618
|
+
onTopicInserted(topic) {
|
|
5619
|
+
this.updateData(true);
|
|
5620
|
+
},
|
|
4895
5621
|
getHtml(type) {
|
|
4896
5622
|
this.updateTopicPosition();
|
|
4897
5623
|
const html = this.editor.getHTML();
|
|
@@ -4987,12 +5713,14 @@
|
|
|
4987
5713
|
this.initData();
|
|
4988
5714
|
},
|
|
4989
5715
|
async parseHtml(html, essayPicRelVOList) {
|
|
4990
|
-
var _a, _b;
|
|
5716
|
+
var _a, _b, _c, _d;
|
|
4991
5717
|
const div = document.createElement("div");
|
|
4992
5718
|
div.innerHTML = html;
|
|
4993
5719
|
const frag = document.createDocumentFragment();
|
|
4994
5720
|
frag.appendChild(this.editor.empty(div));
|
|
4995
5721
|
const nodes = [...frag.childNodes];
|
|
5722
|
+
const mddTopics = frag.querySelectorAll("mdd-topic");
|
|
5723
|
+
mddTopics.forEach((topic) => topic.setAttribute("contenteditable", "false"));
|
|
4996
5724
|
for (let i = 0; i < nodes.length; i++) {
|
|
4997
5725
|
const node = nodes[i];
|
|
4998
5726
|
if (node.nodeType === 1) {
|
|
@@ -5000,8 +5728,8 @@
|
|
|
5000
5728
|
await this.parseArticle(node);
|
|
5001
5729
|
} else if (node.tagName.toLowerCase() === "halo-good") {
|
|
5002
5730
|
this.parseGood(node);
|
|
5003
|
-
} else if (node.classList.contains("halo-img-content")) {
|
|
5004
|
-
const img = node.querySelector("img");
|
|
5731
|
+
} else if (node.classList.contains("halo-img-content") || node.classList.contains("halo-modify-content")) {
|
|
5732
|
+
const img = node.querySelector("img") || node.querySelector("modify");
|
|
5005
5733
|
node.setAttribute("tabindex", -1);
|
|
5006
5734
|
node.setAttribute("draggable", true);
|
|
5007
5735
|
node.setAttribute("contenteditable", false);
|
|
@@ -5010,12 +5738,14 @@
|
|
|
5010
5738
|
const desc = img.dataset.desc;
|
|
5011
5739
|
img.style.margin = "0";
|
|
5012
5740
|
const seamlessFlag = ((_a = JSON.parse(img.getAttribute("data"))) == null ? void 0 : _a.seamlessFlag) || "0";
|
|
5741
|
+
const paintCopyable = ((_b = JSON.parse(img.getAttribute("data"))) == null ? void 0 : _b.paintCopyable) || "0";
|
|
5742
|
+
const id = ((_c = JSON.parse(img.getAttribute("data"))) == null ? void 0 : _c.id) || "";
|
|
5013
5743
|
if (essayPicRelVOList) {
|
|
5014
5744
|
const arr = img.src.split("/");
|
|
5015
|
-
const
|
|
5016
|
-
let url = (
|
|
5017
|
-
(obj) => obj.id === String(
|
|
5018
|
-
)) == null ? void 0 :
|
|
5745
|
+
const id2 = arr[arr.length - 1];
|
|
5746
|
+
let url = (_d = essayPicRelVOList.find(
|
|
5747
|
+
(obj) => obj.id === String(id2)
|
|
5748
|
+
)) == null ? void 0 : _d.url;
|
|
5019
5749
|
if (url) {
|
|
5020
5750
|
img.src = url;
|
|
5021
5751
|
}
|
|
@@ -5024,7 +5754,9 @@
|
|
|
5024
5754
|
this.editor,
|
|
5025
5755
|
{
|
|
5026
5756
|
content: desc,
|
|
5027
|
-
seamlessFlag
|
|
5757
|
+
seamlessFlag,
|
|
5758
|
+
paintCopyable,
|
|
5759
|
+
id
|
|
5028
5760
|
},
|
|
5029
5761
|
nodes.length === i
|
|
5030
5762
|
).forEach((child) => {
|
|
@@ -5082,6 +5814,8 @@
|
|
|
5082
5814
|
},
|
|
5083
5815
|
async parseArticle(node) {
|
|
5084
5816
|
const data = JSON.parse(node.dataset.article);
|
|
5817
|
+
if (!this.getEassyDetail)
|
|
5818
|
+
return;
|
|
5085
5819
|
await this.getEassyDetail(data.id, (info) => {
|
|
5086
5820
|
const el = mountArticleDom(
|
|
5087
5821
|
{
|
|
@@ -5338,7 +6072,7 @@
|
|
|
5338
6072
|
}
|
|
5339
6073
|
this.updateData(true);
|
|
5340
6074
|
} else {
|
|
5341
|
-
this.setToast(rst.origin.name + "
|
|
6075
|
+
this.setToast(rst.origin.name + "上传失败,请重试");
|
|
5342
6076
|
}
|
|
5343
6077
|
},
|
|
5344
6078
|
insertVideoBtns(editor, node) {
|
|
@@ -5353,7 +6087,7 @@
|
|
|
5353
6087
|
me2.currentVideo = node;
|
|
5354
6088
|
e.stopPropagation();
|
|
5355
6089
|
};
|
|
5356
|
-
replaceBtn.innerText = "
|
|
6090
|
+
replaceBtn.innerText = "更换封面";
|
|
5357
6091
|
return replaceBtn;
|
|
5358
6092
|
},
|
|
5359
6093
|
insertImgOperateBtns(editor, data) {
|
|
@@ -5374,13 +6108,12 @@
|
|
|
5374
6108
|
}
|
|
5375
6109
|
});
|
|
5376
6110
|
var descInputWrap;
|
|
5377
|
-
console.log(data.seamlessFlag, "count<<<<<<");
|
|
5378
6111
|
var descInput = editor.createElement("textarea", {
|
|
5379
6112
|
class: "desc-input",
|
|
5380
6113
|
maxlength: "50",
|
|
5381
6114
|
rows: "2",
|
|
5382
6115
|
cols: "50",
|
|
5383
|
-
placeholder: "
|
|
6116
|
+
placeholder: "请输入图片描述(最多50字)",
|
|
5384
6117
|
contenteditable: "false"
|
|
5385
6118
|
});
|
|
5386
6119
|
descInput.disabled = me2.disabled;
|
|
@@ -5389,7 +6122,7 @@
|
|
|
5389
6122
|
const img = parent.querySelector(".halo-picture-area");
|
|
5390
6123
|
img.dataset.desc = e.target.value;
|
|
5391
6124
|
if (e.target.value.length > 49) {
|
|
5392
|
-
return me2.setToast("
|
|
6125
|
+
return me2.setToast("限制50个字符");
|
|
5393
6126
|
}
|
|
5394
6127
|
};
|
|
5395
6128
|
descInput.value = data.content || "";
|
|
@@ -5439,7 +6172,7 @@
|
|
|
5439
6172
|
me2.removeParentByClass(e.target, "halo-img-content");
|
|
5440
6173
|
me2.updateData(true);
|
|
5441
6174
|
};
|
|
5442
|
-
replaceBtn.innerHTML = "
|
|
6175
|
+
replaceBtn.innerHTML = "替换";
|
|
5443
6176
|
return [replaceBtn, delBtn, descInputWrap];
|
|
5444
6177
|
},
|
|
5445
6178
|
removeSeamlessLaster(e) {
|
|
@@ -5463,6 +6196,7 @@
|
|
|
5463
6196
|
}
|
|
5464
6197
|
}
|
|
5465
6198
|
},
|
|
6199
|
+
// 初始化编辑器数据,数据是 html 格式(displayData)
|
|
5466
6200
|
initData(data = "", essayPicRelVOList) {
|
|
5467
6201
|
this.parseHtml(data, essayPicRelVOList).then((res) => {
|
|
5468
6202
|
this.editorDom.innerHTML = "";
|
|
@@ -5470,6 +6204,13 @@
|
|
|
5470
6204
|
this.updateData();
|
|
5471
6205
|
});
|
|
5472
6206
|
},
|
|
6207
|
+
// TODO jsonToHtml、htmlToJson 实现这 2 个方法里面的逻辑,数据结构参考方法里面的注释,出参入参都为字符串,注意:mdd-topic 里面的属性数据 和 json 中的topicPosition数据是一一对应的,startIndex、endIndex为mdd-topic的起止位置 从 content 里面进行分割处理
|
|
6208
|
+
// json、html 数据格式互转,暂时只支持文字、短话题
|
|
6209
|
+
jsonToHtml(json) {
|
|
6210
|
+
},
|
|
6211
|
+
htmlToJson(html) {
|
|
6212
|
+
},
|
|
6213
|
+
// 设置富文本组件
|
|
5473
6214
|
initSquire() {
|
|
5474
6215
|
const me2 = this;
|
|
5475
6216
|
const editorDom = me2.editorDom;
|
|
@@ -5557,7 +6298,8 @@
|
|
|
5557
6298
|
event.preventDefault();
|
|
5558
6299
|
});
|
|
5559
6300
|
me2.editor.addEventListener("keydown", function(event) {
|
|
5560
|
-
|
|
6301
|
+
var _a, _b, _c;
|
|
6302
|
+
if (["Backspace", "Delete"].includes(event.key)) {
|
|
5561
6303
|
try {
|
|
5562
6304
|
const selection2 = getSelection();
|
|
5563
6305
|
if (me2.selectDom && me2.moverClasses.includes(me2.selectDom.className)) {
|
|
@@ -5591,32 +6333,10 @@
|
|
|
5591
6333
|
} catch (error) {
|
|
5592
6334
|
console.log(error);
|
|
5593
6335
|
}
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
const startContainer = range.startContainer;
|
|
5599
|
-
let isInMddTopic = false;
|
|
5600
|
-
if (startContainer.nodeType === Node.ELEMENT_NODE && startContainer.tagName === "MDD-TOPIC") {
|
|
5601
|
-
isInMddTopic = true;
|
|
5602
|
-
} else if (startContainer.nodeType === Node.TEXT_NODE) {
|
|
5603
|
-
const parent = startContainer.parentNode;
|
|
5604
|
-
if (parent.tagName === "MDD-TOPIC") {
|
|
5605
|
-
isInMddTopic = true;
|
|
5606
|
-
}
|
|
5607
|
-
}
|
|
5608
|
-
if (isInMddTopic) {
|
|
5609
|
-
if (event.key === "Enter") {
|
|
5610
|
-
event.preventDefault();
|
|
5611
|
-
return;
|
|
5612
|
-
}
|
|
5613
|
-
const isPrintableKey = event.key.length === 1;
|
|
5614
|
-
if (isPrintableKey) {
|
|
5615
|
-
event.preventDefault();
|
|
5616
|
-
return;
|
|
5617
|
-
}
|
|
5618
|
-
}
|
|
5619
|
-
if ((event.key === "Backspace" || event.key === "Delete") && isInMddTopic) {
|
|
6336
|
+
const selection = window.getSelection();
|
|
6337
|
+
if (selection.rangeCount > 0) {
|
|
6338
|
+
const range = selection.getRangeAt(0);
|
|
6339
|
+
const startContainer = range.startContainer;
|
|
5620
6340
|
if (startContainer.nodeType === Node.ELEMENT_NODE && startContainer.tagName === "MDD-TOPIC") {
|
|
5621
6341
|
startContainer.remove();
|
|
5622
6342
|
event.preventDefault();
|
|
@@ -5629,6 +6349,228 @@
|
|
|
5629
6349
|
return;
|
|
5630
6350
|
}
|
|
5631
6351
|
}
|
|
6352
|
+
let currentParagraph = startContainer;
|
|
6353
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6354
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6355
|
+
}
|
|
6356
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
6357
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6358
|
+
}
|
|
6359
|
+
if (currentParagraph && event.key === "Backspace") {
|
|
6360
|
+
const container = range.startContainer;
|
|
6361
|
+
const offset = range.startOffset;
|
|
6362
|
+
let isAtParagraphStart = false;
|
|
6363
|
+
let cursorBeforeContent = null;
|
|
6364
|
+
if (container === currentParagraph && offset === 0) {
|
|
6365
|
+
isAtParagraphStart = true;
|
|
6366
|
+
cursorBeforeContent = currentParagraph.firstChild;
|
|
6367
|
+
} else if (container.nodeType === Node.TEXT_NODE && offset === 0) {
|
|
6368
|
+
let isFirstContent = true;
|
|
6369
|
+
let currentNode = currentParagraph.firstChild;
|
|
6370
|
+
while (currentNode && currentNode !== container) {
|
|
6371
|
+
if (currentNode.nodeType === Node.TEXT_NODE && currentNode.textContent.trim() !== "") {
|
|
6372
|
+
isFirstContent = false;
|
|
6373
|
+
break;
|
|
6374
|
+
} else if (currentNode.nodeType === Node.ELEMENT_NODE) {
|
|
6375
|
+
isFirstContent = false;
|
|
6376
|
+
break;
|
|
6377
|
+
}
|
|
6378
|
+
currentNode = currentNode.nextSibling;
|
|
6379
|
+
}
|
|
6380
|
+
if (isFirstContent) {
|
|
6381
|
+
isAtParagraphStart = true;
|
|
6382
|
+
cursorBeforeContent = container;
|
|
6383
|
+
}
|
|
6384
|
+
} else if (container === currentParagraph && offset > 0) {
|
|
6385
|
+
let hasContentBefore = false;
|
|
6386
|
+
for (let i = 0; i < offset; i++) {
|
|
6387
|
+
const node = currentParagraph.childNodes[i];
|
|
6388
|
+
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== "") {
|
|
6389
|
+
hasContentBefore = true;
|
|
6390
|
+
break;
|
|
6391
|
+
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
6392
|
+
hasContentBefore = true;
|
|
6393
|
+
break;
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
if (!hasContentBefore && offset < currentParagraph.childNodes.length) {
|
|
6397
|
+
isAtParagraphStart = true;
|
|
6398
|
+
cursorBeforeContent = currentParagraph.childNodes[offset];
|
|
6399
|
+
}
|
|
6400
|
+
}
|
|
6401
|
+
if (isAtParagraphStart) {
|
|
6402
|
+
const prevParagraph = currentParagraph.previousElementSibling;
|
|
6403
|
+
if (prevParagraph && prevParagraph.classList.contains("halo-paragraph")) {
|
|
6404
|
+
const prevContent = prevParagraph.innerHTML.trim();
|
|
6405
|
+
if (prevContent === "<br>" || prevContent === "") {
|
|
6406
|
+
prevParagraph.remove();
|
|
6407
|
+
event.preventDefault();
|
|
6408
|
+
me2.updateData(true);
|
|
6409
|
+
return;
|
|
6410
|
+
} else {
|
|
6411
|
+
const mergePoint = prevParagraph.childNodes.length;
|
|
6412
|
+
if (prevParagraph.lastChild && prevParagraph.lastChild.tagName === "BR") {
|
|
6413
|
+
prevParagraph.removeChild(prevParagraph.lastChild);
|
|
6414
|
+
}
|
|
6415
|
+
const nodesToMove = Array.from(currentParagraph.childNodes);
|
|
6416
|
+
nodesToMove.forEach((node) => {
|
|
6417
|
+
prevParagraph.appendChild(node);
|
|
6418
|
+
});
|
|
6419
|
+
currentParagraph.remove();
|
|
6420
|
+
const newRange = document.createRange();
|
|
6421
|
+
if (cursorBeforeContent && prevParagraph.contains(cursorBeforeContent)) {
|
|
6422
|
+
newRange.setStartBefore(cursorBeforeContent);
|
|
6423
|
+
} else {
|
|
6424
|
+
if (mergePoint < prevParagraph.childNodes.length) {
|
|
6425
|
+
newRange.setStartBefore(prevParagraph.childNodes[mergePoint]);
|
|
6426
|
+
} else {
|
|
6427
|
+
newRange.setStart(prevParagraph, prevParagraph.childNodes.length);
|
|
6428
|
+
}
|
|
6429
|
+
}
|
|
6430
|
+
newRange.collapse(true);
|
|
6431
|
+
const selection2 = window.getSelection();
|
|
6432
|
+
selection2.removeAllRanges();
|
|
6433
|
+
selection2.addRange(newRange);
|
|
6434
|
+
event.preventDefault();
|
|
6435
|
+
me2.updateData(true);
|
|
6436
|
+
return;
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
}
|
|
6442
|
+
}
|
|
6443
|
+
if (event.key === "Enter") {
|
|
6444
|
+
const selection = window.getSelection();
|
|
6445
|
+
if (selection.rangeCount > 0) {
|
|
6446
|
+
const range = selection.getRangeAt(0);
|
|
6447
|
+
const startContainer = range.startContainer;
|
|
6448
|
+
let currentParagraph = startContainer;
|
|
6449
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6450
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6451
|
+
}
|
|
6452
|
+
while (currentParagraph && !((_b = currentParagraph.classList) == null ? void 0 : _b.contains("halo-paragraph"))) {
|
|
6453
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6454
|
+
}
|
|
6455
|
+
if (!(currentParagraph == null ? void 0 : currentParagraph.querySelector("mdd-topic"))) {
|
|
6456
|
+
return;
|
|
6457
|
+
}
|
|
6458
|
+
if (me2.isBetweenTwoTopics(range)) {
|
|
6459
|
+
event.preventDefault();
|
|
6460
|
+
me2.handleEnterBetweenTopics(range);
|
|
6461
|
+
return;
|
|
6462
|
+
}
|
|
6463
|
+
if (me2.wouldCreateNestedParagraph(range)) {
|
|
6464
|
+
event.preventDefault();
|
|
6465
|
+
me2.handleEnterKeyInParagraphWithTopic(range);
|
|
6466
|
+
return;
|
|
6467
|
+
}
|
|
6468
|
+
if (currentParagraph && currentParagraph.querySelector("mdd-topic")) {
|
|
6469
|
+
event.preventDefault();
|
|
6470
|
+
me2.handleEnterKeyInParagraphWithTopic(range);
|
|
6471
|
+
return;
|
|
6472
|
+
}
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "ArrowLeft") {
|
|
6476
|
+
const selection = window.getSelection();
|
|
6477
|
+
if (selection.rangeCount > 0) {
|
|
6478
|
+
const range = selection.getRangeAt(0);
|
|
6479
|
+
const container = range.startContainer;
|
|
6480
|
+
let currentParagraph = container;
|
|
6481
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6482
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6483
|
+
}
|
|
6484
|
+
while (currentParagraph && !((_c = currentParagraph.classList) == null ? void 0 : _c.contains("halo-paragraph"))) {
|
|
6485
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6486
|
+
}
|
|
6487
|
+
if (currentParagraph) {
|
|
6488
|
+
const firstTopic = currentParagraph.querySelector("mdd-topic");
|
|
6489
|
+
if (firstTopic) {
|
|
6490
|
+
let hasTextBeforeTopic = false;
|
|
6491
|
+
let currentNode = currentParagraph.firstChild;
|
|
6492
|
+
while (currentNode && currentNode !== firstTopic) {
|
|
6493
|
+
if (currentNode.nodeType === Node.TEXT_NODE && currentNode.textContent.trim() !== "") {
|
|
6494
|
+
hasTextBeforeTopic = true;
|
|
6495
|
+
break;
|
|
6496
|
+
}
|
|
6497
|
+
currentNode = currentNode.nextSibling;
|
|
6498
|
+
}
|
|
6499
|
+
if (hasTextBeforeTopic) {
|
|
6500
|
+
if (container === currentParagraph && range.startOffset === 0) {
|
|
6501
|
+
return;
|
|
6502
|
+
}
|
|
6503
|
+
let shouldMoveToStart = false;
|
|
6504
|
+
const offset2 = range.startOffset;
|
|
6505
|
+
if (container.nodeType === Node.TEXT_NODE && container.parentNode === firstTopic) {
|
|
6506
|
+
shouldMoveToStart = true;
|
|
6507
|
+
} else if (container === firstTopic) {
|
|
6508
|
+
shouldMoveToStart = true;
|
|
6509
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
6510
|
+
let prevSibling = container.previousSibling;
|
|
6511
|
+
while (prevSibling) {
|
|
6512
|
+
if (prevSibling === firstTopic) {
|
|
6513
|
+
shouldMoveToStart = true;
|
|
6514
|
+
break;
|
|
6515
|
+
}
|
|
6516
|
+
prevSibling = prevSibling.previousSibling;
|
|
6517
|
+
}
|
|
6518
|
+
} else if (container === currentParagraph) {
|
|
6519
|
+
const topicRange = document.createRange();
|
|
6520
|
+
topicRange.selectNode(firstTopic);
|
|
6521
|
+
const cursorRange = document.createRange();
|
|
6522
|
+
cursorRange.setStart(container, offset2);
|
|
6523
|
+
cursorRange.collapse(true);
|
|
6524
|
+
if (cursorRange.compareBoundaryPoints(Range.START_TO_END, topicRange) > 0) {
|
|
6525
|
+
shouldMoveToStart = true;
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
if (shouldMoveToStart) {
|
|
6529
|
+
event.preventDefault();
|
|
6530
|
+
event.stopPropagation();
|
|
6531
|
+
const newRange = document.createRange();
|
|
6532
|
+
newRange.setStart(currentParagraph, 0);
|
|
6533
|
+
newRange.collapse(true);
|
|
6534
|
+
const selection2 = window.getSelection();
|
|
6535
|
+
selection2.removeAllRanges();
|
|
6536
|
+
selection2.addRange(newRange);
|
|
6537
|
+
return false;
|
|
6538
|
+
}
|
|
6539
|
+
return;
|
|
6540
|
+
}
|
|
6541
|
+
let shouldMoveToTopicStart = false;
|
|
6542
|
+
const offset = range.startOffset;
|
|
6543
|
+
if (container.nodeType === Node.TEXT_NODE && container.parentNode === firstTopic) {
|
|
6544
|
+
shouldMoveToTopicStart = true;
|
|
6545
|
+
} else if (container === firstTopic) {
|
|
6546
|
+
shouldMoveToTopicStart = true;
|
|
6547
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
6548
|
+
let prevSibling = container.previousSibling;
|
|
6549
|
+
while (prevSibling) {
|
|
6550
|
+
if (prevSibling === firstTopic) {
|
|
6551
|
+
shouldMoveToTopicStart = true;
|
|
6552
|
+
break;
|
|
6553
|
+
}
|
|
6554
|
+
prevSibling = prevSibling.previousSibling;
|
|
6555
|
+
}
|
|
6556
|
+
} else if (container === currentParagraph) {
|
|
6557
|
+
const topicRange = document.createRange();
|
|
6558
|
+
topicRange.selectNode(firstTopic);
|
|
6559
|
+
const cursorRange = document.createRange();
|
|
6560
|
+
cursorRange.setStart(container, offset);
|
|
6561
|
+
cursorRange.collapse(true);
|
|
6562
|
+
if (cursorRange.compareBoundaryPoints(Range.START_TO_END, topicRange) > 0) {
|
|
6563
|
+
shouldMoveToTopicStart = true;
|
|
6564
|
+
}
|
|
6565
|
+
}
|
|
6566
|
+
if (shouldMoveToTopicStart) {
|
|
6567
|
+
event.preventDefault();
|
|
6568
|
+
event.stopPropagation();
|
|
6569
|
+
me2.setCursorBeforeElement(firstTopic);
|
|
6570
|
+
return false;
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
}
|
|
5632
6574
|
}
|
|
5633
6575
|
}
|
|
5634
6576
|
});
|
|
@@ -5691,7 +6633,6 @@
|
|
|
5691
6633
|
this.insertElement(p);
|
|
5692
6634
|
};
|
|
5693
6635
|
window.Squire.prototype.makeHeader = function(content, config = { makeHeader: {} }) {
|
|
5694
|
-
console.log(content);
|
|
5695
6636
|
if (content) {
|
|
5696
6637
|
const h2 = this.createElement("h2", {
|
|
5697
6638
|
class: "halo-paragraph-title"
|
|
@@ -5717,6 +6658,7 @@
|
|
|
5717
6658
|
window.Squire.empty(block)
|
|
5718
6659
|
]);
|
|
5719
6660
|
output.appendChild(
|
|
6661
|
+
// 段落才能添加标题
|
|
5720
6662
|
Array.from(block.classList).indexOf("halo-img-content") > -1 ? block : container
|
|
5721
6663
|
);
|
|
5722
6664
|
}
|
|
@@ -5724,7 +6666,6 @@
|
|
|
5724
6666
|
});
|
|
5725
6667
|
const selection = window.getSelection();
|
|
5726
6668
|
const range = document.createRange();
|
|
5727
|
-
console.log(container);
|
|
5728
6669
|
range.setStart(container, 1);
|
|
5729
6670
|
range.collapse(true);
|
|
5730
6671
|
selection.removeAllRanges();
|
|
@@ -5740,18 +6681,18 @@
|
|
|
5740
6681
|
});
|
|
5741
6682
|
loading.innerHTML = `
|
|
5742
6683
|
<img class="img-loading-icon" src="/img/upload-image-loading.png"/>
|
|
5743
|
-
<span class="img-loading-tip"
|
|
6684
|
+
<span class="img-loading-tip">上传中...</span>
|
|
5744
6685
|
`;
|
|
5745
6686
|
var fail = this.createElement("div", {
|
|
5746
6687
|
class: "img-fail hide",
|
|
5747
6688
|
contenteditable: "false"
|
|
5748
6689
|
});
|
|
5749
|
-
fail.innerHTML = "
|
|
6690
|
+
fail.innerHTML = "上传失败<br>请下载图片至本地后重新上传";
|
|
5750
6691
|
var again = this.createElement("button", {
|
|
5751
6692
|
class: "img-again hide",
|
|
5752
6693
|
contenteditable: "false"
|
|
5753
6694
|
});
|
|
5754
|
-
again.innerHTML = "
|
|
6695
|
+
again.innerHTML = "重新上传";
|
|
5755
6696
|
const isGif = src && src.indexOf(".gif") > -1;
|
|
5756
6697
|
if (isGif) {
|
|
5757
6698
|
src = src.replace(".gif", ".gif!nowater");
|
|
@@ -5806,7 +6747,7 @@
|
|
|
5806
6747
|
});
|
|
5807
6748
|
div.innerHTML = `
|
|
5808
6749
|
<div class="video-progress">
|
|
5809
|
-
<div class="label"
|
|
6750
|
+
<div class="label">上传中...</div>
|
|
5810
6751
|
<div class="box">
|
|
5811
6752
|
<div class="inner" style="width:20%"></div>
|
|
5812
6753
|
</div>
|
|
@@ -5829,6 +6770,7 @@
|
|
|
5829
6770
|
data: JSON.stringify(data),
|
|
5830
6771
|
"data-content": data.content || "",
|
|
5831
6772
|
poster: data.img || ""
|
|
6773
|
+
// 'contenteditable': 'true',
|
|
5832
6774
|
});
|
|
5833
6775
|
var delBtn = me2.genIconDom({
|
|
5834
6776
|
class: "pointer video-delete icon",
|
|
@@ -5838,7 +6780,6 @@
|
|
|
5838
6780
|
e.stopPropagation();
|
|
5839
6781
|
}
|
|
5840
6782
|
});
|
|
5841
|
-
console.log(delBtn);
|
|
5842
6783
|
const posterBtn = me2.insertVideoBtns(this, video);
|
|
5843
6784
|
var p = this.createElement(
|
|
5844
6785
|
"DIV",
|
|
@@ -5887,6 +6828,7 @@
|
|
|
5887
6828
|
}
|
|
5888
6829
|
};
|
|
5889
6830
|
},
|
|
6831
|
+
// 撤销重做 会把 所有的监听全都移除,所以需要重新绑定
|
|
5890
6832
|
setListener(dom) {
|
|
5891
6833
|
const me2 = this;
|
|
5892
6834
|
const doms = dom ? [dom] : Array.from(this.editorDom.children);
|
|
@@ -5897,7 +6839,7 @@
|
|
|
5897
6839
|
p.onclick = function(e) {
|
|
5898
6840
|
var _a;
|
|
5899
6841
|
if (area.nodeName === "VIDEO" && ((_a = me2.selectDom) == null ? void 0 : _a.className) === "halo-video-content") {
|
|
5900
|
-
me2.setToast("
|
|
6842
|
+
me2.setToast("不支持播放");
|
|
5901
6843
|
}
|
|
5902
6844
|
if (e.target.className.includes("desc-input")) {
|
|
5903
6845
|
return;
|
|
@@ -5961,6 +6903,7 @@
|
|
|
5961
6903
|
};
|
|
5962
6904
|
return del;
|
|
5963
6905
|
},
|
|
6906
|
+
// 转换数据,返回给业务
|
|
5964
6907
|
getEditorData() {
|
|
5965
6908
|
const me2 = this;
|
|
5966
6909
|
const children = Array.from(me2.editorDom.children);
|
|
@@ -6018,9 +6961,11 @@
|
|
|
6018
6961
|
videoIds
|
|
6019
6962
|
};
|
|
6020
6963
|
},
|
|
6964
|
+
// 是否是摩托范的图片
|
|
6021
6965
|
isHaloImage(url = "") {
|
|
6022
6966
|
return url.indexOf("jddmoto") > -1 || url.indexOf("58moto") > -1 || url.indexOf("emotofine") > -1;
|
|
6023
6967
|
},
|
|
6968
|
+
// 获取待上传图片列表
|
|
6024
6969
|
updateUploads() {
|
|
6025
6970
|
const me2 = this;
|
|
6026
6971
|
setTimeout(() => {
|
|
@@ -6067,8 +7012,8 @@
|
|
|
6067
7012
|
const currentImg = me2.uploadStore[key];
|
|
6068
7013
|
const imageUrl = key.split("|")[1] || "";
|
|
6069
7014
|
if (!currentImg) {
|
|
6070
|
-
console.log("
|
|
6071
|
-
return Promise.reject("
|
|
7015
|
+
console.log("图片不存在", key);
|
|
7016
|
+
return Promise.reject("图片不存在");
|
|
6072
7017
|
}
|
|
6073
7018
|
const parent = currentImg.parentNode || "";
|
|
6074
7019
|
const uploadFailHandler = (currentImg2) => {
|
|
@@ -6112,6 +7057,7 @@
|
|
|
6112
7057
|
parent && uploadFailHandler(currentImg);
|
|
6113
7058
|
});
|
|
6114
7059
|
},
|
|
7060
|
+
// 更新上传的图片
|
|
6115
7061
|
updateImage(img, currentImg = {}) {
|
|
6116
7062
|
const data = JSON.parse(currentImg.getAttribute("data") || "{}");
|
|
6117
7063
|
data.img = img;
|
|
@@ -6134,6 +7080,7 @@
|
|
|
6134
7080
|
parent.appendChild(arr[2]);
|
|
6135
7081
|
}
|
|
6136
7082
|
},
|
|
7083
|
+
// 获取ctrl + v 后内容
|
|
6137
7084
|
getSticker(type, handler) {
|
|
6138
7085
|
this.setSticker(type.fragment.children);
|
|
6139
7086
|
},
|
|
@@ -6151,6 +7098,7 @@
|
|
|
6151
7098
|
});
|
|
6152
7099
|
this.updateData(true);
|
|
6153
7100
|
},
|
|
7101
|
+
// 粘贴
|
|
6154
7102
|
setSticker(data) {
|
|
6155
7103
|
const me2 = this;
|
|
6156
7104
|
data = Array.from(data);
|
|
@@ -6189,6 +7137,7 @@
|
|
|
6189
7137
|
const me2 = this;
|
|
6190
7138
|
me2.updateData();
|
|
6191
7139
|
},
|
|
7140
|
+
// 监测 添加、撤回、恢复、删除
|
|
6192
7141
|
setBack(e, type) {
|
|
6193
7142
|
const me2 = this;
|
|
6194
7143
|
me2.refreshImg();
|
|
@@ -6221,6 +7170,7 @@
|
|
|
6221
7170
|
}
|
|
6222
7171
|
});
|
|
6223
7172
|
},
|
|
7173
|
+
// 设置scoll
|
|
6224
7174
|
sticky() {
|
|
6225
7175
|
const me2 = this;
|
|
6226
7176
|
me2.$nextTick(function() {
|
|
@@ -6240,6 +7190,8 @@
|
|
|
6240
7190
|
document.addEventListener("scroll", onScroll);
|
|
6241
7191
|
});
|
|
6242
7192
|
},
|
|
7193
|
+
// ==========toolbox==========
|
|
7194
|
+
// 撤回、恢复、段落标题
|
|
6243
7195
|
setContent(e, obj) {
|
|
6244
7196
|
const me2 = this;
|
|
6245
7197
|
const id = e.target.id || e.target.dataset.editorId;
|
|
@@ -6281,10 +7233,11 @@
|
|
|
6281
7233
|
this.fontInfo = this.editor.getFontInfo();
|
|
6282
7234
|
this.updateData(true);
|
|
6283
7235
|
},
|
|
7236
|
+
// 增加link
|
|
6284
7237
|
addLink(type) {
|
|
6285
7238
|
const me2 = this;
|
|
6286
|
-
me2.linkTitleName = type === "link" ? "
|
|
6287
|
-
me2.linkPlaceholder = type === "link" ? "
|
|
7239
|
+
me2.linkTitleName = type === "link" ? "添加链接" : "添加导入链接地址";
|
|
7240
|
+
me2.linkPlaceholder = type === "link" ? "请输入链接地址" : "仅支持输入微信链接";
|
|
6288
7241
|
me2.viewStatus = true;
|
|
6289
7242
|
me2.linkStatus = true;
|
|
6290
7243
|
},
|
|
@@ -6292,29 +7245,31 @@
|
|
|
6292
7245
|
const objExp = /^(((ht|f)tp(s?)):\/\/)?(www.|[a-zA-Z].)[a-zA-Z0-9-.]+.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk|cn|im)(:[0-9]+)*(\/($|[a-zA-Z0-9.,;?'&%$#=~_-]+))*$/;
|
|
6293
7246
|
return objExp.test(url);
|
|
6294
7247
|
},
|
|
7248
|
+
// 确认增加link
|
|
6295
7249
|
confirmLink() {
|
|
6296
7250
|
const me2 = this;
|
|
6297
7251
|
if (!me2.linkContent) {
|
|
6298
|
-
return elementPlus.ElMessage.error("
|
|
7252
|
+
return elementPlus.ElMessage.error("请输入链接地址!");
|
|
6299
7253
|
}
|
|
6300
|
-
if (me2.linkTitleName === "
|
|
7254
|
+
if (me2.linkTitleName === "添加导入链接地址" || this.visibleCollectArticle) {
|
|
6301
7255
|
this.visibleCollectArticle = false;
|
|
6302
7256
|
return me2.importLinkData();
|
|
6303
7257
|
}
|
|
6304
7258
|
if (!this.validUrl(me2.linkContent)) {
|
|
6305
|
-
return me2.setToast("URL
|
|
7259
|
+
return me2.setToast("URL无效");
|
|
6306
7260
|
}
|
|
6307
7261
|
if (!me2.isHaloImage(me2.linkContent)) {
|
|
6308
|
-
return me2.setToast("
|
|
7262
|
+
return me2.setToast("请输入摩托范内部网址");
|
|
6309
7263
|
}
|
|
6310
7264
|
me2.editor["insertLink"](me2.linkContent);
|
|
6311
7265
|
me2.linkContent = "";
|
|
6312
7266
|
me2.closeDialog();
|
|
6313
7267
|
},
|
|
7268
|
+
// 增加link导入数据
|
|
6314
7269
|
importLinkData() {
|
|
6315
7270
|
const me2 = this;
|
|
6316
7271
|
if (me2.loading) {
|
|
6317
|
-
return elementPlus.ElMessage("
|
|
7272
|
+
return elementPlus.ElMessage("正在获取信息,请稍后...");
|
|
6318
7273
|
}
|
|
6319
7274
|
me2.loading = true;
|
|
6320
7275
|
const params = {
|
|
@@ -6336,38 +7291,444 @@
|
|
|
6336
7291
|
me2.linkContent = "";
|
|
6337
7292
|
return;
|
|
6338
7293
|
} else {
|
|
6339
|
-
me2.setToast("
|
|
7294
|
+
me2.setToast("导入失败,请重试");
|
|
6340
7295
|
}
|
|
6341
7296
|
}).catch((err) => {
|
|
6342
7297
|
console.log(err.message);
|
|
6343
|
-
me2.setToast("
|
|
7298
|
+
me2.setToast("导入异常,请重试");
|
|
6344
7299
|
}).finally((_) => {
|
|
6345
7300
|
me2.loading = false;
|
|
6346
7301
|
});
|
|
6347
7302
|
},
|
|
7303
|
+
// 打开 图片、视频、一键导入 弹框
|
|
6348
7304
|
openDialog(name) {
|
|
6349
7305
|
const me2 = this;
|
|
6350
|
-
me2.viewName = name === "img" ? "
|
|
6351
|
-
me2.viewButton = name === "img" ? "
|
|
6352
|
-
me2.viewTip = name === "img" ? "" : "
|
|
7306
|
+
me2.viewName = name === "img" ? "添加图片" : "添加视频";
|
|
7307
|
+
me2.viewButton = name === "img" ? "选择图片" : "选择视频";
|
|
7308
|
+
me2.viewTip = name === "img" ? "" : "为了获得更高的推荐和点击量,建议上传720p(1280*720),大小不超过500MB(视频上传需要时间,请耐心等待)";
|
|
6353
7309
|
me2.viewStatus = true;
|
|
6354
7310
|
},
|
|
7311
|
+
// 关闭弹框
|
|
6355
7312
|
closeDialog() {
|
|
6356
7313
|
this.viewStatus = false;
|
|
6357
7314
|
this.linkStatus = false;
|
|
6358
7315
|
this.linkContent = "";
|
|
6359
7316
|
},
|
|
7317
|
+
// ==========toolbox end==========
|
|
7318
|
+
// 弹框提示
|
|
6360
7319
|
setToast(content) {
|
|
6361
7320
|
elementPlus.ElMessage.error(content);
|
|
6362
7321
|
},
|
|
6363
7322
|
setMessageBoxNoCancel(content) {
|
|
6364
7323
|
elementPlus.ElMessageBox.confirm(content, "", {
|
|
6365
|
-
confirmButtonText: "
|
|
6366
|
-
cancelButtonText: "
|
|
7324
|
+
confirmButtonText: "确定",
|
|
7325
|
+
cancelButtonText: "取消",
|
|
6367
7326
|
type: "warning"
|
|
6368
7327
|
}).then(() => {
|
|
6369
7328
|
}).catch(() => {
|
|
6370
7329
|
});
|
|
7330
|
+
},
|
|
7331
|
+
// 检查是否会创建嵌套的halo-paragraph
|
|
7332
|
+
wouldCreateNestedParagraph(range) {
|
|
7333
|
+
let container = range.startContainer;
|
|
7334
|
+
while (container && container !== this.editorDom) {
|
|
7335
|
+
if (container.nodeType === Node.ELEMENT_NODE && container.classList && container.classList.contains("halo-paragraph")) {
|
|
7336
|
+
return true;
|
|
7337
|
+
}
|
|
7338
|
+
container = container.parentNode;
|
|
7339
|
+
}
|
|
7340
|
+
return false;
|
|
7341
|
+
},
|
|
7342
|
+
// 检查光标是否在两个连续的mdd-topic之间
|
|
7343
|
+
isBetweenTwoTopics(range) {
|
|
7344
|
+
const container = range.startContainer;
|
|
7345
|
+
const offset = range.startOffset;
|
|
7346
|
+
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7347
|
+
const prevElement = container.childNodes[offset - 1];
|
|
7348
|
+
const nextElement = container.childNodes[offset];
|
|
7349
|
+
return prevElement && prevElement.tagName === "MDD-TOPIC" && (nextElement && nextElement.tagName === "MDD-TOPIC");
|
|
7350
|
+
}
|
|
7351
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent.trim() === "") {
|
|
7352
|
+
const prevSibling = container.previousSibling;
|
|
7353
|
+
const nextSibling = container.nextSibling;
|
|
7354
|
+
return prevSibling && prevSibling.tagName === "MDD-TOPIC" && (nextSibling && nextSibling.tagName === "MDD-TOPIC");
|
|
7355
|
+
}
|
|
7356
|
+
return false;
|
|
7357
|
+
},
|
|
7358
|
+
// 处理两个话题之间的回车或话题前面的回车
|
|
7359
|
+
handleEnterBetweenTopics(range) {
|
|
7360
|
+
var _a;
|
|
7361
|
+
const me2 = this;
|
|
7362
|
+
let currentParagraph = range.startContainer;
|
|
7363
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
7364
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7365
|
+
}
|
|
7366
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
7367
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7368
|
+
}
|
|
7369
|
+
if (!currentParagraph)
|
|
7370
|
+
return;
|
|
7371
|
+
const newParagraph = document.createElement("p");
|
|
7372
|
+
newParagraph.className = "halo-paragraph";
|
|
7373
|
+
const afterContent = me2.extractContentAfterCursorPrecise(range, currentParagraph);
|
|
7374
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7375
|
+
while (afterContent.firstChild) {
|
|
7376
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7377
|
+
}
|
|
7378
|
+
} else {
|
|
7379
|
+
newParagraph.innerHTML = "<br>";
|
|
7380
|
+
}
|
|
7381
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7382
|
+
const newRange = document.createRange();
|
|
7383
|
+
if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.TEXT_NODE) {
|
|
7384
|
+
newRange.setStart(newParagraph.firstChild, 0);
|
|
7385
|
+
} else if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.ELEMENT_NODE) {
|
|
7386
|
+
newRange.setStart(newParagraph, 0);
|
|
7387
|
+
} else {
|
|
7388
|
+
newRange.setStart(newParagraph, 0);
|
|
7389
|
+
}
|
|
7390
|
+
newRange.collapse(true);
|
|
7391
|
+
const selection = window.getSelection();
|
|
7392
|
+
selection.removeAllRanges();
|
|
7393
|
+
selection.addRange(newRange);
|
|
7394
|
+
me2.updateData(true);
|
|
7395
|
+
},
|
|
7396
|
+
// 更精确地提取光标后的内容(专门用于话题分割)
|
|
7397
|
+
extractContentAfterCursorPrecise(range, paragraph) {
|
|
7398
|
+
const fragment = document.createDocumentFragment();
|
|
7399
|
+
const container = range.startContainer;
|
|
7400
|
+
const offset = range.startOffset;
|
|
7401
|
+
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7402
|
+
const childNodes = Array.from(container.childNodes);
|
|
7403
|
+
for (let i = offset; i < childNodes.length; i++) {
|
|
7404
|
+
fragment.appendChild(childNodes[i]);
|
|
7405
|
+
}
|
|
7406
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
7407
|
+
if (offset < container.textContent.length) {
|
|
7408
|
+
const afterText = container.textContent.slice(offset);
|
|
7409
|
+
container.textContent = container.textContent.slice(0, offset);
|
|
7410
|
+
const textNode = document.createTextNode(afterText);
|
|
7411
|
+
fragment.appendChild(textNode);
|
|
7412
|
+
}
|
|
7413
|
+
let nextSibling = container.nextSibling;
|
|
7414
|
+
while (nextSibling) {
|
|
7415
|
+
const nodeToMove = nextSibling;
|
|
7416
|
+
nextSibling = nextSibling.nextSibling;
|
|
7417
|
+
fragment.appendChild(nodeToMove);
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
return fragment;
|
|
7421
|
+
},
|
|
7422
|
+
// 处理包含话题的段落中的回车键
|
|
7423
|
+
handleEnterKeyInParagraphWithTopic(range) {
|
|
7424
|
+
var _a;
|
|
7425
|
+
const me2 = this;
|
|
7426
|
+
let currentParagraph = range.startContainer;
|
|
7427
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
7428
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7429
|
+
}
|
|
7430
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
7431
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7432
|
+
}
|
|
7433
|
+
if (!currentParagraph)
|
|
7434
|
+
return;
|
|
7435
|
+
const newParagraph = document.createElement("p");
|
|
7436
|
+
newParagraph.className = "halo-paragraph";
|
|
7437
|
+
const isAtTopicStart = me2.isCursorBeforeFirstTopic(range, currentParagraph);
|
|
7438
|
+
const isAtEnd = me2.isCursorAtEndOfParagraph(range, currentParagraph);
|
|
7439
|
+
if (isAtTopicStart) {
|
|
7440
|
+
const afterContent = me2.extractContentAfterCursor(range, currentParagraph);
|
|
7441
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7442
|
+
while (afterContent.firstChild) {
|
|
7443
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7444
|
+
}
|
|
7445
|
+
} else {
|
|
7446
|
+
newParagraph.innerHTML = "<br>";
|
|
7447
|
+
}
|
|
7448
|
+
if (currentParagraph.innerHTML.trim() === "" || currentParagraph.childNodes.length === 0) {
|
|
7449
|
+
currentParagraph.innerHTML = "<br>";
|
|
7450
|
+
}
|
|
7451
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7452
|
+
} else if (isAtEnd) {
|
|
7453
|
+
newParagraph.innerHTML = "<br>";
|
|
7454
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7455
|
+
} else {
|
|
7456
|
+
const afterContent = me2.extractContentAfterCursor(range, currentParagraph);
|
|
7457
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7458
|
+
let hasValidContent = false;
|
|
7459
|
+
for (let i = 0; i < afterContent.childNodes.length; i++) {
|
|
7460
|
+
const node = afterContent.childNodes[i];
|
|
7461
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
7462
|
+
if (node.textContent.trim() !== "") {
|
|
7463
|
+
hasValidContent = true;
|
|
7464
|
+
break;
|
|
7465
|
+
}
|
|
7466
|
+
} else {
|
|
7467
|
+
hasValidContent = true;
|
|
7468
|
+
break;
|
|
7469
|
+
}
|
|
7470
|
+
}
|
|
7471
|
+
if (hasValidContent) {
|
|
7472
|
+
while (afterContent.firstChild) {
|
|
7473
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7474
|
+
}
|
|
7475
|
+
} else {
|
|
7476
|
+
newParagraph.innerHTML = "<br>";
|
|
7477
|
+
}
|
|
7478
|
+
} else {
|
|
7479
|
+
newParagraph.innerHTML = "<br>";
|
|
7480
|
+
}
|
|
7481
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7482
|
+
}
|
|
7483
|
+
const newRange = document.createRange();
|
|
7484
|
+
if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.TEXT_NODE) {
|
|
7485
|
+
newRange.setStart(newParagraph.firstChild, 0);
|
|
7486
|
+
} else if (newParagraph.firstChild) {
|
|
7487
|
+
newRange.setStart(newParagraph, 0);
|
|
7488
|
+
} else {
|
|
7489
|
+
newRange.setStart(newParagraph, 0);
|
|
7490
|
+
}
|
|
7491
|
+
newRange.collapse(true);
|
|
7492
|
+
const selection = window.getSelection();
|
|
7493
|
+
selection.removeAllRanges();
|
|
7494
|
+
selection.addRange(newRange);
|
|
7495
|
+
me2.updateData(true);
|
|
7496
|
+
},
|
|
7497
|
+
// 检查光标是否在第一个话题前面
|
|
7498
|
+
isCursorBeforeFirstTopic(range, paragraph) {
|
|
7499
|
+
const container = range.startContainer;
|
|
7500
|
+
const offset = range.startOffset;
|
|
7501
|
+
const firstTopic = paragraph.querySelector("mdd-topic");
|
|
7502
|
+
if (!firstTopic) {
|
|
7503
|
+
return false;
|
|
7504
|
+
}
|
|
7505
|
+
if (container === paragraph && offset === 0) {
|
|
7506
|
+
return true;
|
|
7507
|
+
}
|
|
7508
|
+
if (container === paragraph && offset > 0 && offset <= paragraph.childNodes.length) {
|
|
7509
|
+
if (offset < paragraph.childNodes.length) {
|
|
7510
|
+
const nodeAtOffset = paragraph.childNodes[offset];
|
|
7511
|
+
if (nodeAtOffset === firstTopic) {
|
|
7512
|
+
return true;
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
let nextNonEmptyNode = null;
|
|
7516
|
+
for (let i = offset; i < paragraph.childNodes.length; i++) {
|
|
7517
|
+
const node = paragraph.childNodes[i];
|
|
7518
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "MDD-TOPIC") {
|
|
7519
|
+
nextNonEmptyNode = node;
|
|
7520
|
+
break;
|
|
7521
|
+
} else if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== "") {
|
|
7522
|
+
break;
|
|
7523
|
+
}
|
|
7524
|
+
}
|
|
7525
|
+
if (nextNonEmptyNode === firstTopic) {
|
|
7526
|
+
return true;
|
|
7527
|
+
}
|
|
7528
|
+
}
|
|
7529
|
+
try {
|
|
7530
|
+
const topicRange = document.createRange();
|
|
7531
|
+
topicRange.setStartBefore(firstTopic);
|
|
7532
|
+
const comparison = topicRange.comparePoint(container, offset);
|
|
7533
|
+
if (comparison < 0) {
|
|
7534
|
+
return true;
|
|
7535
|
+
}
|
|
7536
|
+
} catch (e) {
|
|
7537
|
+
if (container.nodeType === Node.TEXT_NODE) {
|
|
7538
|
+
const tempRange = document.createRange();
|
|
7539
|
+
tempRange.setStart(container, offset);
|
|
7540
|
+
tempRange.collapse(true);
|
|
7541
|
+
const topicRange = document.createRange();
|
|
7542
|
+
topicRange.setStartBefore(firstTopic);
|
|
7543
|
+
if (tempRange.compareBoundaryPoints(Range.START_TO_START, topicRange) < 0) {
|
|
7544
|
+
return true;
|
|
7545
|
+
}
|
|
7546
|
+
}
|
|
7547
|
+
if (container === paragraph) {
|
|
7548
|
+
const testRange = document.createRange();
|
|
7549
|
+
testRange.setStart(paragraph, 0);
|
|
7550
|
+
testRange.setEnd(paragraph, offset);
|
|
7551
|
+
const containsTopic = testRange.intersectsNode(firstTopic);
|
|
7552
|
+
if (!containsTopic) {
|
|
7553
|
+
return true;
|
|
7554
|
+
}
|
|
7555
|
+
}
|
|
7556
|
+
}
|
|
7557
|
+
return false;
|
|
7558
|
+
},
|
|
7559
|
+
// 获取不包含mdd-topic内部文本的段落文本
|
|
7560
|
+
getParagraphTextExcludingTopics(paragraph, range) {
|
|
7561
|
+
let textContent = "";
|
|
7562
|
+
let cursorPosition = 0;
|
|
7563
|
+
let foundCursor = false;
|
|
7564
|
+
const walker = document.createTreeWalker(
|
|
7565
|
+
paragraph,
|
|
7566
|
+
NodeFilter.SHOW_ALL,
|
|
7567
|
+
{
|
|
7568
|
+
acceptNode: function(node2) {
|
|
7569
|
+
if (node2.nodeType === Node.ELEMENT_NODE && node2.tagName === "MDD-TOPIC") {
|
|
7570
|
+
return NodeFilter.FILTER_REJECT;
|
|
7571
|
+
}
|
|
7572
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
7573
|
+
}
|
|
7574
|
+
},
|
|
7575
|
+
false
|
|
7576
|
+
);
|
|
7577
|
+
let node;
|
|
7578
|
+
while (node = walker.nextNode()) {
|
|
7579
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
7580
|
+
const nodeText = node.textContent;
|
|
7581
|
+
if (!foundCursor && node === range.startContainer) {
|
|
7582
|
+
cursorPosition = textContent.length + range.startOffset;
|
|
7583
|
+
foundCursor = true;
|
|
7584
|
+
}
|
|
7585
|
+
textContent += nodeText;
|
|
7586
|
+
}
|
|
7587
|
+
}
|
|
7588
|
+
return { textContent, cursorPosition };
|
|
7589
|
+
},
|
|
7590
|
+
// 检查光标是否在段落开头
|
|
7591
|
+
isCursorAtStartOfParagraph(range, paragraph) {
|
|
7592
|
+
const { cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
7593
|
+
return cursorPosition === 0;
|
|
7594
|
+
},
|
|
7595
|
+
// 检查光标是否在段落末尾
|
|
7596
|
+
isCursorAtEndOfParagraph(range, paragraph) {
|
|
7597
|
+
const walker = document.createTreeWalker(
|
|
7598
|
+
paragraph,
|
|
7599
|
+
NodeFilter.SHOW_TEXT,
|
|
7600
|
+
{
|
|
7601
|
+
acceptNode: function(node2) {
|
|
7602
|
+
let parent = node2.parentNode;
|
|
7603
|
+
while (parent && parent !== paragraph) {
|
|
7604
|
+
if (parent.tagName === "MDD-TOPIC") {
|
|
7605
|
+
return NodeFilter.FILTER_REJECT;
|
|
7606
|
+
}
|
|
7607
|
+
parent = parent.parentNode;
|
|
7608
|
+
}
|
|
7609
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
7610
|
+
}
|
|
7611
|
+
},
|
|
7612
|
+
false
|
|
7613
|
+
);
|
|
7614
|
+
let totalLength = 0;
|
|
7615
|
+
let node;
|
|
7616
|
+
while (node = walker.nextNode()) {
|
|
7617
|
+
totalLength += node.textContent.length;
|
|
7618
|
+
}
|
|
7619
|
+
const { cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
7620
|
+
return cursorPosition >= totalLength;
|
|
7621
|
+
},
|
|
7622
|
+
// 获取当前段落
|
|
7623
|
+
getCurrentParagraph(range) {
|
|
7624
|
+
let container = range.startContainer;
|
|
7625
|
+
while (container && container !== this.editorDom) {
|
|
7626
|
+
if (container.nodeType === Node.ELEMENT_NODE && container.classList && container.classList.contains("halo-paragraph")) {
|
|
7627
|
+
return container;
|
|
7628
|
+
}
|
|
7629
|
+
container = container.parentNode;
|
|
7630
|
+
}
|
|
7631
|
+
return null;
|
|
7632
|
+
},
|
|
7633
|
+
// 提取光标后的内容
|
|
7634
|
+
extractContentAfterCursor(range, paragraph) {
|
|
7635
|
+
const fragment = document.createDocumentFragment();
|
|
7636
|
+
const container = range.startContainer;
|
|
7637
|
+
const offset = range.startOffset;
|
|
7638
|
+
let topicSpaceNode = null;
|
|
7639
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent === " " && container.previousSibling && container.previousSibling.tagName === "MDD-TOPIC") {
|
|
7640
|
+
topicSpaceNode = container;
|
|
7641
|
+
}
|
|
7642
|
+
const extractRange = document.createRange();
|
|
7643
|
+
let startNode = null;
|
|
7644
|
+
let hasContentToExtract = false;
|
|
7645
|
+
if (topicSpaceNode) {
|
|
7646
|
+
if (topicSpaceNode.nextSibling) {
|
|
7647
|
+
startNode = topicSpaceNode.nextSibling;
|
|
7648
|
+
hasContentToExtract = true;
|
|
7649
|
+
}
|
|
7650
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
7651
|
+
if (container.textContent === "" && offset === 0) {
|
|
7652
|
+
if (container.nextSibling) {
|
|
7653
|
+
startNode = container.nextSibling;
|
|
7654
|
+
hasContentToExtract = true;
|
|
7655
|
+
}
|
|
7656
|
+
} else if (offset < container.textContent.length) {
|
|
7657
|
+
const afterText = container.textContent.slice(offset);
|
|
7658
|
+
container.textContent = container.textContent.slice(0, offset);
|
|
7659
|
+
if (afterText.trim()) {
|
|
7660
|
+
const newTextNode = document.createTextNode(afterText);
|
|
7661
|
+
container.parentNode.insertBefore(newTextNode, container.nextSibling);
|
|
7662
|
+
startNode = newTextNode;
|
|
7663
|
+
hasContentToExtract = true;
|
|
7664
|
+
} else if (container.nextSibling) {
|
|
7665
|
+
startNode = container.nextSibling;
|
|
7666
|
+
hasContentToExtract = true;
|
|
7667
|
+
}
|
|
7668
|
+
} else {
|
|
7669
|
+
if (container.nextSibling) {
|
|
7670
|
+
startNode = container.nextSibling;
|
|
7671
|
+
hasContentToExtract = true;
|
|
7672
|
+
}
|
|
7673
|
+
}
|
|
7674
|
+
} else if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7675
|
+
if (offset < container.childNodes.length) {
|
|
7676
|
+
startNode = container.childNodes[offset];
|
|
7677
|
+
hasContentToExtract = true;
|
|
7678
|
+
} else if (offset === 0 && container === paragraph) {
|
|
7679
|
+
if (paragraph.firstChild) {
|
|
7680
|
+
startNode = paragraph.firstChild;
|
|
7681
|
+
hasContentToExtract = true;
|
|
7682
|
+
}
|
|
7683
|
+
}
|
|
7684
|
+
}
|
|
7685
|
+
if (!hasContentToExtract || !startNode) {
|
|
7686
|
+
return fragment;
|
|
7687
|
+
}
|
|
7688
|
+
if (!paragraph.contains(startNode)) {
|
|
7689
|
+
return fragment;
|
|
7690
|
+
}
|
|
7691
|
+
try {
|
|
7692
|
+
extractRange.setStartBefore(startNode);
|
|
7693
|
+
let lastNode = paragraph.lastChild;
|
|
7694
|
+
while (lastNode && lastNode.nodeType === Node.TEXT_NODE && lastNode.textContent === "" && // 只跳过完全空的文本节点
|
|
7695
|
+
lastNode !== startNode) {
|
|
7696
|
+
lastNode = lastNode.previousSibling;
|
|
7697
|
+
}
|
|
7698
|
+
if (lastNode) {
|
|
7699
|
+
extractRange.setEndAfter(lastNode);
|
|
7700
|
+
} else {
|
|
7701
|
+
extractRange.setEnd(paragraph, paragraph.childNodes.length);
|
|
7702
|
+
}
|
|
7703
|
+
const extractedContent = extractRange.extractContents();
|
|
7704
|
+
fragment.appendChild(extractedContent);
|
|
7705
|
+
} catch (e) {
|
|
7706
|
+
let currentNode = startNode;
|
|
7707
|
+
while (currentNode && currentNode.parentNode === paragraph) {
|
|
7708
|
+
const nextNode = currentNode.nextSibling;
|
|
7709
|
+
fragment.appendChild(currentNode);
|
|
7710
|
+
currentNode = nextNode;
|
|
7711
|
+
}
|
|
7712
|
+
}
|
|
7713
|
+
return fragment;
|
|
7714
|
+
},
|
|
7715
|
+
// 统一的光标设置方法 - 设置光标到元素后面
|
|
7716
|
+
setCursorAfterElement(element) {
|
|
7717
|
+
const newRange = document.createRange();
|
|
7718
|
+
newRange.setStartAfter(element);
|
|
7719
|
+
newRange.collapse(true);
|
|
7720
|
+
const selection = window.getSelection();
|
|
7721
|
+
selection.removeAllRanges();
|
|
7722
|
+
selection.addRange(newRange);
|
|
7723
|
+
},
|
|
7724
|
+
// 统一的光标设置方法 - 设置光标到元素前面
|
|
7725
|
+
setCursorBeforeElement(element) {
|
|
7726
|
+
const newRange = document.createRange();
|
|
7727
|
+
newRange.setStartBefore(element);
|
|
7728
|
+
newRange.collapse(true);
|
|
7729
|
+
const selection = window.getSelection();
|
|
7730
|
+
selection.removeAllRanges();
|
|
7731
|
+
selection.addRange(newRange);
|
|
6371
7732
|
}
|
|
6372
7733
|
},
|
|
6373
7734
|
beforeRouteLeave(to, from, next) {
|
|
@@ -6380,8 +7741,6 @@
|
|
|
6380
7741
|
slot: "footer",
|
|
6381
7742
|
class: "dialog-footer"
|
|
6382
7743
|
};
|
|
6383
|
-
const _hoisted_4 = /* @__PURE__ */ vue.createTextVNode("\u53D6 \u6D88");
|
|
6384
|
-
const _hoisted_5 = /* @__PURE__ */ vue.createTextVNode("\u786E \u5B9A");
|
|
6385
7744
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6386
7745
|
const _component_el_input = vue.resolveComponent("el-input");
|
|
6387
7746
|
const _component_el_form_item = vue.resolveComponent("el-form-item");
|
|
@@ -6392,11 +7751,12 @@
|
|
|
6392
7751
|
const _component_ImgUpload = vue.resolveComponent("ImgUpload");
|
|
6393
7752
|
const _component_VideoUpload = vue.resolveComponent("VideoUpload");
|
|
6394
7753
|
const _component_CollectArticle = vue.resolveComponent("CollectArticle");
|
|
7754
|
+
const _component_TopicManager = vue.resolveComponent("TopicManager");
|
|
6395
7755
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
6396
7756
|
vue.withDirectives(vue.createElementVNode("div", {
|
|
6397
7757
|
style: vue.normalizeStyle({ textAlign: $options.align }),
|
|
6398
7758
|
class: "placeholder"
|
|
6399
|
-
},
|
|
7759
|
+
}, vue.toDisplayString($props.placeholder || "请输入正文"), 5), [
|
|
6400
7760
|
[vue.vShow, !$options.isInputing && !$data.titleCount && !$data.hasArticleCard]
|
|
6401
7761
|
]),
|
|
6402
7762
|
$data.overLine ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -6421,26 +7781,26 @@
|
|
|
6421
7781
|
vue.createVNode(_component_el_form, { model: $data.linkForm }, {
|
|
6422
7782
|
default: vue.withCtx(() => [
|
|
6423
7783
|
vue.createVNode(_component_el_form_item, {
|
|
6424
|
-
label: "
|
|
7784
|
+
label: "添加链接",
|
|
6425
7785
|
class: "link-title"
|
|
6426
7786
|
}, {
|
|
6427
7787
|
default: vue.withCtx(() => [
|
|
6428
7788
|
vue.createVNode(_component_el_input, {
|
|
6429
7789
|
modelValue: $data.linkForm.linkAddress,
|
|
6430
7790
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.linkForm.linkAddress = $event),
|
|
6431
|
-
placeholder: "
|
|
7791
|
+
placeholder: "请输入链接地址"
|
|
6432
7792
|
}, null, 8, ["modelValue"])
|
|
6433
7793
|
]),
|
|
6434
7794
|
_: 1
|
|
6435
7795
|
}),
|
|
6436
|
-
vue.createVNode(_component_el_form_item, { label: "
|
|
7796
|
+
vue.createVNode(_component_el_form_item, { label: "链接文案" }, {
|
|
6437
7797
|
default: vue.withCtx(() => [
|
|
6438
7798
|
vue.createVNode(_component_el_input, {
|
|
6439
7799
|
modelValue: $data.linkForm.linkWriting,
|
|
6440
7800
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.linkForm.linkWriting = $event),
|
|
6441
7801
|
type: "textarea",
|
|
6442
7802
|
autosize: "",
|
|
6443
|
-
placeholder: "
|
|
7803
|
+
placeholder: "请输入链接文案"
|
|
6444
7804
|
}, null, 8, ["modelValue"])
|
|
6445
7805
|
]),
|
|
6446
7806
|
_: 1
|
|
@@ -6453,18 +7813,18 @@
|
|
|
6453
7813
|
vue.createVNode(_component_el_button, {
|
|
6454
7814
|
onClick: _cache[3] || (_cache[3] = ($event) => $data.viewLinkDialog = false)
|
|
6455
7815
|
}, {
|
|
6456
|
-
default: vue.withCtx(() => [
|
|
6457
|
-
|
|
6458
|
-
]),
|
|
7816
|
+
default: vue.withCtx(() => _cache[14] || (_cache[14] = [
|
|
7817
|
+
vue.createTextVNode("取 消")
|
|
7818
|
+
])),
|
|
6459
7819
|
_: 1
|
|
6460
7820
|
}),
|
|
6461
7821
|
vue.createVNode(_component_el_button, {
|
|
6462
7822
|
type: "primary",
|
|
6463
7823
|
onClick: $options.insertLink
|
|
6464
7824
|
}, {
|
|
6465
|
-
default: vue.withCtx(() => [
|
|
6466
|
-
|
|
6467
|
-
]),
|
|
7825
|
+
default: vue.withCtx(() => _cache[15] || (_cache[15] = [
|
|
7826
|
+
vue.createTextVNode("确 定")
|
|
7827
|
+
])),
|
|
6468
7828
|
_: 1
|
|
6469
7829
|
}, 8, ["onClick"])
|
|
6470
7830
|
])
|
|
@@ -6481,7 +7841,7 @@
|
|
|
6481
7841
|
}, null, 8, ["article", "visible", "getList", "onDelete", "onChange"]),
|
|
6482
7842
|
vue.createVNode(_component_ImgUpload, {
|
|
6483
7843
|
"img-list": $data.imgList,
|
|
6484
|
-
"onUpdate:
|
|
7844
|
+
"onUpdate:imgList": _cache[6] || (_cache[6] = ($event) => $data.imgList = $event),
|
|
6485
7845
|
visible: $data.visibleImg,
|
|
6486
7846
|
"onUpdate:visible": _cache[7] || (_cache[7] = ($event) => $data.visibleImg = $event),
|
|
6487
7847
|
chartGallery: $props.chartGallery,
|
|
@@ -6496,7 +7856,7 @@
|
|
|
6496
7856
|
}, null, 8, ["visible", "file-selected"]),
|
|
6497
7857
|
vue.createVNode(_component_CollectArticle, {
|
|
6498
7858
|
"link-content": $data.linkContent,
|
|
6499
|
-
"onUpdate:
|
|
7859
|
+
"onUpdate:linkContent": _cache[9] || (_cache[9] = ($event) => $data.linkContent = $event),
|
|
6500
7860
|
visible: $data.visibleCollectArticle,
|
|
6501
7861
|
"onUpdate:visible": _cache[10] || (_cache[10] = ($event) => $data.visibleCollectArticle = $event),
|
|
6502
7862
|
onSubmit: $options.confirmLink
|
|
@@ -6522,7 +7882,14 @@
|
|
|
6522
7882
|
class: "replace-poster hide",
|
|
6523
7883
|
accept: "image/*",
|
|
6524
7884
|
onChange: _cache[13] || (_cache[13] = (...args) => $options.replacePoster && $options.replacePoster(...args))
|
|
6525
|
-
}, null, 32)
|
|
7885
|
+
}, null, 32),
|
|
7886
|
+
vue.createVNode(_component_TopicManager, {
|
|
7887
|
+
ref: "topicManager",
|
|
7888
|
+
"editor-dom": $data.editorDom,
|
|
7889
|
+
request: $props.request,
|
|
7890
|
+
onTopicInserted: $options.onTopicInserted,
|
|
7891
|
+
onUpdateTopicPosition: $options.updateTopicPosition
|
|
7892
|
+
}, null, 8, ["editor-dom", "request", "onTopicInserted", "onUpdateTopicPosition"])
|
|
6526
7893
|
]);
|
|
6527
7894
|
}
|
|
6528
7895
|
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
@@ -6542,7 +7909,7 @@
|
|
|
6542
7909
|
var COLOUR_CLASS = "colour";
|
|
6543
7910
|
var FONT_FAMILY_CLASS = "font";
|
|
6544
7911
|
var FONT_SIZE_CLASS = "size";
|
|
6545
|
-
var ZWS = "
|
|
7912
|
+
var ZWS = "";
|
|
6546
7913
|
var win = doc.defaultView;
|
|
6547
7914
|
var ua = navigator.userAgent;
|
|
6548
7915
|
var isAndroid = /Android/.test(ua);
|
|
@@ -6572,11 +7939,17 @@
|
|
|
6572
7939
|
};
|
|
6573
7940
|
}
|
|
6574
7941
|
var typeToBitArray = {
|
|
7942
|
+
// ELEMENT_NODE
|
|
6575
7943
|
1: 1,
|
|
7944
|
+
// ATTRIBUTE_NODE
|
|
6576
7945
|
2: 2,
|
|
7946
|
+
// TEXT_NODE
|
|
6577
7947
|
3: 4,
|
|
7948
|
+
// COMMENT_NODE
|
|
6578
7949
|
8: 128,
|
|
7950
|
+
// DOCUMENT_NODE
|
|
6579
7951
|
9: 256,
|
|
7952
|
+
// DOCUMENT_FRAGMENT_NODE
|
|
6580
7953
|
11: 1024
|
|
6581
7954
|
};
|
|
6582
7955
|
function TreeWalker(root, nodeType, filter) {
|
|
@@ -6910,7 +8283,7 @@
|
|
|
6910
8283
|
node.appendChild(fixer);
|
|
6911
8284
|
} catch (error) {
|
|
6912
8285
|
self2.didError({
|
|
6913
|
-
name: "Squire: fixCursor
|
|
8286
|
+
name: "Squire: fixCursor – " + error,
|
|
6914
8287
|
message: "Parent: " + node.nodeName + "/" + node.innerHTML + " appendChild: " + fixer.nodeName
|
|
6915
8288
|
});
|
|
6916
8289
|
}
|
|
@@ -6927,17 +8300,6 @@
|
|
|
6927
8300
|
child = children[i];
|
|
6928
8301
|
isBR = child.nodeName === "BR";
|
|
6929
8302
|
if (!isBR && isInline(child)) {
|
|
6930
|
-
if (child.classList && child.classList.contains("halo-picture-area")) {
|
|
6931
|
-
return;
|
|
6932
|
-
}
|
|
6933
|
-
if (!wrapper) {
|
|
6934
|
-
wrapper = createElement(
|
|
6935
|
-
doc2,
|
|
6936
|
-
config.blockTag,
|
|
6937
|
-
config.blockAttributes
|
|
6938
|
-
);
|
|
6939
|
-
}
|
|
6940
|
-
wrapper.appendChild(child);
|
|
6941
8303
|
i -= 1;
|
|
6942
8304
|
l -= 1;
|
|
6943
8305
|
} else if (isBR || wrapper) {
|
|
@@ -7256,7 +8618,8 @@
|
|
|
7256
8618
|
block = getStartBlockOfRange(range, root);
|
|
7257
8619
|
firstBlockInFrag = getNextBlock(frag, frag);
|
|
7258
8620
|
replaceBlock = !!block && isEmptyBlock(block);
|
|
7259
|
-
if (block && firstBlockInFrag && !replaceBlock &&
|
|
8621
|
+
if (block && firstBlockInFrag && !replaceBlock && // Don't merge table cells or PRE elements into block
|
|
8622
|
+
!getNearest(firstBlockInFrag, frag, "PRE") && !getNearest(firstBlockInFrag, frag, "TABLE")) {
|
|
7260
8623
|
moveRangeBoundariesUpTree(range, block, block, root);
|
|
7261
8624
|
range.collapse(true);
|
|
7262
8625
|
container = range.endContainer;
|
|
@@ -7272,7 +8635,10 @@
|
|
|
7272
8635
|
container = nodeAfterSplit.parentNode;
|
|
7273
8636
|
offset = indexOf.call(container.childNodes, nodeAfterSplit);
|
|
7274
8637
|
}
|
|
7275
|
-
if (
|
|
8638
|
+
if (
|
|
8639
|
+
/* isBlock( container ) && */
|
|
8640
|
+
offset !== getLength(container)
|
|
8641
|
+
) {
|
|
7276
8642
|
blockContentsAfterSplit = root.ownerDocument.createDocumentFragment();
|
|
7277
8643
|
while (node = container.childNodes[offset]) {
|
|
7278
8644
|
blockContentsAfterSplit.appendChild(node);
|
|
@@ -8321,9 +9687,11 @@
|
|
|
8321
9687
|
if (hasImage) {
|
|
8322
9688
|
this.fireEvent("dragover", {
|
|
8323
9689
|
dataTransfer: clipboardData,
|
|
9690
|
+
/* jshint loopfunc: true */
|
|
8324
9691
|
preventDefault: function() {
|
|
8325
9692
|
fireDrop = true;
|
|
8326
9693
|
}
|
|
9694
|
+
/* jshint loopfunc: false */
|
|
8327
9695
|
});
|
|
8328
9696
|
if (fireDrop) {
|
|
8329
9697
|
this.fireEvent("drop", {
|
|
@@ -8530,7 +9898,9 @@
|
|
|
8530
9898
|
leafNodeNames,
|
|
8531
9899
|
undo: {
|
|
8532
9900
|
documentSizeThreshold: -1,
|
|
9901
|
+
// -1 means no threshold
|
|
8533
9902
|
undoLimit: -1
|
|
9903
|
+
// -1 means no limit
|
|
8534
9904
|
},
|
|
8535
9905
|
isInsertedHTMLSanitized: true,
|
|
8536
9906
|
isSetHTMLSanitized: true,
|
|
@@ -10172,5 +11542,5 @@
|
|
|
10172
11542
|
exports2.Editor = Editor;
|
|
10173
11543
|
exports2.ToolBar = ToolBar;
|
|
10174
11544
|
exports2.ToolsEnum = ToolsEnum;
|
|
10175
|
-
Object.
|
|
11545
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
10176
11546
|
});
|