@haluo/biz 2.0.40 → 2.0.42-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -34
- package/dist/haluo-biz.js +2246 -727
- package/dist/haluo-biz.umd.cjs +2275 -756
- package/dist/{squire-raw.9f05be24.js → squire-raw-1aaeff0b.js} +18 -15
- package/dist/style.css +112 -32
- package/package.json +49 -47
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,13 +518,13 @@
|
|
|
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$
|
|
525
|
+
const _hoisted_2$5 = { class: "tools-content" };
|
|
526
|
+
const _hoisted_3$5 = ["src"];
|
|
527
|
+
const _hoisted_4$3 = ["src"];
|
|
531
528
|
const _hoisted_5$3 = ["src"];
|
|
532
529
|
const _hoisted_6$2 = { class: "box" };
|
|
533
530
|
const _hoisted_7$2 = ["src"];
|
|
@@ -568,9 +565,9 @@
|
|
|
568
565
|
key: 0,
|
|
569
566
|
class: "box-mask"
|
|
570
567
|
};
|
|
571
|
-
const _hoisted_30
|
|
572
|
-
const _hoisted_31
|
|
573
|
-
const _hoisted_32
|
|
568
|
+
const _hoisted_30 = { class: "box" };
|
|
569
|
+
const _hoisted_31 = ["src"];
|
|
570
|
+
const _hoisted_32 = ["src"];
|
|
574
571
|
const _hoisted_33 = ["src"];
|
|
575
572
|
const _hoisted_34 = ["src"];
|
|
576
573
|
const _hoisted_35 = { class: "tools-title" };
|
|
@@ -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(() => [
|
|
@@ -657,7 +654,7 @@
|
|
|
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(() => [
|
|
@@ -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(() => [
|
|
@@ -738,7 +735,7 @@
|
|
|
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(() => [
|
|
@@ -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(() => [
|
|
@@ -959,7 +956,7 @@
|
|
|
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,17 +1104,15 @@
|
|
|
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$3 = {
|
|
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 _sfc_main$
|
|
1115
|
+
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
1121
1116
|
__name: "index",
|
|
1122
1117
|
props: {
|
|
1123
1118
|
visible: { type: Boolean, default: false },
|
|
@@ -1158,24 +1153,24 @@
|
|
|
1158
1153
|
class: vue.normalizeClass(["basic-dialog", { "hide-title": !_ctx.showTitle }])
|
|
1159
1154
|
}, {
|
|
1160
1155
|
header: vue.withCtx(() => [
|
|
1161
|
-
_ctx.showTitle ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1162
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
1163
|
-
|
|
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)),
|
|
1164
1159
|
vue.renderSlot(_ctx.$slots, "title")
|
|
1165
1160
|
])
|
|
1166
1161
|
])) : vue.createCommentVNode("", true)
|
|
1167
1162
|
]),
|
|
1168
1163
|
footer: vue.withCtx(() => [
|
|
1169
|
-
_ctx.showBtn ? (vue.openBlock(), vue.createElementBlock("span",
|
|
1164
|
+
_ctx.showBtn ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$4, [
|
|
1170
1165
|
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
1171
1166
|
style: { "width": "120px", "border-color": "#cccccc", "color": "#333333" },
|
|
1172
1167
|
plain: "",
|
|
1173
1168
|
round: "",
|
|
1174
1169
|
onClick: handleClose
|
|
1175
1170
|
}, {
|
|
1176
|
-
default: vue.withCtx(() => [
|
|
1177
|
-
vue.createTextVNode("
|
|
1178
|
-
]),
|
|
1171
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
1172
|
+
vue.createTextVNode("取消")
|
|
1173
|
+
])),
|
|
1179
1174
|
_: 1
|
|
1180
1175
|
}),
|
|
1181
1176
|
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
@@ -1184,9 +1179,9 @@
|
|
|
1184
1179
|
type: "primary",
|
|
1185
1180
|
onClick: confirm
|
|
1186
1181
|
}, {
|
|
1187
|
-
default: vue.withCtx(() => [
|
|
1188
|
-
vue.createTextVNode("
|
|
1189
|
-
]),
|
|
1182
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
1183
|
+
vue.createTextVNode("确认")
|
|
1184
|
+
])),
|
|
1190
1185
|
_: 1
|
|
1191
1186
|
})
|
|
1192
1187
|
])) : vue.createCommentVNode("", true)
|
|
@@ -1199,12 +1194,14 @@
|
|
|
1199
1194
|
};
|
|
1200
1195
|
}
|
|
1201
1196
|
});
|
|
1197
|
+
const index_vue_vue_type_style_index_0_lang$5 = "";
|
|
1202
1198
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1203
1199
|
function getDefaultExportFromCjs(x) {
|
|
1204
1200
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1205
1201
|
}
|
|
1206
|
-
var date$
|
|
1207
|
-
|
|
1202
|
+
var date$2 = { exports: {} };
|
|
1203
|
+
var date = date$2.exports;
|
|
1204
|
+
Object.defineProperty(date, "__esModule", { value: true });
|
|
1208
1205
|
function replacementDate(data, fmt) {
|
|
1209
1206
|
for (var k in data) {
|
|
1210
1207
|
if (new RegExp("(" + k + ")").test(fmt)) {
|
|
@@ -1219,126 +1216,130 @@
|
|
|
1219
1216
|
}
|
|
1220
1217
|
return fmt;
|
|
1221
1218
|
}
|
|
1222
|
-
var DateClass =
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
"
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
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);
|
|
1242
1256
|
};
|
|
1243
|
-
|
|
1244
|
-
"
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
"3": "\u4E09",
|
|
1248
|
-
"4": "\u56DB",
|
|
1249
|
-
"5": "\u4E94",
|
|
1250
|
-
"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];
|
|
1251
1261
|
};
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
var hh = Math.floor(ts / 1e3 / 60 / 60 % 24);
|
|
1270
|
-
var mm = Math.floor(ts / 1e3 / 60 % 60);
|
|
1271
|
-
var ss = Math.floor(ts / 1e3 % 60);
|
|
1272
|
-
if (ts <= 0)
|
|
1273
|
-
return false;
|
|
1274
|
-
return {
|
|
1275
|
-
dd: dd < 10 ? "0".concat(dd) : dd,
|
|
1276
|
-
hh: hh < 10 ? "0".concat(hh) : hh,
|
|
1277
|
-
mm: mm < 10 ? "0".concat(mm) : mm,
|
|
1278
|
-
ss: ss < 10 ? "0".concat(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
|
+
};
|
|
1279
1279
|
};
|
|
1280
|
-
|
|
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
|
-
|
|
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);
|
|
1321
1328
|
};
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
if (
|
|
1325
|
-
|
|
1326
|
-
return backData.split("\u5E74")[1];
|
|
1329
|
+
if (dayDiff === -1) {
|
|
1330
|
+
return "刚刚";
|
|
1331
|
+
} else if (isNaN(dayDiff) || dayDiff < 0 || dayDiff >= 15) {
|
|
1332
|
+
return formatDate();
|
|
1327
1333
|
}
|
|
1328
|
-
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 + "天前";
|
|
1329
1335
|
};
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
return DateClass2;
|
|
1338
|
-
}();
|
|
1339
|
-
date$1.exports = new DateClass();
|
|
1340
|
-
const date = /* @__PURE__ */ getDefaultExportFromCjs(date$1.exports);
|
|
1341
|
-
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: {} };
|
|
1342
1343
|
var _listCacheClear;
|
|
1343
1344
|
var hasRequired_listCacheClear;
|
|
1344
1345
|
function require_listCacheClear() {
|
|
@@ -2245,6 +2246,7 @@
|
|
|
2245
2246
|
stubFalse_1 = stubFalse;
|
|
2246
2247
|
return stubFalse_1;
|
|
2247
2248
|
}
|
|
2249
|
+
isBuffer.exports;
|
|
2248
2250
|
var hasRequiredIsBuffer;
|
|
2249
2251
|
function requireIsBuffer() {
|
|
2250
2252
|
if (hasRequiredIsBuffer)
|
|
@@ -2324,6 +2326,7 @@
|
|
|
2324
2326
|
return _baseUnary;
|
|
2325
2327
|
}
|
|
2326
2328
|
var _nodeUtil = { exports: {} };
|
|
2329
|
+
_nodeUtil.exports;
|
|
2327
2330
|
var hasRequired_nodeUtil;
|
|
2328
2331
|
function require_nodeUtil() {
|
|
2329
2332
|
if (hasRequired_nodeUtil)
|
|
@@ -2373,7 +2376,11 @@
|
|
|
2373
2376
|
function arrayLikeKeys(value, inherited) {
|
|
2374
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;
|
|
2375
2378
|
for (var key in value) {
|
|
2376
|
-
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)))) {
|
|
2377
2384
|
result.push(key);
|
|
2378
2385
|
}
|
|
2379
2386
|
}
|
|
@@ -2553,6 +2560,7 @@
|
|
|
2553
2560
|
return _baseAssignIn;
|
|
2554
2561
|
}
|
|
2555
2562
|
var _cloneBuffer = { exports: {} };
|
|
2563
|
+
_cloneBuffer.exports;
|
|
2556
2564
|
var hasRequired_cloneBuffer;
|
|
2557
2565
|
function require_cloneBuffer() {
|
|
2558
2566
|
if (hasRequired_cloneBuffer)
|
|
@@ -3166,13 +3174,13 @@
|
|
|
3166
3174
|
return cloneDeep_1;
|
|
3167
3175
|
}
|
|
3168
3176
|
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3169
|
-
var
|
|
3170
|
-
var
|
|
3171
|
-
function
|
|
3172
|
-
if (
|
|
3173
|
-
return
|
|
3174
|
-
|
|
3175
|
-
|
|
3177
|
+
var clipboardCopy_1;
|
|
3178
|
+
var hasRequiredClipboardCopy;
|
|
3179
|
+
function requireClipboardCopy() {
|
|
3180
|
+
if (hasRequiredClipboardCopy)
|
|
3181
|
+
return clipboardCopy_1;
|
|
3182
|
+
hasRequiredClipboardCopy = 1;
|
|
3183
|
+
clipboardCopy_1 = clipboardCopy;
|
|
3176
3184
|
function makeError() {
|
|
3177
3185
|
return new DOMException("The request is not allowed", "NotAllowedError");
|
|
3178
3186
|
}
|
|
@@ -3215,266 +3223,270 @@
|
|
|
3215
3223
|
}
|
|
3216
3224
|
}
|
|
3217
3225
|
}
|
|
3218
|
-
return
|
|
3226
|
+
return clipboardCopy_1;
|
|
3219
3227
|
}
|
|
3220
|
-
|
|
3228
|
+
var tools = tools$2.exports;
|
|
3229
|
+
Object.defineProperty(tools, "__esModule", { value: true });
|
|
3221
3230
|
var previous = 0;
|
|
3222
3231
|
var timeout = null;
|
|
3223
|
-
var ToolsClass =
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
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];
|
|
3239
3304
|
}
|
|
3305
|
+
return _obj;
|
|
3306
|
+
};
|
|
3307
|
+
ToolsClass2.prototype.deepCopy3 = function(obj) {
|
|
3308
|
+
var deepcopy = requireCloneDeep();
|
|
3309
|
+
return deepcopy(obj);
|
|
3310
|
+
};
|
|
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;
|
|
3240
3321
|
};
|
|
3241
|
-
|
|
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) {
|
|
3242
3388
|
if (!(window && window.document)) {
|
|
3243
|
-
return new Error("
|
|
3244
|
-
}
|
|
3245
|
-
var html = document.documentElement;
|
|
3246
|
-
html.style.overflow = "visible";
|
|
3247
|
-
html.style.height = "auto";
|
|
3248
|
-
var body = document.body;
|
|
3249
|
-
body.style.overflow = "visible";
|
|
3250
|
-
body.style.height = "auto";
|
|
3251
|
-
if (className) {
|
|
3252
|
-
var dom = document.querySelector(".".concat(className));
|
|
3253
|
-
dom && dom.removeEventListener("touchmove", _this.__setDefault__);
|
|
3389
|
+
return new Error("仅支持浏览器");
|
|
3254
3390
|
}
|
|
3391
|
+
var copy = requireClipboardCopy();
|
|
3392
|
+
return copy(str);
|
|
3255
3393
|
};
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
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;
|
|
3264
3403
|
}
|
|
3265
|
-
return
|
|
3404
|
+
return target.slice(0, length);
|
|
3266
3405
|
};
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
for (var key in obj) {
|
|
3271
|
-
if (obj.hasOwnProperty(key)) {
|
|
3272
|
-
result[obj[key]] = key;
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3406
|
+
ToolsClass2.prototype.guid = function() {
|
|
3407
|
+
function S4() {
|
|
3408
|
+
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
3275
3409
|
}
|
|
3276
|
-
return
|
|
3410
|
+
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
|
|
3277
3411
|
};
|
|
3278
|
-
|
|
3279
|
-
|
|
3412
|
+
ToolsClass2.prototype.getBytesOfText = function(str) {
|
|
3413
|
+
if (str === void 0) {
|
|
3414
|
+
str = "";
|
|
3415
|
+
}
|
|
3416
|
+
return str.replace(/[^\u0000-\u00ff]/g, "aa").length;
|
|
3280
3417
|
};
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
e && e.preventDefault();
|
|
3418
|
+
ToolsClass2.prototype.uniqueArr = function(arr) {
|
|
3419
|
+
return Array.from(new Set(arr));
|
|
3284
3420
|
};
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
ToolsClass2.prototype.deepCopy2 = function(obj) {
|
|
3290
|
-
var _obj = Array.isArray(obj) ? [] : {};
|
|
3291
|
-
for (var i in obj) {
|
|
3292
|
-
_obj[i] = typeof obj[i] === "object" ? this.deepCopy2(obj[i]) : obj[i];
|
|
3293
|
-
}
|
|
3294
|
-
return _obj;
|
|
3295
|
-
};
|
|
3296
|
-
ToolsClass2.prototype.deepCopy3 = function(obj) {
|
|
3297
|
-
var deepcopy = requireCloneDeep();
|
|
3298
|
-
return deepcopy(obj);
|
|
3299
|
-
};
|
|
3300
|
-
ToolsClass2.prototype.debounce = function(func, wait) {
|
|
3301
|
-
var delay = function() {
|
|
3302
|
-
var args = arguments;
|
|
3303
|
-
if (timeout)
|
|
3304
|
-
clearTimeout(timeout);
|
|
3305
|
-
timeout = setTimeout(function() {
|
|
3306
|
-
func.apply(delay, args);
|
|
3307
|
-
}, 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;
|
|
3308
3425
|
};
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
ToolsClass2.prototype.throttle = function(func, wait) {
|
|
3312
|
-
var delay = function() {
|
|
3313
|
-
var now = Date.now();
|
|
3314
|
-
if (now - previous > wait) {
|
|
3315
|
-
func.apply(delay, arguments);
|
|
3316
|
-
previous = now;
|
|
3317
|
-
}
|
|
3426
|
+
ToolsClass2.prototype.filterEmoji = function(str) {
|
|
3427
|
+
return str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg, "");
|
|
3318
3428
|
};
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
if (
|
|
3333
|
-
return
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
};
|
|
3350
|
-
ToolsClass2.prototype.loadCss = function(url) {
|
|
3351
|
-
var _this = this;
|
|
3352
|
-
if (!(window && window.document)) {
|
|
3353
|
-
return new Error("\u4EC5\u652F\u6301\u6D4F\u89C8\u5668");
|
|
3354
|
-
}
|
|
3355
|
-
var name = this.getUrlName(url);
|
|
3356
|
-
var id = "css_" + name;
|
|
3357
|
-
return new Promise(function(resolve, reject) {
|
|
3358
|
-
if (_this.__loaded__[id]) {
|
|
3359
|
-
return resolve();
|
|
3360
|
-
}
|
|
3361
|
-
var link = document.createElement("link");
|
|
3362
|
-
link.type = "text/css";
|
|
3363
|
-
link.rel = "stylesheet";
|
|
3364
|
-
link.href = url;
|
|
3365
|
-
link.id = id;
|
|
3366
|
-
link.onload = function() {
|
|
3367
|
-
_this.__loaded__[id] = true;
|
|
3368
|
-
resolve();
|
|
3369
|
-
};
|
|
3370
|
-
link.onerror = function(e) {
|
|
3371
|
-
reject(e);
|
|
3372
|
-
};
|
|
3373
|
-
document.head.appendChild(link);
|
|
3374
|
-
});
|
|
3375
|
-
};
|
|
3376
|
-
ToolsClass2.prototype.clipboard = function(str) {
|
|
3377
|
-
if (!(window && window.document)) {
|
|
3378
|
-
return new Error("\u4EC5\u652F\u6301\u6D4F\u89C8\u5668");
|
|
3379
|
-
}
|
|
3380
|
-
var copy = require_clipboardCopy_4_0_1_clipboardCopy();
|
|
3381
|
-
return copy(str);
|
|
3382
|
-
};
|
|
3383
|
-
ToolsClass2.prototype.firstUpperCase = function(str) {
|
|
3384
|
-
return str.charAt(0).toUpperCase() + str.toString().slice(1);
|
|
3385
|
-
};
|
|
3386
|
-
ToolsClass2.prototype.slice = function(target, length) {
|
|
3387
|
-
if (target === void 0) {
|
|
3388
|
-
target = "";
|
|
3389
|
-
}
|
|
3390
|
-
if (length === void 0) {
|
|
3391
|
-
length = 0;
|
|
3392
|
-
}
|
|
3393
|
-
return target.slice(0, length);
|
|
3394
|
-
};
|
|
3395
|
-
ToolsClass2.prototype.guid = function() {
|
|
3396
|
-
function S4() {
|
|
3397
|
-
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
3398
|
-
}
|
|
3399
|
-
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
|
|
3400
|
-
};
|
|
3401
|
-
ToolsClass2.prototype.getBytesOfText = function(str) {
|
|
3402
|
-
if (str === void 0) {
|
|
3403
|
-
str = "";
|
|
3404
|
-
}
|
|
3405
|
-
return str.replace(/[^\u0000-\u00ff]/g, "aa").length;
|
|
3406
|
-
};
|
|
3407
|
-
ToolsClass2.prototype.uniqueArr = function(arr) {
|
|
3408
|
-
return Array.from(new Set(arr));
|
|
3409
|
-
};
|
|
3410
|
-
ToolsClass2.prototype.swapArray = function(array, index1, index2) {
|
|
3411
|
-
var _a;
|
|
3412
|
-
_a = [array[index2], array[index1]], array[index1] = _a[0], array[index2] = _a[1];
|
|
3413
|
-
return array;
|
|
3414
|
-
};
|
|
3415
|
-
ToolsClass2.prototype.filterEmoji = function(str) {
|
|
3416
|
-
return str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg, "");
|
|
3417
|
-
};
|
|
3418
|
-
ToolsClass2.prototype.containsEmoji = function(str) {
|
|
3419
|
-
var reg = /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg;
|
|
3420
|
-
return reg.test(str);
|
|
3421
|
-
};
|
|
3422
|
-
ToolsClass2.prototype.containsHanZi = function(str) {
|
|
3423
|
-
var reg = /[\u4e00-\u9fa5]/mg;
|
|
3424
|
-
return reg.test(str);
|
|
3425
|
-
};
|
|
3426
|
-
ToolsClass2.prototype.isEmpty = function(val) {
|
|
3427
|
-
if (val == null)
|
|
3428
|
-
return true;
|
|
3429
|
-
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
|
+
}
|
|
3430
3459
|
return false;
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
switch (Object.prototype.toString.call(val)) {
|
|
3436
|
-
case "[object String]":
|
|
3437
|
-
case "[object Array]":
|
|
3438
|
-
return !val.length;
|
|
3439
|
-
case "[object File]":
|
|
3440
|
-
case "[object Map]":
|
|
3441
|
-
case "[object Set]": {
|
|
3442
|
-
return !val.size;
|
|
3443
|
-
}
|
|
3444
|
-
case "[object Object]": {
|
|
3445
|
-
return !Object.keys(val).length;
|
|
3460
|
+
};
|
|
3461
|
+
ToolsClass2.prototype.sensitiveField = function(field, before, after) {
|
|
3462
|
+
if (before === void 0) {
|
|
3463
|
+
before = 3;
|
|
3446
3464
|
}
|
|
3447
|
-
|
|
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
|
-
tools$1.exports = new ToolsClass();
|
|
3473
|
-
const tools = /* @__PURE__ */ getDefaultExportFromCjs(tools$1.exports);
|
|
3474
|
-
const index_vue_vue_type_style_index_0_lang$3 = "";
|
|
3475
|
-
const _hoisted_1$5 = { style: { "margin-left": "20px", "color": "#FF5A25" } };
|
|
3476
|
-
const _hoisted_2$5 = { class: "insert-article" };
|
|
3477
|
-
const _hoisted_3$5 = { class: "insert-article_input" };
|
|
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" };
|
|
3478
3490
|
const _hoisted_4$2 = {
|
|
3479
3491
|
key: 0,
|
|
3480
3492
|
class: "nodata"
|
|
@@ -3493,7 +3505,7 @@
|
|
|
3493
3505
|
key: 1,
|
|
3494
3506
|
style: { "display": "inline-flex", "flex-direction": "column" }
|
|
3495
3507
|
};
|
|
3496
|
-
const _sfc_main$
|
|
3508
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
3497
3509
|
__name: "index",
|
|
3498
3510
|
props: {
|
|
3499
3511
|
visible: { type: Boolean, default: false },
|
|
@@ -3501,7 +3513,7 @@
|
|
|
3501
3513
|
},
|
|
3502
3514
|
emits: ["change", "submit", "update:visible"],
|
|
3503
3515
|
setup(__props, { emit: __emit }) {
|
|
3504
|
-
const { debounce } = tools;
|
|
3516
|
+
const { debounce } = tools$1;
|
|
3505
3517
|
const vInfiniteScroll = elementPlus.ElInfiniteScroll;
|
|
3506
3518
|
const Radio_Type = {
|
|
3507
3519
|
MY_ARITICLE: "1",
|
|
@@ -3552,7 +3564,7 @@
|
|
|
3552
3564
|
};
|
|
3553
3565
|
const confirm = () => {
|
|
3554
3566
|
if (!data.article) {
|
|
3555
|
-
elementPlus.ElMessage.error(
|
|
3567
|
+
elementPlus.ElMessage.error(`请选择${isVideo ? "视频" : "文章"}`);
|
|
3556
3568
|
return;
|
|
3557
3569
|
}
|
|
3558
3570
|
data.article.isVideo = isVideo;
|
|
@@ -3569,11 +3581,14 @@
|
|
|
3569
3581
|
data.busy = true;
|
|
3570
3582
|
const userInfo = JSON.parse(localStorage.getItem("user")) || JSON.parse(localStorage.getItem("userInfo"));
|
|
3571
3583
|
const userId = userInfo.uid || userInfo.userid;
|
|
3584
|
+
if (!getList.value)
|
|
3585
|
+
return;
|
|
3572
3586
|
const res = await getList.value({
|
|
3573
3587
|
uid: data.params.radio !== Radio_Type.ALL_ARITICLE ? userId : "",
|
|
3574
3588
|
autherid: data.params.radio !== Radio_Type.ALL_ARITICLE ? userId : "",
|
|
3575
3589
|
limit: 20,
|
|
3576
3590
|
allType: data.params.radio,
|
|
3591
|
+
// 只有4 是查视频 其他是文章
|
|
3577
3592
|
title: data.params.title,
|
|
3578
3593
|
page: ++data.page
|
|
3579
3594
|
});
|
|
@@ -3587,27 +3602,27 @@
|
|
|
3587
3602
|
data.busy = false;
|
|
3588
3603
|
}, 1e3);
|
|
3589
3604
|
return (_ctx, _cache) => {
|
|
3590
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3605
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$7, {
|
|
3591
3606
|
visible: vue.unref(visible),
|
|
3592
3607
|
onSubmit: confirm
|
|
3593
3608
|
}, {
|
|
3594
3609
|
title: vue.withCtx(() => [
|
|
3595
3610
|
vue.createElementVNode("span", null, [
|
|
3596
|
-
vue.createTextVNode("
|
|
3597
|
-
vue.createElementVNode("strong", _hoisted_1$
|
|
3611
|
+
_cache[8] || (_cache[8] = vue.createTextVNode("插入文章/视频")),
|
|
3612
|
+
vue.createElementVNode("strong", _hoisted_1$6, "平台仅支持插入" + vue.toDisplayString(`${isVideo.value ? "2年" : "18个月"}`) + "内的推荐内容", 1)
|
|
3598
3613
|
])
|
|
3599
3614
|
]),
|
|
3600
3615
|
default: vue.withCtx(() => [
|
|
3601
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
3616
|
+
vue.createElementVNode("div", _hoisted_2$3, [
|
|
3602
3617
|
vue.createElementVNode("div", null, [
|
|
3603
3618
|
vue.createVNode(vue.unref(elementPlus.ElRadio), {
|
|
3604
3619
|
modelValue: data.params.radio,
|
|
3605
3620
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => data.params.radio = $event),
|
|
3606
3621
|
label: Radio_Type.MY_ARITICLE
|
|
3607
3622
|
}, {
|
|
3608
|
-
default: vue.withCtx(() => [
|
|
3609
|
-
vue.createTextVNode("
|
|
3610
|
-
]),
|
|
3623
|
+
default: vue.withCtx(() => _cache[9] || (_cache[9] = [
|
|
3624
|
+
vue.createTextVNode("从我的文章中选择")
|
|
3625
|
+
])),
|
|
3611
3626
|
_: 1
|
|
3612
3627
|
}, 8, ["modelValue", "label"]),
|
|
3613
3628
|
vue.createVNode(vue.unref(elementPlus.ElRadio), {
|
|
@@ -3615,9 +3630,9 @@
|
|
|
3615
3630
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => data.params.radio = $event),
|
|
3616
3631
|
label: Radio_Type.MY_VIDEO
|
|
3617
3632
|
}, {
|
|
3618
|
-
default: vue.withCtx(() => [
|
|
3619
|
-
vue.createTextVNode("
|
|
3620
|
-
]),
|
|
3633
|
+
default: vue.withCtx(() => _cache[10] || (_cache[10] = [
|
|
3634
|
+
vue.createTextVNode("从我的视频中选择")
|
|
3635
|
+
])),
|
|
3621
3636
|
_: 1
|
|
3622
3637
|
}, 8, ["modelValue", "label"]),
|
|
3623
3638
|
vue.createVNode(vue.unref(elementPlus.ElRadio), {
|
|
@@ -3625,17 +3640,17 @@
|
|
|
3625
3640
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => data.params.radio = $event),
|
|
3626
3641
|
label: Radio_Type.ALL_ARITICLE
|
|
3627
3642
|
}, {
|
|
3628
|
-
default: vue.withCtx(() => [
|
|
3629
|
-
vue.createTextVNode("
|
|
3630
|
-
]),
|
|
3643
|
+
default: vue.withCtx(() => _cache[11] || (_cache[11] = [
|
|
3644
|
+
vue.createTextVNode("从所有文章中选择")
|
|
3645
|
+
])),
|
|
3631
3646
|
_: 1
|
|
3632
3647
|
}, 8, ["modelValue", "label"])
|
|
3633
3648
|
]),
|
|
3634
|
-
vue.createElementVNode("div", _hoisted_3$
|
|
3649
|
+
vue.createElementVNode("div", _hoisted_3$3, [
|
|
3635
3650
|
vue.createVNode(vue.unref(elementPlus.ElInput), {
|
|
3636
3651
|
modelValue: data.params.title,
|
|
3637
3652
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => data.params.title = $event),
|
|
3638
|
-
placeholder: isVideo.value ? "
|
|
3653
|
+
placeholder: isVideo.value ? "输入视频描述查找平台发布过的视频" : "输入标题名查找平台发过的文章",
|
|
3639
3654
|
onKeyup: _cache[5] || (_cache[5] = vue.withKeys(($event) => vue.unref(getArticleList)(true), ["enter", "native"])),
|
|
3640
3655
|
onInput: _cache[6] || (_cache[6] = ($event) => vue.unref(getArticleList)(true))
|
|
3641
3656
|
}, {
|
|
@@ -3649,7 +3664,7 @@
|
|
|
3649
3664
|
_: 1
|
|
3650
3665
|
}, 8, ["modelValue", "placeholder"])
|
|
3651
3666
|
]),
|
|
3652
|
-
data.data.length === 0 && !data.busy ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, vue.toDisplayString(
|
|
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", {
|
|
3653
3668
|
key: 1,
|
|
3654
3669
|
"infinite-scroll-immediate": false,
|
|
3655
3670
|
class: "insert-article_list",
|
|
@@ -3681,12 +3696,12 @@
|
|
|
3681
3696
|
}, null, 8, _hoisted_9$1)
|
|
3682
3697
|
]),
|
|
3683
3698
|
vue.createElementVNode("div", _hoisted_10$1, [
|
|
3684
|
-
vue.createElementVNode("span", _hoisted_11$1, vue.toDisplayString(item.content || "[
|
|
3685
|
-
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(date).format(item.createTime * 1e3, "YYYY-MM-DD hh-mm")), 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)
|
|
3686
3701
|
])
|
|
3687
3702
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$1, [
|
|
3688
|
-
vue.createElementVNode("span", null, vue.toDisplayString(item.title || "[
|
|
3689
|
-
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(date).format(item.createTime * 1e3, "YYYY-MM-DD")), 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)
|
|
3690
3705
|
]))
|
|
3691
3706
|
];
|
|
3692
3707
|
}),
|
|
@@ -3704,6 +3719,7 @@
|
|
|
3704
3719
|
};
|
|
3705
3720
|
}
|
|
3706
3721
|
});
|
|
3722
|
+
const index_vue_vue_type_style_index_0_lang$4 = "";
|
|
3707
3723
|
let getRandomValues;
|
|
3708
3724
|
const rnds8 = new Uint8Array(16);
|
|
3709
3725
|
function rng() {
|
|
@@ -3743,10 +3759,9 @@
|
|
|
3743
3759
|
}
|
|
3744
3760
|
return unsafeStringify(rnds);
|
|
3745
3761
|
}
|
|
3746
|
-
const
|
|
3747
|
-
const
|
|
3748
|
-
const
|
|
3749
|
-
const _hoisted_3$4 = ["onClick"];
|
|
3762
|
+
const _hoisted_1$5 = { class: "img-upload-content" };
|
|
3763
|
+
const _hoisted_2$2 = { class: "title-box" };
|
|
3764
|
+
const _hoisted_3$2 = ["onClick"];
|
|
3750
3765
|
const _hoisted_4$1 = {
|
|
3751
3766
|
key: 0,
|
|
3752
3767
|
class: "line"
|
|
@@ -3775,41 +3790,38 @@
|
|
|
3775
3790
|
key: 0,
|
|
3776
3791
|
class: "upload-wrap"
|
|
3777
3792
|
};
|
|
3778
|
-
const _hoisted_14 =
|
|
3779
|
-
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);
|
|
3780
|
-
const _hoisted_16 = {
|
|
3793
|
+
const _hoisted_14 = {
|
|
3781
3794
|
key: 1,
|
|
3782
3795
|
class: "img-list"
|
|
3783
3796
|
};
|
|
3784
|
-
const
|
|
3785
|
-
const
|
|
3786
|
-
const
|
|
3797
|
+
const _hoisted_15 = ["src"];
|
|
3798
|
+
const _hoisted_16 = { class: "upload-btn" };
|
|
3799
|
+
const _hoisted_17 = {
|
|
3787
3800
|
key: 2,
|
|
3788
3801
|
class: "map-depot"
|
|
3789
3802
|
};
|
|
3790
|
-
const
|
|
3791
|
-
const
|
|
3792
|
-
const
|
|
3793
|
-
const
|
|
3794
|
-
const
|
|
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 = {
|
|
3795
3808
|
key: 0,
|
|
3796
3809
|
class: "line"
|
|
3797
3810
|
};
|
|
3798
|
-
const
|
|
3799
|
-
const
|
|
3800
|
-
const
|
|
3801
|
-
const
|
|
3811
|
+
const _hoisted_23 = { class: "image-list depot-image" };
|
|
3812
|
+
const _hoisted_24 = ["onClick"];
|
|
3813
|
+
const _hoisted_25 = ["src"];
|
|
3814
|
+
const _hoisted_26 = {
|
|
3802
3815
|
key: 0,
|
|
3803
3816
|
class: "shade"
|
|
3804
3817
|
};
|
|
3805
|
-
const
|
|
3806
|
-
const
|
|
3818
|
+
const _hoisted_27 = { class: "num" };
|
|
3819
|
+
const _hoisted_28 = {
|
|
3807
3820
|
key: 1,
|
|
3808
3821
|
class: "protocol-box"
|
|
3809
3822
|
};
|
|
3810
|
-
const
|
|
3811
|
-
const
|
|
3812
|
-
const _sfc_main$4 = vue.defineComponent({
|
|
3823
|
+
const _hoisted_29 = ["href"];
|
|
3824
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
3813
3825
|
__name: "index",
|
|
3814
3826
|
props: {
|
|
3815
3827
|
visible: { type: Boolean, default: false },
|
|
@@ -3844,7 +3856,7 @@
|
|
|
3844
3856
|
const tempImgs = [...props.imgList];
|
|
3845
3857
|
Array.from(imgFile).forEach((file) => {
|
|
3846
3858
|
if (file.size > 20 * 1024 * 1024) {
|
|
3847
|
-
elementPlus.ElMessage.error("
|
|
3859
|
+
elementPlus.ElMessage.error("单张图片最大支持20M");
|
|
3848
3860
|
return;
|
|
3849
3861
|
}
|
|
3850
3862
|
const id = v4();
|
|
@@ -3874,14 +3886,14 @@
|
|
|
3874
3886
|
const list = [
|
|
3875
3887
|
{
|
|
3876
3888
|
id: 2,
|
|
3877
|
-
value: "
|
|
3889
|
+
value: "上传图片"
|
|
3878
3890
|
}
|
|
3879
3891
|
];
|
|
3880
3892
|
activeTitle.value = 2;
|
|
3881
3893
|
if (props.imgNum < 20) {
|
|
3882
3894
|
list.unshift({
|
|
3883
3895
|
id: 1,
|
|
3884
|
-
value: "
|
|
3896
|
+
value: "正文图片"
|
|
3885
3897
|
});
|
|
3886
3898
|
activeTitle.value = 1;
|
|
3887
3899
|
getContentImgList();
|
|
@@ -3889,7 +3901,7 @@
|
|
|
3889
3901
|
if (props.chartGallery) {
|
|
3890
3902
|
list.push({
|
|
3891
3903
|
id: 3,
|
|
3892
|
-
value: isEmotofine ? "
|
|
3904
|
+
value: isEmotofine ? "电摩范图库" : "摩托范图库"
|
|
3893
3905
|
});
|
|
3894
3906
|
}
|
|
3895
3907
|
titleList.value = list;
|
|
@@ -4034,13 +4046,13 @@
|
|
|
4034
4046
|
const tabList = vue.ref([]);
|
|
4035
4047
|
const search = () => {
|
|
4036
4048
|
if (!selectData.brandId) {
|
|
4037
|
-
return elementPlus.ElMessage.error("
|
|
4049
|
+
return elementPlus.ElMessage.error("请选择品牌");
|
|
4038
4050
|
}
|
|
4039
4051
|
if (!selectData.goodId) {
|
|
4040
|
-
return elementPlus.ElMessage.error("
|
|
4052
|
+
return elementPlus.ElMessage.error("请选择车型");
|
|
4041
4053
|
}
|
|
4042
4054
|
if (!selectData.carId) {
|
|
4043
|
-
return elementPlus.ElMessage.error("
|
|
4055
|
+
return elementPlus.ElMessage.error("请选择款型");
|
|
4044
4056
|
}
|
|
4045
4057
|
tabList.value = [];
|
|
4046
4058
|
emits("update:imgList", []);
|
|
@@ -4091,13 +4103,13 @@
|
|
|
4091
4103
|
emits("update:imgList", list);
|
|
4092
4104
|
};
|
|
4093
4105
|
return (_ctx, _cache) => {
|
|
4094
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4106
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$7, {
|
|
4095
4107
|
visible: props.visible,
|
|
4096
4108
|
showTitle: false
|
|
4097
4109
|
}, {
|
|
4098
4110
|
default: vue.withCtx(() => [
|
|
4099
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4100
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
4111
|
+
vue.createElementVNode("div", _hoisted_1$5, [
|
|
4112
|
+
vue.createElementVNode("div", _hoisted_2$2, [
|
|
4101
4113
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(titleList.value, (item, index) => {
|
|
4102
4114
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4103
4115
|
key: index,
|
|
@@ -4106,10 +4118,10 @@
|
|
|
4106
4118
|
}, [
|
|
4107
4119
|
vue.createTextVNode(vue.toDisplayString(item.value) + " ", 1),
|
|
4108
4120
|
item.id === activeTitle.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1)) : vue.createCommentVNode("", true)
|
|
4109
|
-
], 10, _hoisted_3$
|
|
4121
|
+
], 10, _hoisted_3$2);
|
|
4110
4122
|
}), 128)),
|
|
4111
|
-
[1, 3].includes(activeTitle.value) && props.imgList.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, "
|
|
4112
|
-
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)
|
|
4113
4125
|
]),
|
|
4114
4126
|
activeTitle.value === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
|
|
4115
4127
|
vue.createElementVNode("div", _hoisted_8, [
|
|
@@ -4146,11 +4158,11 @@
|
|
|
4146
4158
|
]),
|
|
4147
4159
|
_: 1
|
|
4148
4160
|
}),
|
|
4149
|
-
|
|
4161
|
+
_cache[7] || (_cache[7] = vue.createElementVNode("span", null, "本地上传", -1))
|
|
4150
4162
|
]),
|
|
4151
|
-
|
|
4152
|
-
])) : (vue.openBlock(), vue.createElementBlock("div",
|
|
4153
|
-
vue.createVNode(vue.unref(
|
|
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), {
|
|
4154
4166
|
modelValue: imgListTemp.value,
|
|
4155
4167
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => imgListTemp.value = $event),
|
|
4156
4168
|
handle: ".img-item",
|
|
@@ -4170,7 +4182,7 @@
|
|
|
4170
4182
|
style: { "object-fit": "contain" },
|
|
4171
4183
|
width: "120",
|
|
4172
4184
|
height: "120"
|
|
4173
|
-
}, null, 8,
|
|
4185
|
+
}, null, 8, _hoisted_15),
|
|
4174
4186
|
vue.createVNode(vue.unref(iconsVue.CircleCloseFilled), {
|
|
4175
4187
|
class: "icon pointer",
|
|
4176
4188
|
onClick: ($event) => deleteImg(element)
|
|
@@ -4193,7 +4205,7 @@
|
|
|
4193
4205
|
_: 1
|
|
4194
4206
|
}, 8, ["modelValue"])
|
|
4195
4207
|
])),
|
|
4196
|
-
vue.createElementVNode("div",
|
|
4208
|
+
vue.createElementVNode("div", _hoisted_16, [
|
|
4197
4209
|
vue.createElementVNode("input", {
|
|
4198
4210
|
type: "file",
|
|
4199
4211
|
name: "file",
|
|
@@ -4204,13 +4216,13 @@
|
|
|
4204
4216
|
}, null, 32)
|
|
4205
4217
|
])
|
|
4206
4218
|
], 2)) : vue.createCommentVNode("", true),
|
|
4207
|
-
activeTitle.value === 3 ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4208
|
-
vue.createElementVNode("div",
|
|
4219
|
+
activeTitle.value === 3 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17, [
|
|
4220
|
+
vue.createElementVNode("div", _hoisted_18, [
|
|
4209
4221
|
vue.createElementVNode("div", null, [
|
|
4210
4222
|
vue.createVNode(vue.unref(elementPlus.ElSelect), {
|
|
4211
4223
|
modelValue: selectData.brandId,
|
|
4212
4224
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => selectData.brandId = $event),
|
|
4213
|
-
placeholder: "
|
|
4225
|
+
placeholder: "请选择品牌",
|
|
4214
4226
|
size: "large",
|
|
4215
4227
|
class: "select_1",
|
|
4216
4228
|
filterable: "",
|
|
@@ -4231,7 +4243,7 @@
|
|
|
4231
4243
|
vue.createVNode(vue.unref(elementPlus.ElSelect), {
|
|
4232
4244
|
modelValue: selectData.goodId,
|
|
4233
4245
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => selectData.goodId = $event),
|
|
4234
|
-
placeholder: "
|
|
4246
|
+
placeholder: "请选择车型",
|
|
4235
4247
|
size: "large",
|
|
4236
4248
|
class: "select_1",
|
|
4237
4249
|
filterable: "",
|
|
@@ -4252,7 +4264,7 @@
|
|
|
4252
4264
|
vue.createVNode(vue.unref(elementPlus.ElSelect), {
|
|
4253
4265
|
modelValue: selectData.carId,
|
|
4254
4266
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => selectData.carId = $event),
|
|
4255
|
-
placeholder: "
|
|
4267
|
+
placeholder: "请选择款型",
|
|
4256
4268
|
size: "large",
|
|
4257
4269
|
class: "select_2",
|
|
4258
4270
|
filterable: "",
|
|
@@ -4276,14 +4288,14 @@
|
|
|
4276
4288
|
style: { "width": "80px" },
|
|
4277
4289
|
onClick: search
|
|
4278
4290
|
}, {
|
|
4279
|
-
default: vue.withCtx(() => [
|
|
4280
|
-
vue.createTextVNode("
|
|
4281
|
-
]),
|
|
4291
|
+
default: vue.withCtx(() => _cache[9] || (_cache[9] = [
|
|
4292
|
+
vue.createTextVNode("搜索")
|
|
4293
|
+
])),
|
|
4282
4294
|
_: 1
|
|
4283
4295
|
})
|
|
4284
4296
|
]),
|
|
4285
|
-
tabList.value && tabList.value.length ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4286
|
-
vue.createElementVNode("div",
|
|
4297
|
+
tabList.value && tabList.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_19, [
|
|
4298
|
+
vue.createElementVNode("div", _hoisted_20, [
|
|
4287
4299
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tabList.value, (item, index) => {
|
|
4288
4300
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4289
4301
|
key: index,
|
|
@@ -4291,11 +4303,11 @@
|
|
|
4291
4303
|
onClick: ($event) => activeTab.value = item.type
|
|
4292
4304
|
}, [
|
|
4293
4305
|
vue.createTextVNode(vue.toDisplayString(item.name) + " ", 1),
|
|
4294
|
-
item.type === activeTab.value ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4295
|
-
], 10,
|
|
4306
|
+
item.type === activeTab.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_22)) : vue.createCommentVNode("", true)
|
|
4307
|
+
], 10, _hoisted_21);
|
|
4296
4308
|
}), 128))
|
|
4297
4309
|
]),
|
|
4298
|
-
vue.createElementVNode("div",
|
|
4310
|
+
vue.createElementVNode("div", _hoisted_23, [
|
|
4299
4311
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(imageList.value, (item, index) => {
|
|
4300
4312
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4301
4313
|
key: index,
|
|
@@ -4306,25 +4318,25 @@
|
|
|
4306
4318
|
src: item.imgOrgUrl,
|
|
4307
4319
|
alt: "",
|
|
4308
4320
|
class: "image"
|
|
4309
|
-
}, null, 8,
|
|
4310
|
-
item.num ? (vue.openBlock(), vue.createElementBlock("div",
|
|
4311
|
-
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)
|
|
4312
4324
|
])) : vue.createCommentVNode("", true)
|
|
4313
|
-
], 8,
|
|
4325
|
+
], 8, _hoisted_24);
|
|
4314
4326
|
}), 128))
|
|
4315
4327
|
])
|
|
4316
|
-
])) : (vue.openBlock(), vue.createElementBlock("div",
|
|
4328
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_28, [
|
|
4317
4329
|
vue.createElementVNode("div", null, [
|
|
4318
|
-
|
|
4330
|
+
_cache[12] || (_cache[12] = vue.createElementVNode("div", null, " 图库中的图片仅限下载摩托范以编辑发布文章使用,不得用于其他任何平台及用途 ", -1)),
|
|
4319
4331
|
vue.createElementVNode("div", null, [
|
|
4320
|
-
vue.createTextVNode("
|
|
4332
|
+
_cache[10] || (_cache[10] = vue.createTextVNode(" 请阅读")),
|
|
4321
4333
|
vue.createElementVNode("a", {
|
|
4322
4334
|
href: `https://${vue.unref(hostName)}/about?type=imageLicenseAgreement`,
|
|
4323
4335
|
target: "_blank",
|
|
4324
4336
|
rel: "noopener noreferrer",
|
|
4325
4337
|
class: "link"
|
|
4326
|
-
}, "
|
|
4327
|
-
vue.createTextVNode("
|
|
4338
|
+
}, "《摩托范图片许可使用协议》", 8, _hoisted_29),
|
|
4339
|
+
_cache[11] || (_cache[11] = vue.createTextVNode(",您的行为视为您已同意该协议。 "))
|
|
4328
4340
|
])
|
|
4329
4341
|
])
|
|
4330
4342
|
]))
|
|
@@ -4336,11 +4348,9 @@
|
|
|
4336
4348
|
};
|
|
4337
4349
|
}
|
|
4338
4350
|
});
|
|
4339
|
-
const index_vue_vue_type_style_index_0_lang$
|
|
4340
|
-
const _hoisted_1$
|
|
4341
|
-
const
|
|
4342
|
-
const _hoisted_3$3 = /* @__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);
|
|
4343
|
-
const _sfc_main$3 = vue.defineComponent({
|
|
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({
|
|
4344
4354
|
__name: "index",
|
|
4345
4355
|
props: {
|
|
4346
4356
|
visible: { type: Boolean, default: false },
|
|
@@ -4362,29 +4372,29 @@
|
|
|
4362
4372
|
ele[0].dispatchEvent(event);
|
|
4363
4373
|
};
|
|
4364
4374
|
return (_ctx, _cache) => {
|
|
4365
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4375
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$7, {
|
|
4366
4376
|
"show-btn": false,
|
|
4367
4377
|
visible: vue.unref(visible),
|
|
4368
4378
|
width: "600px",
|
|
4369
4379
|
height: "100px"
|
|
4370
4380
|
}, {
|
|
4371
|
-
title: vue.withCtx(() => [
|
|
4372
|
-
|
|
4373
|
-
]),
|
|
4381
|
+
title: vue.withCtx(() => _cache[1] || (_cache[1] = [
|
|
4382
|
+
vue.createElementVNode("span", null, "插入视频", -1)
|
|
4383
|
+
])),
|
|
4374
4384
|
default: vue.withCtx(() => [
|
|
4375
|
-
vue.createElementVNode("div",
|
|
4385
|
+
vue.createElementVNode("div", _hoisted_1$4, [
|
|
4376
4386
|
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
4377
4387
|
style: { "width": "120px" },
|
|
4378
4388
|
round: "",
|
|
4379
4389
|
type: "primary",
|
|
4380
4390
|
onClick: emitEvent
|
|
4381
4391
|
}, {
|
|
4382
|
-
default: vue.withCtx(() => [
|
|
4383
|
-
vue.createTextVNode("
|
|
4384
|
-
]),
|
|
4392
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
4393
|
+
vue.createTextVNode("选择视频")
|
|
4394
|
+
])),
|
|
4385
4395
|
_: 1
|
|
4386
4396
|
}),
|
|
4387
|
-
|
|
4397
|
+
_cache[3] || (_cache[3] = vue.createElementVNode("span", { class: "remark" }, "为了获得更高的推荐量和点击量,建议上传720p(1280*720)或更高分辨率的视频,视频格式为.mp4或.mov,大小不超过1G", -1)),
|
|
4388
4398
|
vue.createElementVNode("input", {
|
|
4389
4399
|
type: "file",
|
|
4390
4400
|
accept: "video/*",
|
|
@@ -4399,121 +4409,964 @@
|
|
|
4399
4409
|
};
|
|
4400
4410
|
}
|
|
4401
4411
|
});
|
|
4402
|
-
const index_vue_vue_type_style_index_0_lang = "";
|
|
4403
|
-
const
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
vm: this
|
|
4407
|
-
};
|
|
4408
|
-
},
|
|
4409
|
-
components: {
|
|
4410
|
-
ElInput: elementPlus.ElInput,
|
|
4411
|
-
BasicDialog: _sfc_main$6,
|
|
4412
|
-
draggable: draggable__default.default
|
|
4413
|
-
},
|
|
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",
|
|
4414
4416
|
props: {
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
linkContent: {
|
|
4420
|
-
type: String,
|
|
4421
|
-
default: ""
|
|
4417
|
+
// 编辑器DOM引用
|
|
4418
|
+
editorDom: {
|
|
4419
|
+
type: Object,
|
|
4420
|
+
default: null
|
|
4422
4421
|
},
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4422
|
+
// 话题API请求方法
|
|
4423
|
+
request: {
|
|
4424
|
+
type: Object,
|
|
4425
|
+
default: null
|
|
4427
4426
|
}
|
|
4428
4427
|
},
|
|
4429
4428
|
data() {
|
|
4430
|
-
return {
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
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
|
+
// 用于增量更新的计数器
|
|
4448
|
+
newHotTopicsCount: 0,
|
|
4449
|
+
newSearchTopicsCount: 0,
|
|
4450
|
+
// 保存原始的selection和range信息
|
|
4451
|
+
originalRange: null,
|
|
4452
|
+
originalSelection: null,
|
|
4453
|
+
// 保存触发位置信息
|
|
4454
|
+
triggerInfo: {
|
|
4455
|
+
paragraph: null,
|
|
4456
|
+
hashIndex: -1,
|
|
4457
|
+
cursorPosition: 0
|
|
4458
|
+
},
|
|
4459
|
+
// 全局弹框DOM引用
|
|
4460
|
+
globalContainer: null,
|
|
4461
|
+
globalMask: null
|
|
4439
4462
|
}
|
|
4440
|
-
}
|
|
4441
|
-
},
|
|
4442
|
-
mounted() {
|
|
4463
|
+
};
|
|
4443
4464
|
},
|
|
4444
4465
|
methods: {
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4466
|
+
// 初始化话题管理器
|
|
4467
|
+
init() {
|
|
4468
|
+
if (!this.editorDom) {
|
|
4469
|
+
console.warn("TopicManager: editorDom is required");
|
|
4470
|
+
return;
|
|
4471
|
+
}
|
|
4472
|
+
setTimeout(() => this.bindEditorEvents(), 0);
|
|
4449
4473
|
},
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
])
|
|
4481
|
-
]),
|
|
4482
|
-
_: 1
|
|
4483
|
-
}, 8, ["visible"]);
|
|
4484
|
-
}
|
|
4485
|
-
const CollectArticle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
4486
|
-
const index_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
4487
|
-
const _sfc_main$1 = {
|
|
4488
|
-
components: {
|
|
4489
|
-
ElIconError: iconsVue.CircleCloseFilled
|
|
4490
|
-
},
|
|
4491
|
-
props: {
|
|
4492
|
-
article: {
|
|
4493
|
-
type: Object,
|
|
4494
|
-
default: () => ({})
|
|
4495
|
-
}
|
|
4496
|
-
},
|
|
4497
|
-
methods: {
|
|
4498
|
-
close(e) {
|
|
4499
|
-
let child = e.target;
|
|
4500
|
-
while (child) {
|
|
4501
|
-
if (child.dataset.article) {
|
|
4502
|
-
child.parentNode.removeChild(child);
|
|
4503
|
-
break;
|
|
4474
|
+
// 绑定编辑器事件
|
|
4475
|
+
bindEditorEvents() {
|
|
4476
|
+
if (!this.editorDom)
|
|
4477
|
+
return;
|
|
4478
|
+
this.editorDom.addEventListener("keydown", this.handleTopicInput.bind(this));
|
|
4479
|
+
},
|
|
4480
|
+
// 解绑编辑器事件
|
|
4481
|
+
unbindEditorEvents() {
|
|
4482
|
+
if (!this.editorDom)
|
|
4483
|
+
return;
|
|
4484
|
+
this.editorDom.removeEventListener("keydown", this.handleTopicInput.bind(this));
|
|
4485
|
+
},
|
|
4486
|
+
// 话题输入处理
|
|
4487
|
+
handleTopicInput(event) {
|
|
4488
|
+
var _a;
|
|
4489
|
+
const activeElement = document.activeElement;
|
|
4490
|
+
if (activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA")) {
|
|
4491
|
+
return;
|
|
4492
|
+
}
|
|
4493
|
+
const selection = window.getSelection();
|
|
4494
|
+
if (selection.rangeCount === 0)
|
|
4495
|
+
return;
|
|
4496
|
+
const range = selection.getRangeAt(0);
|
|
4497
|
+
const container = range.startContainer;
|
|
4498
|
+
if (!this.editorDom.contains(container))
|
|
4499
|
+
return;
|
|
4500
|
+
let currentNode = container;
|
|
4501
|
+
while (currentNode && currentNode !== this.editorDom) {
|
|
4502
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.tagName === "MDD-TOPIC") {
|
|
4503
|
+
return;
|
|
4504
4504
|
}
|
|
4505
|
-
|
|
4505
|
+
currentNode = currentNode.parentNode;
|
|
4506
4506
|
}
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4507
|
+
let paragraph = container;
|
|
4508
|
+
while (paragraph && paragraph.nodeType !== Node.ELEMENT_NODE) {
|
|
4509
|
+
paragraph = paragraph.parentNode;
|
|
4510
|
+
}
|
|
4511
|
+
while (paragraph && !((_a = paragraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
4512
|
+
paragraph = paragraph.parentNode;
|
|
4513
|
+
}
|
|
4514
|
+
if (!paragraph)
|
|
4515
|
+
return;
|
|
4516
|
+
const { textContent: paragraphText, cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
4517
|
+
if (event.key === "#") {
|
|
4518
|
+
const afterCursor = paragraphText.substring(cursorPosition);
|
|
4519
|
+
if (afterCursor.length > 0 && afterCursor[0] === " ") {
|
|
4520
|
+
return;
|
|
4521
|
+
}
|
|
4522
|
+
setTimeout(() => {
|
|
4523
|
+
const position = this.getCaretPosition();
|
|
4524
|
+
const triggerInfo = {
|
|
4525
|
+
paragraph,
|
|
4526
|
+
hashIndex: cursorPosition,
|
|
4527
|
+
// #号的位置
|
|
4528
|
+
cursorPosition: cursorPosition + 1
|
|
4529
|
+
// #号后的位置
|
|
4530
|
+
};
|
|
4531
|
+
this.showTopicPopover("hot", position, "", triggerInfo);
|
|
4532
|
+
}, 10);
|
|
4533
|
+
} else if (this.shouldTriggerSearch(event.key)) {
|
|
4534
|
+
setTimeout(() => {
|
|
4535
|
+
this.checkAndTriggerSearch(paragraph);
|
|
4536
|
+
}, 10);
|
|
4537
|
+
} else {
|
|
4538
|
+
this.hideTopicPopover();
|
|
4539
|
+
}
|
|
4540
|
+
},
|
|
4541
|
+
shouldTriggerSearch(key) {
|
|
4542
|
+
return key.length === 1 || key === "Backspace" || key === "Delete";
|
|
4543
|
+
},
|
|
4544
|
+
checkAndTriggerSearch(paragraph) {
|
|
4545
|
+
const selection = window.getSelection();
|
|
4546
|
+
if (selection.rangeCount === 0)
|
|
4547
|
+
return;
|
|
4548
|
+
const range = selection.getRangeAt(0);
|
|
4549
|
+
let currentNode = range.startContainer;
|
|
4550
|
+
while (currentNode && currentNode !== paragraph) {
|
|
4551
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.tagName === "MDD-TOPIC") {
|
|
4552
|
+
this.hideTopicPopover();
|
|
4553
|
+
return;
|
|
4554
|
+
}
|
|
4555
|
+
currentNode = currentNode.parentNode;
|
|
4556
|
+
}
|
|
4557
|
+
const { textContent: paragraphText, cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
4558
|
+
const beforeCursor = paragraphText.substring(0, cursorPosition);
|
|
4559
|
+
const hashIndex = beforeCursor.lastIndexOf("#");
|
|
4560
|
+
if (hashIndex !== -1) {
|
|
4561
|
+
const afterHash = beforeCursor.substring(hashIndex + 1).replace(/\u00A0/g, " ");
|
|
4562
|
+
if (afterHash.indexOf(" ") === -1) {
|
|
4563
|
+
if (afterHash.length <= 15) {
|
|
4564
|
+
const position = this.getCaretPosition();
|
|
4565
|
+
const triggerInfo = {
|
|
4566
|
+
paragraph,
|
|
4567
|
+
hashIndex,
|
|
4568
|
+
cursorPosition
|
|
4569
|
+
};
|
|
4570
|
+
if (afterHash.length === 0) {
|
|
4571
|
+
this.showTopicPopover("hot", position, "", triggerInfo);
|
|
4572
|
+
} else {
|
|
4573
|
+
this.showTopicPopover("search", position, afterHash, triggerInfo);
|
|
4574
|
+
}
|
|
4575
|
+
} else if (afterHash.length > 15) {
|
|
4576
|
+
this.hideTopicPopover();
|
|
4577
|
+
}
|
|
4578
|
+
} else {
|
|
4579
|
+
this.hideTopicPopover();
|
|
4580
|
+
}
|
|
4581
|
+
} else {
|
|
4582
|
+
this.hideTopicPopover();
|
|
4583
|
+
}
|
|
4584
|
+
},
|
|
4585
|
+
getParagraphTextExcludingTopics(paragraph, range) {
|
|
4586
|
+
let textContent = "";
|
|
4587
|
+
let cursorPosition = 0;
|
|
4588
|
+
let foundCursor = false;
|
|
4589
|
+
const walker = document.createTreeWalker(
|
|
4590
|
+
paragraph,
|
|
4591
|
+
NodeFilter.SHOW_ALL,
|
|
4592
|
+
{
|
|
4593
|
+
acceptNode: function(node2) {
|
|
4594
|
+
if (node2.nodeType === Node.ELEMENT_NODE && node2.tagName === "MDD-TOPIC") {
|
|
4595
|
+
return NodeFilter.FILTER_REJECT;
|
|
4596
|
+
}
|
|
4597
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
4598
|
+
}
|
|
4599
|
+
},
|
|
4600
|
+
false
|
|
4601
|
+
);
|
|
4602
|
+
let node;
|
|
4603
|
+
while (node = walker.nextNode()) {
|
|
4604
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
4605
|
+
const nodeText = node.textContent;
|
|
4606
|
+
if (!foundCursor && node === range.startContainer) {
|
|
4607
|
+
cursorPosition = textContent.length + range.startOffset;
|
|
4608
|
+
foundCursor = true;
|
|
4609
|
+
}
|
|
4610
|
+
textContent += nodeText;
|
|
4611
|
+
}
|
|
4612
|
+
}
|
|
4613
|
+
return { textContent, cursorPosition };
|
|
4614
|
+
},
|
|
4615
|
+
getCaretPosition() {
|
|
4616
|
+
const selection = window.getSelection();
|
|
4617
|
+
if (selection.rangeCount === 0)
|
|
4618
|
+
return { top: 0, left: 0 };
|
|
4619
|
+
const range = selection.getRangeAt(0);
|
|
4620
|
+
const tempElement = document.createElement("span");
|
|
4621
|
+
tempElement.style.position = "absolute";
|
|
4622
|
+
tempElement.style.visibility = "hidden";
|
|
4623
|
+
tempElement.style.pointerEvents = "none";
|
|
4624
|
+
tempElement.style.whiteSpace = "nowrap";
|
|
4625
|
+
tempElement.textContent = "|";
|
|
4626
|
+
try {
|
|
4627
|
+
const clonedRange = range.cloneRange();
|
|
4628
|
+
clonedRange.collapse(true);
|
|
4629
|
+
clonedRange.insertNode(tempElement);
|
|
4630
|
+
const rect = tempElement.getBoundingClientRect();
|
|
4631
|
+
tempElement.remove();
|
|
4632
|
+
const position = {
|
|
4633
|
+
top: rect.bottom,
|
|
4634
|
+
// 弹框显示在光标下方
|
|
4635
|
+
left: rect.left
|
|
4636
|
+
};
|
|
4637
|
+
const viewportWidth = window.innerWidth;
|
|
4638
|
+
const viewportHeight = window.innerHeight;
|
|
4639
|
+
const popoverWidth = 430;
|
|
4640
|
+
const popoverHeight = 286;
|
|
4641
|
+
if (position.left + popoverWidth > viewportWidth) {
|
|
4642
|
+
position.left = Math.max(10, viewportWidth - popoverWidth - 10);
|
|
4643
|
+
}
|
|
4644
|
+
if (position.top + popoverHeight > viewportHeight) {
|
|
4645
|
+
position.top = rect.top - popoverHeight;
|
|
4646
|
+
if (position.top < 0) {
|
|
4647
|
+
position.top = Math.min(rect.bottom, viewportHeight - popoverHeight - 10);
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
return position;
|
|
4651
|
+
} catch (error) {
|
|
4652
|
+
console.warn("获取光标位置失败,使用fallback方法:", error);
|
|
4653
|
+
const rect = range.getBoundingClientRect();
|
|
4654
|
+
return {
|
|
4655
|
+
top: rect.bottom,
|
|
4656
|
+
left: Math.max(10, rect.left)
|
|
4657
|
+
};
|
|
4658
|
+
}
|
|
4659
|
+
},
|
|
4660
|
+
// 话题弹框相关方法
|
|
4661
|
+
showTopicPopover(type, position, searchKeyword = "", triggerInfo = null) {
|
|
4662
|
+
if (!this.request || !this.request.getTopic) {
|
|
4663
|
+
console.warn("话题功能需要提供 request.getTopic 方法");
|
|
4664
|
+
return;
|
|
4665
|
+
}
|
|
4666
|
+
const selection = window.getSelection();
|
|
4667
|
+
if (selection.rangeCount > 0) {
|
|
4668
|
+
this.topicPopover.originalRange = selection.getRangeAt(0).cloneRange();
|
|
4669
|
+
this.topicPopover.originalSelection = selection;
|
|
4670
|
+
}
|
|
4671
|
+
if (triggerInfo) {
|
|
4672
|
+
this.topicPopover.triggerInfo = triggerInfo;
|
|
4673
|
+
}
|
|
4674
|
+
this.topicPopover.visible = true;
|
|
4675
|
+
this.topicPopover.type = type;
|
|
4676
|
+
this.topicPopover.position = position;
|
|
4677
|
+
this.topicPopover.searchKeyword = searchKeyword;
|
|
4678
|
+
if (type === "hot") {
|
|
4679
|
+
this.topicPopover.activeTab = "hot";
|
|
4680
|
+
this.loadHotTopics();
|
|
4681
|
+
this.loadRecentTopics();
|
|
4682
|
+
} else if (type === "search") {
|
|
4683
|
+
this.searchTopics(searchKeyword);
|
|
4684
|
+
}
|
|
4685
|
+
this.createGlobalTopicPopover();
|
|
4686
|
+
},
|
|
4687
|
+
hideTopicPopover() {
|
|
4688
|
+
this.topicPopover.visible = false;
|
|
4689
|
+
this.topicPopover.hotTopics = [];
|
|
4690
|
+
this.topicPopover.searchTopics = [];
|
|
4691
|
+
this.topicPopover.page = 1;
|
|
4692
|
+
this.topicPopover.searchPage = 1;
|
|
4693
|
+
this.topicPopover.hasMore = true;
|
|
4694
|
+
this.topicPopover.searchHasMore = true;
|
|
4695
|
+
this.topicPopover.originalRange = null;
|
|
4696
|
+
this.topicPopover.originalSelection = null;
|
|
4697
|
+
this.topicPopover.triggerInfo = {
|
|
4698
|
+
paragraph: null,
|
|
4699
|
+
hashIndex: -1,
|
|
4700
|
+
cursorPosition: 0
|
|
4701
|
+
};
|
|
4702
|
+
this.removeGlobalTopicPopover();
|
|
4703
|
+
},
|
|
4704
|
+
switchTopicTab(tab) {
|
|
4705
|
+
this.topicPopover.activeTab = tab;
|
|
4706
|
+
this.updateGlobalTopicPopover();
|
|
4707
|
+
},
|
|
4708
|
+
async loadHotTopics() {
|
|
4709
|
+
if (this.topicPopover.loading || !this.topicPopover.hasMore)
|
|
4710
|
+
return;
|
|
4711
|
+
this.topicPopover.loading = true;
|
|
4712
|
+
try {
|
|
4713
|
+
const response = await this.request.getTopic({
|
|
4714
|
+
action: "201023",
|
|
4715
|
+
page: this.topicPopover.page,
|
|
4716
|
+
limit: 50,
|
|
4717
|
+
hoopId: 0,
|
|
4718
|
+
type: 0,
|
|
4719
|
+
orderBy: "view"
|
|
4720
|
+
});
|
|
4721
|
+
if (response && response.data && response.data.code === 0) {
|
|
4722
|
+
const topics = response.data.data || [];
|
|
4723
|
+
if (topics.length === 0) {
|
|
4724
|
+
this.topicPopover.hasMore = false;
|
|
4725
|
+
} else {
|
|
4726
|
+
const existingIds = new Set(this.topicPopover.hotTopics.map((t) => t.id));
|
|
4727
|
+
const newTopics = topics.filter((t) => !existingIds.has(t.id));
|
|
4728
|
+
this.topicPopover.newHotTopicsCount = newTopics.length;
|
|
4729
|
+
this.topicPopover.hotTopics.push(...newTopics);
|
|
4730
|
+
this.topicPopover.page++;
|
|
4731
|
+
if (newTopics.length === 0) {
|
|
4732
|
+
this.topicPopover.hasMore = false;
|
|
4733
|
+
}
|
|
4734
|
+
}
|
|
4735
|
+
} else {
|
|
4736
|
+
console.warn("加载热门话题失败:", response);
|
|
4737
|
+
this.topicPopover.hasMore = false;
|
|
4738
|
+
}
|
|
4739
|
+
} catch (error) {
|
|
4740
|
+
console.error("加载热门话题失败:", error);
|
|
4741
|
+
this.topicPopover.hasMore = false;
|
|
4742
|
+
} finally {
|
|
4743
|
+
this.topicPopover.loading = false;
|
|
4744
|
+
this.appendHotTopicsToDOM();
|
|
4745
|
+
}
|
|
4746
|
+
},
|
|
4747
|
+
async searchTopics(keyword) {
|
|
4748
|
+
this.topicPopover.searchKeyword = keyword;
|
|
4749
|
+
this.topicPopover.searchTopics = [];
|
|
4750
|
+
this.topicPopover.searchPage = 1;
|
|
4751
|
+
this.topicPopover.searchHasMore = true;
|
|
4752
|
+
if (this.topicPopover.loading) {
|
|
4753
|
+
this.topicPopover.loading = false;
|
|
4754
|
+
}
|
|
4755
|
+
this.topicPopover.loading = true;
|
|
4756
|
+
try {
|
|
4757
|
+
const response = await this.request.getTopic({
|
|
4758
|
+
action: "201023",
|
|
4759
|
+
title: keyword,
|
|
4760
|
+
highlightTitle: "title",
|
|
4761
|
+
page: this.topicPopover.searchPage,
|
|
4762
|
+
limit: 50
|
|
4763
|
+
});
|
|
4764
|
+
if (response && response.data && response.data.code === 0) {
|
|
4765
|
+
const topics = response.data.data || [];
|
|
4766
|
+
this.topicPopover.searchTopics = topics;
|
|
4767
|
+
this.topicPopover.searchPage++;
|
|
4768
|
+
if (topics.length === 0) {
|
|
4769
|
+
this.topicPopover.searchHasMore = false;
|
|
4770
|
+
} else {
|
|
4771
|
+
this.topicPopover.searchHasMore = topics.length >= 50;
|
|
4772
|
+
}
|
|
4773
|
+
} else {
|
|
4774
|
+
console.warn("搜索话题失败:", response);
|
|
4775
|
+
this.topicPopover.searchHasMore = false;
|
|
4776
|
+
}
|
|
4777
|
+
} catch (error) {
|
|
4778
|
+
console.error("搜索话题失败:", error);
|
|
4779
|
+
this.topicPopover.searchHasMore = false;
|
|
4780
|
+
} finally {
|
|
4781
|
+
this.topicPopover.loading = false;
|
|
4782
|
+
this.updateGlobalTopicPopover();
|
|
4783
|
+
}
|
|
4784
|
+
},
|
|
4785
|
+
// 加载更多搜索话题
|
|
4786
|
+
async loadSearchTopics() {
|
|
4787
|
+
if (this.topicPopover.loading || !this.topicPopover.searchHasMore)
|
|
4788
|
+
return;
|
|
4789
|
+
this.topicPopover.loading = true;
|
|
4790
|
+
try {
|
|
4791
|
+
const response = await this.request.getTopic({
|
|
4792
|
+
action: "201023",
|
|
4793
|
+
title: this.topicPopover.searchKeyword,
|
|
4794
|
+
highlightTitle: "title",
|
|
4795
|
+
page: this.topicPopover.searchPage,
|
|
4796
|
+
limit: 50
|
|
4797
|
+
});
|
|
4798
|
+
if (response && response.data && response.data.code === 0) {
|
|
4799
|
+
const topics = response.data.data || [];
|
|
4800
|
+
if (topics.length === 0) {
|
|
4801
|
+
this.topicPopover.searchHasMore = false;
|
|
4802
|
+
} else {
|
|
4803
|
+
const existingIds = new Set(this.topicPopover.searchTopics.map((t) => t.id));
|
|
4804
|
+
const newTopics = topics.filter((t) => !existingIds.has(t.id));
|
|
4805
|
+
this.topicPopover.newSearchTopicsCount = newTopics.length;
|
|
4806
|
+
this.topicPopover.searchTopics.push(...newTopics);
|
|
4807
|
+
this.topicPopover.searchPage++;
|
|
4808
|
+
if (newTopics.length === 0 || topics.length < 50) {
|
|
4809
|
+
this.topicPopover.searchHasMore = false;
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
} else {
|
|
4813
|
+
console.warn("加载更多搜索话题失败:", response);
|
|
4814
|
+
this.topicPopover.searchHasMore = false;
|
|
4815
|
+
}
|
|
4816
|
+
} catch (error) {
|
|
4817
|
+
console.error("加载更多搜索话题失败:", error);
|
|
4818
|
+
this.topicPopover.searchHasMore = false;
|
|
4819
|
+
} finally {
|
|
4820
|
+
this.topicPopover.loading = false;
|
|
4821
|
+
this.appendSearchTopicsToDOM();
|
|
4822
|
+
}
|
|
4823
|
+
},
|
|
4824
|
+
loadRecentTopics() {
|
|
4825
|
+
try {
|
|
4826
|
+
const localTopics = JSON.parse(localStorage.getItem("localTopic") || "[]");
|
|
4827
|
+
this.topicPopover.recentTopics = localTopics;
|
|
4828
|
+
} catch (error) {
|
|
4829
|
+
console.error("加载最近使用话题失败:", error);
|
|
4830
|
+
this.topicPopover.recentTopics = [];
|
|
4831
|
+
}
|
|
4832
|
+
},
|
|
4833
|
+
selectTopic(topic) {
|
|
4834
|
+
this.saveToRecentTopics(topic);
|
|
4835
|
+
this.insertTopicToEditor(topic);
|
|
4836
|
+
this.hideTopicPopover();
|
|
4837
|
+
this.$emit("topic-inserted", topic);
|
|
4838
|
+
},
|
|
4839
|
+
saveToRecentTopics(topic) {
|
|
4840
|
+
try {
|
|
4841
|
+
let recentTopics = JSON.parse(localStorage.getItem("localTopic") || "[]");
|
|
4842
|
+
recentTopics = recentTopics.filter((item) => item.id !== topic.id);
|
|
4843
|
+
recentTopics.unshift(topic);
|
|
4844
|
+
if (recentTopics.length > 20) {
|
|
4845
|
+
recentTopics = recentTopics.slice(0, 20);
|
|
4846
|
+
}
|
|
4847
|
+
localStorage.setItem("localTopic", JSON.stringify(recentTopics));
|
|
4848
|
+
} catch (error) {
|
|
4849
|
+
console.error("保存最近使用话题失败:", error);
|
|
4850
|
+
}
|
|
4851
|
+
},
|
|
4852
|
+
// 创建全局话题弹框
|
|
4853
|
+
createGlobalTopicPopover() {
|
|
4854
|
+
this.removeGlobalTopicPopover();
|
|
4855
|
+
const mask = document.createElement("div");
|
|
4856
|
+
mask.className = "topic-popover-mask";
|
|
4857
|
+
mask.addEventListener("click", () => {
|
|
4858
|
+
this.hideTopicPopover();
|
|
4859
|
+
});
|
|
4860
|
+
const container = document.createElement("div");
|
|
4861
|
+
container.className = "topic-popover";
|
|
4862
|
+
container.style.position = "fixed";
|
|
4863
|
+
container.style.top = this.topicPopover.position.top + "px";
|
|
4864
|
+
container.style.left = this.topicPopover.position.left + "px";
|
|
4865
|
+
container.style.zIndex = "9999";
|
|
4866
|
+
container.addEventListener("click", (e) => {
|
|
4867
|
+
e.stopPropagation();
|
|
4868
|
+
});
|
|
4869
|
+
container.innerHTML = this.createTopicPopoverContent();
|
|
4870
|
+
document.body.appendChild(mask);
|
|
4871
|
+
document.body.appendChild(container);
|
|
4872
|
+
this.topicPopover.globalMask = mask;
|
|
4873
|
+
this.topicPopover.globalContainer = container;
|
|
4874
|
+
this.bindTopicPopoverEvents();
|
|
4875
|
+
},
|
|
4876
|
+
// 移除全局话题弹框
|
|
4877
|
+
removeGlobalTopicPopover() {
|
|
4878
|
+
if (this.topicPopover.globalMask) {
|
|
4879
|
+
document.body.removeChild(this.topicPopover.globalMask);
|
|
4880
|
+
this.topicPopover.globalMask = null;
|
|
4881
|
+
}
|
|
4882
|
+
if (this.topicPopover.globalContainer) {
|
|
4883
|
+
document.body.removeChild(this.topicPopover.globalContainer);
|
|
4884
|
+
this.topicPopover.globalContainer = null;
|
|
4885
|
+
}
|
|
4886
|
+
},
|
|
4887
|
+
// 更新全局话题弹框内容
|
|
4888
|
+
updateGlobalTopicPopover() {
|
|
4889
|
+
if (!this.topicPopover.globalContainer)
|
|
4890
|
+
return;
|
|
4891
|
+
this.topicPopover.globalContainer.innerHTML = this.createTopicPopoverContent();
|
|
4892
|
+
this.bindTopicPopoverEvents();
|
|
4893
|
+
},
|
|
4894
|
+
// 增量添加热门话题到DOM,避免重绘
|
|
4895
|
+
appendHotTopicsToDOM() {
|
|
4896
|
+
if (!this.topicPopover.globalContainer || this.topicPopover.newHotTopicsCount === 0)
|
|
4897
|
+
return;
|
|
4898
|
+
const topicList = this.topicPopover.globalContainer.querySelector(".topic-list");
|
|
4899
|
+
if (!topicList)
|
|
4900
|
+
return;
|
|
4901
|
+
const startIndex = this.topicPopover.hotTopics.length - this.topicPopover.newHotTopicsCount;
|
|
4902
|
+
const endIndex = this.topicPopover.hotTopics.length;
|
|
4903
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
4904
|
+
const topic = this.topicPopover.hotTopics[i];
|
|
4905
|
+
const topicElement = document.createElement("div");
|
|
4906
|
+
topicElement.className = "topic-item";
|
|
4907
|
+
topicElement.setAttribute("data-topic-id", topic.id);
|
|
4908
|
+
topicElement.textContent = `#${topic.title}`;
|
|
4909
|
+
topicElement.addEventListener("click", () => {
|
|
4910
|
+
this.insertTopicToEditor(topic);
|
|
4911
|
+
});
|
|
4912
|
+
topicList.appendChild(topicElement);
|
|
4913
|
+
}
|
|
4914
|
+
this.updateLoadingState(topicList, this.topicPopover.loading, this.topicPopover.hasMore);
|
|
4915
|
+
this.topicPopover.newHotTopicsCount = 0;
|
|
4916
|
+
},
|
|
4917
|
+
// 增量添加搜索话题到DOM,避免重绘
|
|
4918
|
+
appendSearchTopicsToDOM() {
|
|
4919
|
+
if (!this.topicPopover.globalContainer || this.topicPopover.newSearchTopicsCount === 0)
|
|
4920
|
+
return;
|
|
4921
|
+
const topicList = this.topicPopover.globalContainer.querySelector(".topic-list");
|
|
4922
|
+
if (!topicList)
|
|
4923
|
+
return;
|
|
4924
|
+
const startIndex = this.topicPopover.searchTopics.length - this.topicPopover.newSearchTopicsCount;
|
|
4925
|
+
const endIndex = this.topicPopover.searchTopics.length;
|
|
4926
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
4927
|
+
const topic = this.topicPopover.searchTopics[i];
|
|
4928
|
+
const topicElement = document.createElement("div");
|
|
4929
|
+
topicElement.className = "topic-item";
|
|
4930
|
+
topicElement.setAttribute("data-topic-id", topic.id);
|
|
4931
|
+
topicElement.textContent = `#${topic.exactlyMatchTitle || topic.title}`;
|
|
4932
|
+
topicElement.addEventListener("click", () => {
|
|
4933
|
+
this.insertTopicToEditor(topic);
|
|
4934
|
+
});
|
|
4935
|
+
topicList.appendChild(topicElement);
|
|
4936
|
+
}
|
|
4937
|
+
this.updateLoadingState(topicList, this.topicPopover.loading, this.topicPopover.searchHasMore);
|
|
4938
|
+
this.topicPopover.newSearchTopicsCount = 0;
|
|
4939
|
+
},
|
|
4940
|
+
// 更新加载状态显示
|
|
4941
|
+
updateLoadingState(topicList, loading, hasMore) {
|
|
4942
|
+
const existingLoading = topicList.querySelector(".topic-loading");
|
|
4943
|
+
const existingEmpty = topicList.querySelector(".topic-empty");
|
|
4944
|
+
if (existingLoading)
|
|
4945
|
+
existingLoading.remove();
|
|
4946
|
+
if (existingEmpty)
|
|
4947
|
+
existingEmpty.remove();
|
|
4948
|
+
if (loading) {
|
|
4949
|
+
const loadingElement = document.createElement("div");
|
|
4950
|
+
loadingElement.className = "topic-loading";
|
|
4951
|
+
loadingElement.textContent = "加载更多...";
|
|
4952
|
+
topicList.appendChild(loadingElement);
|
|
4953
|
+
} else if (!hasMore) {
|
|
4954
|
+
const emptyElement = document.createElement("div");
|
|
4955
|
+
emptyElement.className = "topic-empty";
|
|
4956
|
+
emptyElement.textContent = "没有更多了";
|
|
4957
|
+
topicList.appendChild(emptyElement);
|
|
4958
|
+
}
|
|
4959
|
+
},
|
|
4960
|
+
// 创建话题弹框内容
|
|
4961
|
+
createTopicPopoverContent() {
|
|
4962
|
+
if (this.topicPopover.type === "hot") {
|
|
4963
|
+
return this.getHotTopicPopoverHTML();
|
|
4964
|
+
} else if (this.topicPopover.type === "search") {
|
|
4965
|
+
return this.getSearchTopicPopoverHTML();
|
|
4966
|
+
}
|
|
4967
|
+
return "";
|
|
4968
|
+
},
|
|
4969
|
+
// 获取热门话题弹框HTML
|
|
4970
|
+
getHotTopicPopoverHTML() {
|
|
4971
|
+
const activeTab = this.topicPopover.activeTab;
|
|
4972
|
+
const hotTopics = this.topicPopover.hotTopics;
|
|
4973
|
+
const recentTopics = this.topicPopover.recentTopics;
|
|
4974
|
+
const loading = this.topicPopover.loading;
|
|
4975
|
+
const hasMore = this.topicPopover.hasMore;
|
|
4976
|
+
let topicListHTML = "";
|
|
4977
|
+
if (activeTab === "hot") {
|
|
4978
|
+
if (loading && hotTopics.length === 0) {
|
|
4979
|
+
topicListHTML = '<div class="topic-loading">加载中...</div>';
|
|
4980
|
+
} else if (hotTopics.length === 0) {
|
|
4981
|
+
topicListHTML = '<div class="topic-empty">暂无热门话题</div>';
|
|
4982
|
+
} else {
|
|
4983
|
+
topicListHTML = hotTopics.map(
|
|
4984
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
4985
|
+
).join("");
|
|
4986
|
+
if (loading) {
|
|
4987
|
+
topicListHTML += '<div class="topic-loading">加载更多...</div>';
|
|
4988
|
+
} else if (!hasMore) {
|
|
4989
|
+
topicListHTML += '<div class="topic-empty">没有更多了</div>';
|
|
4990
|
+
}
|
|
4991
|
+
}
|
|
4992
|
+
} else {
|
|
4993
|
+
if (recentTopics.length === 0) {
|
|
4994
|
+
topicListHTML = '<div class="topic-empty">暂无最近使用记录</div>';
|
|
4995
|
+
} else {
|
|
4996
|
+
topicListHTML = recentTopics.map(
|
|
4997
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
4998
|
+
).join("");
|
|
4999
|
+
}
|
|
5000
|
+
}
|
|
5001
|
+
return `
|
|
5002
|
+
<div class="topic-popover-content">
|
|
5003
|
+
<div class="topic-tabs">
|
|
5004
|
+
<div class="topic-tab ${activeTab === "hot" ? "active" : ""}" data-tab="hot">
|
|
5005
|
+
热门话题
|
|
5006
|
+
</div>
|
|
5007
|
+
<div class="topic-tab ${activeTab === "recent" ? "active" : ""}" data-tab="recent">
|
|
5008
|
+
最近使用
|
|
5009
|
+
</div>
|
|
5010
|
+
</div>
|
|
5011
|
+
<div class="topic-list-container">
|
|
5012
|
+
<div class="topic-list">
|
|
5013
|
+
${topicListHTML}
|
|
5014
|
+
</div>
|
|
5015
|
+
</div>
|
|
5016
|
+
</div>
|
|
5017
|
+
`;
|
|
5018
|
+
},
|
|
5019
|
+
// 获取搜索话题弹框HTML
|
|
5020
|
+
getSearchTopicPopoverHTML() {
|
|
5021
|
+
const searchKeyword = this.topicPopover.searchKeyword;
|
|
5022
|
+
const searchTopics = this.topicPopover.searchTopics;
|
|
5023
|
+
const loading = this.topicPopover.loading;
|
|
5024
|
+
const searchHasMore = this.topicPopover.searchHasMore;
|
|
5025
|
+
let topicListHTML = "";
|
|
5026
|
+
if (loading && searchTopics.length === 0) {
|
|
5027
|
+
topicListHTML = '<div class="topic-loading">搜索中...</div>';
|
|
5028
|
+
} else if (searchTopics.length === 0) {
|
|
5029
|
+
topicListHTML = '<div class="topic-empty">没有匹配到话题,请重新输入</div>';
|
|
5030
|
+
} else {
|
|
5031
|
+
topicListHTML = searchTopics.map(
|
|
5032
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
5033
|
+
).join("");
|
|
5034
|
+
if (loading) {
|
|
5035
|
+
topicListHTML += '<div class="topic-loading">加载更多...</div>';
|
|
5036
|
+
} else if (!searchHasMore) {
|
|
5037
|
+
topicListHTML += '<div class="topic-empty">没有更多了</div>';
|
|
5038
|
+
}
|
|
5039
|
+
}
|
|
5040
|
+
return `
|
|
5041
|
+
<div class="topic-popover-content">
|
|
5042
|
+
<div class="topic-search-header">
|
|
5043
|
+
<span class="topic-search-title">#${searchKeyword}</span>
|
|
5044
|
+
</div>
|
|
5045
|
+
<div class="topic-list-container">
|
|
5046
|
+
<div class="topic-list">
|
|
5047
|
+
${topicListHTML}
|
|
5048
|
+
</div>
|
|
5049
|
+
</div>
|
|
5050
|
+
</div>
|
|
5051
|
+
`;
|
|
5052
|
+
},
|
|
5053
|
+
// 绑定话题弹框事件
|
|
5054
|
+
bindTopicPopoverEvents() {
|
|
5055
|
+
if (!this.topicPopover.globalContainer)
|
|
5056
|
+
return;
|
|
5057
|
+
const tabs = this.topicPopover.globalContainer.querySelectorAll(".topic-tab");
|
|
5058
|
+
tabs.forEach((tab) => {
|
|
5059
|
+
tab.addEventListener("click", (e) => {
|
|
5060
|
+
const tabType = e.target.getAttribute("data-tab");
|
|
5061
|
+
this.switchTopicTab(tabType);
|
|
5062
|
+
});
|
|
5063
|
+
});
|
|
5064
|
+
const topicItems = this.topicPopover.globalContainer.querySelectorAll(".topic-item");
|
|
5065
|
+
topicItems.forEach((item) => {
|
|
5066
|
+
item.addEventListener("click", (e) => {
|
|
5067
|
+
const topicId = parseInt(e.target.getAttribute("data-topic-id"));
|
|
5068
|
+
const topic = this.findTopicById(topicId);
|
|
5069
|
+
if (topic) {
|
|
5070
|
+
this.selectTopic(topic);
|
|
5071
|
+
}
|
|
5072
|
+
});
|
|
5073
|
+
});
|
|
5074
|
+
const listContainer = this.topicPopover.globalContainer.querySelector(".topic-list-container");
|
|
5075
|
+
if (listContainer) {
|
|
5076
|
+
listContainer.addEventListener("scroll", (e) => {
|
|
5077
|
+
if (this.topicPopover.type === "hot") {
|
|
5078
|
+
this.handleHotTopicScroll(e);
|
|
5079
|
+
} else if (this.topicPopover.type === "search") {
|
|
5080
|
+
this.handleSearchTopicScroll(e);
|
|
5081
|
+
}
|
|
5082
|
+
});
|
|
5083
|
+
}
|
|
5084
|
+
},
|
|
5085
|
+
// 根据ID查找话题
|
|
5086
|
+
findTopicById(topicId) {
|
|
5087
|
+
let topic = this.topicPopover.hotTopics.find((t) => t.id === topicId);
|
|
5088
|
+
if (topic)
|
|
5089
|
+
return topic;
|
|
5090
|
+
topic = this.topicPopover.searchTopics.find((t) => t.id === topicId);
|
|
5091
|
+
if (topic)
|
|
5092
|
+
return topic;
|
|
5093
|
+
topic = this.topicPopover.recentTopics.find((t) => t.id === topicId);
|
|
5094
|
+
if (topic)
|
|
5095
|
+
return topic;
|
|
5096
|
+
return null;
|
|
5097
|
+
},
|
|
5098
|
+
handleHotTopicScroll(event) {
|
|
5099
|
+
if (this.topicPopover.activeTab !== "hot")
|
|
5100
|
+
return;
|
|
5101
|
+
const container = event.target;
|
|
5102
|
+
const scrollTop = container.scrollTop;
|
|
5103
|
+
const scrollHeight = container.scrollHeight;
|
|
5104
|
+
const clientHeight = container.clientHeight;
|
|
5105
|
+
if (scrollTop + clientHeight >= scrollHeight - 10) {
|
|
5106
|
+
this.loadHotTopics();
|
|
5107
|
+
}
|
|
5108
|
+
},
|
|
5109
|
+
handleSearchTopicScroll(event) {
|
|
5110
|
+
const container = event.target;
|
|
5111
|
+
const scrollTop = container.scrollTop;
|
|
5112
|
+
const scrollHeight = container.scrollHeight;
|
|
5113
|
+
const clientHeight = container.clientHeight;
|
|
5114
|
+
if (scrollTop + clientHeight >= scrollHeight - 10) {
|
|
5115
|
+
this.loadSearchTopics();
|
|
5116
|
+
}
|
|
5117
|
+
},
|
|
5118
|
+
insertTopicToEditor(topic) {
|
|
5119
|
+
const originalRange = this.topicPopover.originalRange;
|
|
5120
|
+
const triggerInfo = this.topicPopover.triggerInfo;
|
|
5121
|
+
const popoverType = this.topicPopover.type;
|
|
5122
|
+
this.hideTopicPopover();
|
|
5123
|
+
let range = originalRange;
|
|
5124
|
+
if (!range) {
|
|
5125
|
+
const selection2 = window.getSelection();
|
|
5126
|
+
if (selection2.rangeCount === 0)
|
|
5127
|
+
return;
|
|
5128
|
+
range = selection2.getRangeAt(0);
|
|
5129
|
+
}
|
|
5130
|
+
const topicText = `#${topic.exactlyMatchTitle}`;
|
|
5131
|
+
if (popoverType === "search" && triggerInfo && triggerInfo.paragraph) {
|
|
5132
|
+
const paragraph = triggerInfo.paragraph;
|
|
5133
|
+
const hashIndex = triggerInfo.hashIndex;
|
|
5134
|
+
const deleteRange = document.createRange();
|
|
5135
|
+
const walker = document.createTreeWalker(
|
|
5136
|
+
paragraph,
|
|
5137
|
+
NodeFilter.SHOW_TEXT,
|
|
5138
|
+
{
|
|
5139
|
+
acceptNode: function(node2) {
|
|
5140
|
+
let parent = node2.parentNode;
|
|
5141
|
+
while (parent && parent !== paragraph) {
|
|
5142
|
+
if (parent.tagName === "MDD-TOPIC") {
|
|
5143
|
+
return NodeFilter.FILTER_REJECT;
|
|
5144
|
+
}
|
|
5145
|
+
parent = parent.parentNode;
|
|
5146
|
+
}
|
|
5147
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
5148
|
+
}
|
|
5149
|
+
},
|
|
5150
|
+
false
|
|
5151
|
+
);
|
|
5152
|
+
let position = 0;
|
|
5153
|
+
let startNode = null;
|
|
5154
|
+
let startOffset = 0;
|
|
5155
|
+
let endNode = null;
|
|
5156
|
+
let endOffset = 0;
|
|
5157
|
+
let node;
|
|
5158
|
+
while (node = walker.nextNode()) {
|
|
5159
|
+
if (position + node.textContent.length > hashIndex) {
|
|
5160
|
+
startNode = node;
|
|
5161
|
+
startOffset = hashIndex - position;
|
|
5162
|
+
break;
|
|
5163
|
+
}
|
|
5164
|
+
position += node.textContent.length;
|
|
5165
|
+
}
|
|
5166
|
+
const currentCursorPosition = triggerInfo.cursorPosition;
|
|
5167
|
+
position = 0;
|
|
5168
|
+
walker.currentNode = paragraph;
|
|
5169
|
+
while (node = walker.nextNode()) {
|
|
5170
|
+
if (position + node.textContent.length >= currentCursorPosition) {
|
|
5171
|
+
endNode = node;
|
|
5172
|
+
endOffset = currentCursorPosition - position;
|
|
5173
|
+
break;
|
|
5174
|
+
}
|
|
5175
|
+
position += node.textContent.length;
|
|
5176
|
+
}
|
|
5177
|
+
if (startNode && endNode) {
|
|
5178
|
+
deleteRange.setStart(startNode, startOffset);
|
|
5179
|
+
deleteRange.setEnd(endNode, endOffset);
|
|
5180
|
+
deleteRange.deleteContents();
|
|
5181
|
+
range = document.createRange();
|
|
5182
|
+
range.setStart(startNode, startOffset);
|
|
5183
|
+
range.collapse(true);
|
|
5184
|
+
}
|
|
5185
|
+
} else if (popoverType === "hot") {
|
|
5186
|
+
const container = range.startContainer;
|
|
5187
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent) {
|
|
5188
|
+
const offset = range.startOffset;
|
|
5189
|
+
if (offset > 0 && container.textContent[offset - 1] === "#") {
|
|
5190
|
+
const deleteRange = document.createRange();
|
|
5191
|
+
deleteRange.setStart(container, offset - 1);
|
|
5192
|
+
deleteRange.setEnd(container, offset);
|
|
5193
|
+
deleteRange.deleteContents();
|
|
5194
|
+
range.setStart(container, offset - 1);
|
|
5195
|
+
range.collapse(true);
|
|
5196
|
+
}
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
const topicElement = document.createElement("mdd-topic");
|
|
5200
|
+
topicElement.setAttribute("data-topic", JSON.stringify({
|
|
5201
|
+
topicId: topic.id,
|
|
5202
|
+
topicType: 0,
|
|
5203
|
+
startIndex: 0,
|
|
5204
|
+
// 会在updateTopicPosition中更新
|
|
5205
|
+
endIndex: 0
|
|
5206
|
+
// 会在updateTopicPosition中更新
|
|
5207
|
+
}));
|
|
5208
|
+
topicElement.textContent = topicText;
|
|
5209
|
+
topicElement.setAttribute("contenteditable", "false");
|
|
5210
|
+
range.deleteContents();
|
|
5211
|
+
range.insertNode(topicElement);
|
|
5212
|
+
const spaceNode = document.createTextNode(" ");
|
|
5213
|
+
range.setStartAfter(topicElement);
|
|
5214
|
+
range.insertNode(spaceNode);
|
|
5215
|
+
const newRange = document.createRange();
|
|
5216
|
+
newRange.setStartAfter(spaceNode);
|
|
5217
|
+
newRange.collapse(true);
|
|
5218
|
+
const selection = window.getSelection();
|
|
5219
|
+
selection.removeAllRanges();
|
|
5220
|
+
selection.addRange(newRange);
|
|
5221
|
+
setTimeout(() => {
|
|
5222
|
+
const currentSelection = window.getSelection();
|
|
5223
|
+
if (currentSelection.rangeCount > 0) {
|
|
5224
|
+
const currentRange = currentSelection.getRangeAt(0);
|
|
5225
|
+
if (currentRange.startContainer !== spaceNode.nextSibling) {
|
|
5226
|
+
const correctRange = document.createRange();
|
|
5227
|
+
correctRange.setStartAfter(spaceNode);
|
|
5228
|
+
correctRange.collapse(true);
|
|
5229
|
+
currentSelection.removeAllRanges();
|
|
5230
|
+
currentSelection.addRange(correctRange);
|
|
5231
|
+
}
|
|
5232
|
+
}
|
|
5233
|
+
}, 0);
|
|
5234
|
+
this.$emit("update-topic-position");
|
|
5235
|
+
},
|
|
5236
|
+
// 销毁话题管理器
|
|
5237
|
+
destroy() {
|
|
5238
|
+
this.unbindEditorEvents();
|
|
5239
|
+
this.hideTopicPopover();
|
|
5240
|
+
}
|
|
5241
|
+
},
|
|
5242
|
+
mounted() {
|
|
5243
|
+
this.init();
|
|
5244
|
+
},
|
|
5245
|
+
beforeUnmount() {
|
|
5246
|
+
this.destroy();
|
|
5247
|
+
}
|
|
5248
|
+
};
|
|
5249
|
+
const _hoisted_1$3 = { class: "topic-manager" };
|
|
5250
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5251
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3);
|
|
5252
|
+
}
|
|
5253
|
+
const TopicManager = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
5254
|
+
const index_vue_vue_type_style_index_0_lang = "";
|
|
5255
|
+
const _sfc_main$2 = {
|
|
5256
|
+
provide() {
|
|
5257
|
+
return {
|
|
5258
|
+
vm: this
|
|
5259
|
+
};
|
|
5260
|
+
},
|
|
5261
|
+
components: {
|
|
5262
|
+
ElInput: elementPlus.ElInput,
|
|
5263
|
+
BasicDialog: _sfc_main$7,
|
|
5264
|
+
draggable
|
|
5265
|
+
},
|
|
5266
|
+
props: {
|
|
5267
|
+
visible: {
|
|
5268
|
+
type: Boolean,
|
|
5269
|
+
default: false
|
|
5270
|
+
},
|
|
5271
|
+
linkContent: {
|
|
5272
|
+
type: String,
|
|
5273
|
+
default: ""
|
|
5274
|
+
},
|
|
5275
|
+
fileSelected: {
|
|
5276
|
+
type: Function,
|
|
5277
|
+
default: () => {
|
|
5278
|
+
}
|
|
5279
|
+
}
|
|
5280
|
+
},
|
|
5281
|
+
data() {
|
|
5282
|
+
return {};
|
|
5283
|
+
},
|
|
5284
|
+
computed: {
|
|
5285
|
+
input: {
|
|
5286
|
+
get() {
|
|
5287
|
+
return this.linkContent;
|
|
5288
|
+
},
|
|
5289
|
+
set(val) {
|
|
5290
|
+
this.$emit("update:linkContent", val);
|
|
5291
|
+
}
|
|
5292
|
+
}
|
|
5293
|
+
},
|
|
5294
|
+
mounted() {
|
|
5295
|
+
},
|
|
5296
|
+
methods: {
|
|
5297
|
+
emitEvent() {
|
|
5298
|
+
var event = new MouseEvent("click");
|
|
5299
|
+
var ele = document.getElementsByClassName("video-input");
|
|
5300
|
+
ele[0].dispatchEvent(event);
|
|
5301
|
+
},
|
|
5302
|
+
setStatus(val) {
|
|
5303
|
+
this.$emit("update:visible", val);
|
|
5304
|
+
}
|
|
5305
|
+
// submit() {
|
|
5306
|
+
// this.$emit('submit')
|
|
5307
|
+
// }
|
|
5308
|
+
}
|
|
5309
|
+
};
|
|
5310
|
+
const _hoisted_1$2 = { class: "collect-article_content" };
|
|
5311
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5312
|
+
const _component_el_input = vue.resolveComponent("el-input");
|
|
5313
|
+
const _component_BasicDialog = vue.resolveComponent("BasicDialog");
|
|
5314
|
+
return vue.openBlock(), vue.createBlock(_component_BasicDialog, {
|
|
5315
|
+
visible: $props.visible,
|
|
5316
|
+
width: "600px",
|
|
5317
|
+
height: "50px"
|
|
5318
|
+
}, {
|
|
5319
|
+
title: vue.withCtx(() => _cache[1] || (_cache[1] = [
|
|
5320
|
+
vue.createElementVNode("div", null, [
|
|
5321
|
+
vue.createElementVNode("span", null, "采集文章"),
|
|
5322
|
+
vue.createElementVNode("span", { class: "collect-article_lable" }, "如需获得正式使用权,请自行联系版权所有者")
|
|
5323
|
+
], -1)
|
|
5324
|
+
])),
|
|
5325
|
+
default: vue.withCtx(() => [
|
|
5326
|
+
vue.createElementVNode("div", _hoisted_1$2, [
|
|
5327
|
+
_cache[2] || (_cache[2] = vue.createElementVNode("div", { class: "tip" }, "请把需要采集的文章链接粘贴在下方的输入框:", -1)),
|
|
5328
|
+
vue.createVNode(_component_el_input, {
|
|
5329
|
+
modelValue: $options.input,
|
|
5330
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.input = $event),
|
|
5331
|
+
placeholder: "仅支持微信链接"
|
|
5332
|
+
}, null, 8, ["modelValue"])
|
|
5333
|
+
])
|
|
5334
|
+
]),
|
|
5335
|
+
_: 1
|
|
5336
|
+
}, 8, ["visible"]);
|
|
5337
|
+
}
|
|
5338
|
+
const CollectArticle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
5339
|
+
const index_vue_vue_type_style_index_0_scoped_4ebe06df_lang = "";
|
|
5340
|
+
const _sfc_main$1 = {
|
|
5341
|
+
components: {
|
|
5342
|
+
ElIconError: iconsVue.CircleCloseFilled
|
|
5343
|
+
},
|
|
5344
|
+
props: {
|
|
5345
|
+
article: {
|
|
5346
|
+
type: Object,
|
|
5347
|
+
default: () => ({})
|
|
5348
|
+
}
|
|
5349
|
+
},
|
|
5350
|
+
methods: {
|
|
5351
|
+
close(e) {
|
|
5352
|
+
let child = e.target;
|
|
5353
|
+
while (child) {
|
|
5354
|
+
if (child.dataset.article) {
|
|
5355
|
+
child.parentNode.removeChild(child);
|
|
5356
|
+
break;
|
|
5357
|
+
}
|
|
5358
|
+
child = child.parentNode;
|
|
5359
|
+
}
|
|
5360
|
+
this.$emit("delete");
|
|
5361
|
+
}
|
|
5362
|
+
}
|
|
5363
|
+
};
|
|
5364
|
+
const _hoisted_1$1 = {
|
|
5365
|
+
class: "article-item",
|
|
5366
|
+
contenteditable: "false"
|
|
5367
|
+
};
|
|
5368
|
+
const _hoisted_2$1 = ["src"];
|
|
5369
|
+
const _hoisted_3$1 = { class: "article-item_right" };
|
|
4517
5370
|
const _hoisted_4 = { class: "name" };
|
|
4518
5371
|
const _hoisted_5 = { class: "score" };
|
|
4519
5372
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -4528,8 +5381,8 @@
|
|
|
4528
5381
|
vue.createElementVNode("div", _hoisted_4, vue.toDisplayString($props.article.title), 1),
|
|
4529
5382
|
vue.createElementVNode("div", _hoisted_5, [
|
|
4530
5383
|
vue.createElementVNode("span", null, vue.toDisplayString($props.article.author), 1),
|
|
4531
|
-
vue.createElementVNode("span", null, vue.toDisplayString($props.article.viewNum) + "
|
|
4532
|
-
vue.createElementVNode("span", null, vue.toDisplayString($props.article.replycnt) + "
|
|
5384
|
+
vue.createElementVNode("span", null, vue.toDisplayString($props.article.viewNum) + "浏览", 1),
|
|
5385
|
+
vue.createElementVNode("span", null, vue.toDisplayString($props.article.replycnt) + "评论", 1)
|
|
4533
5386
|
])
|
|
4534
5387
|
]),
|
|
4535
5388
|
vue.createVNode(_component_el_icon_error, {
|
|
@@ -4541,10 +5394,10 @@
|
|
|
4541
5394
|
class: vue.normalizeClass([{
|
|
4542
5395
|
"article-bg-height": $props.article.img || $props.article.mediaInfo && $props.article.mediaInfo.length
|
|
4543
5396
|
}, "article-bg"])
|
|
4544
|
-
}, "
|
|
5397
|
+
}, " 平台仅支持展示18个月的推荐内容 ", 2)) : vue.createCommentVNode("", true)
|
|
4545
5398
|
]);
|
|
4546
5399
|
}
|
|
4547
|
-
const Item = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
|
5400
|
+
const Item = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-4ebe06df"]]);
|
|
4548
5401
|
const mountArticleDom = (props, del) => {
|
|
4549
5402
|
const className = "article-wrap";
|
|
4550
5403
|
const article = props.article;
|
|
@@ -4578,14 +5431,15 @@
|
|
|
4578
5431
|
name: "Edit",
|
|
4579
5432
|
components: {
|
|
4580
5433
|
ElInput: elementPlus.ElInput,
|
|
4581
|
-
InsertArticle: _sfc_main$
|
|
4582
|
-
ImgUpload: _sfc_main$
|
|
4583
|
-
VideoUpload: _sfc_main$
|
|
5434
|
+
InsertArticle: _sfc_main$6,
|
|
5435
|
+
ImgUpload: _sfc_main$5,
|
|
5436
|
+
VideoUpload: _sfc_main$4,
|
|
4584
5437
|
CollectArticle,
|
|
4585
5438
|
ElFormItem: elementPlus.ElFormItem,
|
|
4586
5439
|
ElForm: elementPlus.ElForm,
|
|
4587
5440
|
ElDialog: elementPlus.ElDialog,
|
|
4588
|
-
ElButton: elementPlus.ElButton
|
|
5441
|
+
ElButton: elementPlus.ElButton,
|
|
5442
|
+
TopicManager
|
|
4589
5443
|
},
|
|
4590
5444
|
props: [
|
|
4591
5445
|
"disabled",
|
|
@@ -4595,13 +5449,15 @@
|
|
|
4595
5449
|
"importEssay",
|
|
4596
5450
|
"uploadImageByOther",
|
|
4597
5451
|
"chartGallery",
|
|
4598
|
-
"request"
|
|
5452
|
+
"request",
|
|
5453
|
+
"placeholder"
|
|
4599
5454
|
],
|
|
4600
5455
|
data() {
|
|
4601
5456
|
return {
|
|
4602
5457
|
hasArticleCard: false,
|
|
4603
5458
|
cursorStyle: "auto",
|
|
4604
5459
|
titleCount: 0,
|
|
5460
|
+
// 标题数量
|
|
4605
5461
|
viewLinkDialog: false,
|
|
4606
5462
|
linkForm: {
|
|
4607
5463
|
linkAddress: "",
|
|
@@ -4609,39 +5465,54 @@
|
|
|
4609
5465
|
},
|
|
4610
5466
|
setAlignFlag: true,
|
|
4611
5467
|
article: {},
|
|
5468
|
+
// 插入的文章
|
|
4612
5469
|
imgList: [],
|
|
4613
5470
|
imgNum: 20,
|
|
4614
5471
|
videoList: [],
|
|
4615
5472
|
visibleVideo: false,
|
|
4616
5473
|
visibleCollectArticle: false,
|
|
4617
5474
|
visibleArticle: false,
|
|
5475
|
+
// 插入文章
|
|
4618
5476
|
visibleImg: false,
|
|
5477
|
+
// 插入图片
|
|
4619
5478
|
imgType: "normal",
|
|
5479
|
+
//
|
|
4620
5480
|
typeEnum: {
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
5481
|
+
文字: "1",
|
|
5482
|
+
图片: "2",
|
|
5483
|
+
图文: "3",
|
|
5484
|
+
段落标题: "4",
|
|
5485
|
+
关联: "5",
|
|
5486
|
+
// 关联车辆、轨迹、活动、商家、话题
|
|
5487
|
+
单视频: "6",
|
|
5488
|
+
视频文字: "7",
|
|
4628
5489
|
URL: "8",
|
|
4629
|
-
|
|
5490
|
+
文章卡片: "11"
|
|
4630
5491
|
},
|
|
4631
5492
|
fontInfo: {
|
|
4632
5493
|
size: ""
|
|
4633
5494
|
},
|
|
4634
5495
|
user: {},
|
|
5496
|
+
// 用户
|
|
4635
5497
|
editor: {},
|
|
5498
|
+
// 编辑器实例对象
|
|
4636
5499
|
editorDom: {},
|
|
5500
|
+
// 编辑器Dom
|
|
4637
5501
|
uploadStore: {},
|
|
5502
|
+
// 待上传的图片池
|
|
4638
5503
|
linkContent: "",
|
|
5504
|
+
// 插入链接的地址
|
|
4639
5505
|
loadingText: "",
|
|
5506
|
+
// loaing的提示文字
|
|
4640
5507
|
progressPercent: "",
|
|
5508
|
+
// 上传进度
|
|
4641
5509
|
currentIndex: 0,
|
|
4642
5510
|
loading: false,
|
|
5511
|
+
// 是否提交中
|
|
4643
5512
|
viewStatus: false,
|
|
5513
|
+
// todo: 改名
|
|
4644
5514
|
linkStatus: false,
|
|
5515
|
+
// todo: 改名
|
|
4645
5516
|
styleStatus: {
|
|
4646
5517
|
bold: false,
|
|
4647
5518
|
italic: false,
|
|
@@ -4665,6 +5536,7 @@
|
|
|
4665
5536
|
targetMove: "",
|
|
4666
5537
|
moverClasses: ["halo-img-content", "halo-video-content"],
|
|
4667
5538
|
selectDom: null
|
|
5539
|
+
//选中的dom
|
|
4668
5540
|
};
|
|
4669
5541
|
},
|
|
4670
5542
|
computed: {
|
|
@@ -4681,12 +5553,12 @@
|
|
|
4681
5553
|
watch: {
|
|
4682
5554
|
progressPercent(val) {
|
|
4683
5555
|
const inner = document.querySelector(".video-progress .inner");
|
|
4684
|
-
console.log(val, "
|
|
5556
|
+
console.log(val, "视频上传进度");
|
|
4685
5557
|
if (inner) {
|
|
4686
5558
|
inner.style.width = val + "%";
|
|
4687
5559
|
if (val === 100) {
|
|
4688
5560
|
document.querySelector(".video-progress").innerHTML = `
|
|
4689
|
-
<div class="no-calc" style="text-align:center;color:#999999;font-size:18px;"
|
|
5561
|
+
<div class="no-calc" style="text-align:center;color:#999999;font-size:18px;">正在获取视频封面</div>
|
|
4690
5562
|
`;
|
|
4691
5563
|
}
|
|
4692
5564
|
}
|
|
@@ -4705,7 +5577,7 @@
|
|
|
4705
5577
|
me2.user = JSON.parse(
|
|
4706
5578
|
window.localStorage.getItem("user") || window.localStorage.getItem("userInfo") || "{}"
|
|
4707
5579
|
);
|
|
4708
|
-
me2.guid = me2.user.uid + "|" +
|
|
5580
|
+
me2.guid = me2.user.uid + "|" + util.tools.guid();
|
|
4709
5581
|
},
|
|
4710
5582
|
beforeDestroy() {
|
|
4711
5583
|
this.editorDom && this.editorDom.removeEventListener("blur", this.canSetAlign);
|
|
@@ -4738,7 +5610,6 @@
|
|
|
4738
5610
|
},
|
|
4739
5611
|
setCursor() {
|
|
4740
5612
|
this.cursorStyle = this.cursorStyle === cursorImg ? "auto" : cursorImg;
|
|
4741
|
-
console.log(this.styleStatus, 999);
|
|
4742
5613
|
this.curStyle = { ...this.styleStatus };
|
|
4743
5614
|
this.editorDom.addEventListener("mouseup", this.handleCopyFormatUp);
|
|
4744
5615
|
},
|
|
@@ -4776,10 +5647,10 @@
|
|
|
4776
5647
|
this.visibleVideo = false;
|
|
4777
5648
|
const fileName = (files[0] && files[0].name || "").toLowerCase();
|
|
4778
5649
|
if (files[0].size > 1 * 1024 * 1024 * 1024) {
|
|
4779
|
-
return me2.setToast("
|
|
5650
|
+
return me2.setToast("视频大小不能超过1GB");
|
|
4780
5651
|
}
|
|
4781
5652
|
if (fileName.indexOf(".mp4") === -1 && fileName.indexOf(".mov") === -1) {
|
|
4782
|
-
return me2.setToast("
|
|
5653
|
+
return me2.setToast("视频格式不是mp4或mov");
|
|
4783
5654
|
}
|
|
4784
5655
|
const me2 = this;
|
|
4785
5656
|
if (me2.loading)
|
|
@@ -4799,7 +5670,9 @@
|
|
|
4799
5670
|
id: result.videoId,
|
|
4800
5671
|
desc: "",
|
|
4801
5672
|
vodSize: result.vodSize || "",
|
|
5673
|
+
// 视频大小
|
|
4802
5674
|
vodType: result.vodType || ""
|
|
5675
|
+
// 图片尺寸
|
|
4803
5676
|
};
|
|
4804
5677
|
me2.$emit("updateAddVideo", true);
|
|
4805
5678
|
me2.editor["insertVideo"](result.videoUrl, video);
|
|
@@ -4853,11 +5726,11 @@
|
|
|
4853
5726
|
},
|
|
4854
5727
|
insertLink() {
|
|
4855
5728
|
if (!this.linkForm.linkAddress)
|
|
4856
|
-
return elementPlus.ElMessage.error("
|
|
5729
|
+
return elementPlus.ElMessage.error("请输入链接地址");
|
|
4857
5730
|
if (!this.linkForm.linkWriting)
|
|
4858
|
-
return elementPlus.ElMessage.error("
|
|
5731
|
+
return elementPlus.ElMessage.error("请输入链接文案");
|
|
4859
5732
|
if (!this.validUrl(this.linkForm.linkAddress)) {
|
|
4860
|
-
return this.setToast("URL
|
|
5733
|
+
return this.setToast("URL无效");
|
|
4861
5734
|
}
|
|
4862
5735
|
this.editor.insertLink(
|
|
4863
5736
|
this.linkForm.linkAddress,
|
|
@@ -4886,6 +5759,10 @@
|
|
|
4886
5759
|
});
|
|
4887
5760
|
});
|
|
4888
5761
|
},
|
|
5762
|
+
// TopicManager事件处理
|
|
5763
|
+
onTopicInserted(topic) {
|
|
5764
|
+
this.updateData(true);
|
|
5765
|
+
},
|
|
4889
5766
|
getHtml(type) {
|
|
4890
5767
|
this.updateTopicPosition();
|
|
4891
5768
|
const html = this.editor.getHTML();
|
|
@@ -4987,6 +5864,8 @@
|
|
|
4987
5864
|
const frag = document.createDocumentFragment();
|
|
4988
5865
|
frag.appendChild(this.editor.empty(div));
|
|
4989
5866
|
const nodes = [...frag.childNodes];
|
|
5867
|
+
const mddTopics = frag.querySelectorAll("mdd-topic");
|
|
5868
|
+
mddTopics.forEach((topic) => topic.setAttribute("contenteditable", "false"));
|
|
4990
5869
|
for (let i = 0; i < nodes.length; i++) {
|
|
4991
5870
|
const node = nodes[i];
|
|
4992
5871
|
if (node.nodeType === 1) {
|
|
@@ -5080,6 +5959,8 @@
|
|
|
5080
5959
|
},
|
|
5081
5960
|
async parseArticle(node) {
|
|
5082
5961
|
const data = JSON.parse(node.dataset.article);
|
|
5962
|
+
if (!this.getEassyDetail)
|
|
5963
|
+
return;
|
|
5083
5964
|
await this.getEassyDetail(data.id, (info) => {
|
|
5084
5965
|
const el = mountArticleDom(
|
|
5085
5966
|
{
|
|
@@ -5336,7 +6217,7 @@
|
|
|
5336
6217
|
}
|
|
5337
6218
|
this.updateData(true);
|
|
5338
6219
|
} else {
|
|
5339
|
-
this.setToast(rst.origin.name + "
|
|
6220
|
+
this.setToast(rst.origin.name + "上传失败,请重试");
|
|
5340
6221
|
}
|
|
5341
6222
|
},
|
|
5342
6223
|
insertVideoBtns(editor, node) {
|
|
@@ -5351,7 +6232,7 @@
|
|
|
5351
6232
|
me2.currentVideo = node;
|
|
5352
6233
|
e.stopPropagation();
|
|
5353
6234
|
};
|
|
5354
|
-
replaceBtn.innerText = "
|
|
6235
|
+
replaceBtn.innerText = "更换封面";
|
|
5355
6236
|
return replaceBtn;
|
|
5356
6237
|
},
|
|
5357
6238
|
insertImgOperateBtns(editor, data) {
|
|
@@ -5372,13 +6253,12 @@
|
|
|
5372
6253
|
}
|
|
5373
6254
|
});
|
|
5374
6255
|
var descInputWrap;
|
|
5375
|
-
console.log(data.seamlessFlag, "count<<<<<<");
|
|
5376
6256
|
var descInput = editor.createElement("textarea", {
|
|
5377
6257
|
class: "desc-input",
|
|
5378
6258
|
maxlength: "50",
|
|
5379
6259
|
rows: "2",
|
|
5380
6260
|
cols: "50",
|
|
5381
|
-
placeholder: "
|
|
6261
|
+
placeholder: "请输入图片描述(最多50字)",
|
|
5382
6262
|
contenteditable: "false"
|
|
5383
6263
|
});
|
|
5384
6264
|
descInput.disabled = me2.disabled;
|
|
@@ -5387,7 +6267,7 @@
|
|
|
5387
6267
|
const img = parent.querySelector(".halo-picture-area");
|
|
5388
6268
|
img.dataset.desc = e.target.value;
|
|
5389
6269
|
if (e.target.value.length > 49) {
|
|
5390
|
-
return me2.setToast("
|
|
6270
|
+
return me2.setToast("限制50个字符");
|
|
5391
6271
|
}
|
|
5392
6272
|
};
|
|
5393
6273
|
descInput.value = data.content || "";
|
|
@@ -5437,7 +6317,7 @@
|
|
|
5437
6317
|
me2.removeParentByClass(e.target, "halo-img-content");
|
|
5438
6318
|
me2.updateData(true);
|
|
5439
6319
|
};
|
|
5440
|
-
replaceBtn.innerHTML = "
|
|
6320
|
+
replaceBtn.innerHTML = "替换";
|
|
5441
6321
|
return [replaceBtn, delBtn, descInputWrap];
|
|
5442
6322
|
},
|
|
5443
6323
|
removeSeamlessLaster(e) {
|
|
@@ -5461,6 +6341,7 @@
|
|
|
5461
6341
|
}
|
|
5462
6342
|
}
|
|
5463
6343
|
},
|
|
6344
|
+
// 初始化编辑器数据,数据是 html 格式(displayData)
|
|
5464
6345
|
initData(data = "", essayPicRelVOList) {
|
|
5465
6346
|
this.parseHtml(data, essayPicRelVOList).then((res) => {
|
|
5466
6347
|
this.editorDom.innerHTML = "";
|
|
@@ -5468,6 +6349,13 @@
|
|
|
5468
6349
|
this.updateData();
|
|
5469
6350
|
});
|
|
5470
6351
|
},
|
|
6352
|
+
// TODO jsonToHtml、htmlToJson 实现这 2 个方法里面的逻辑,数据结构参考方法里面的注释,出参入参都为字符串,注意:mdd-topic 里面的属性数据 和 json 中的topicPosition数据是一一对应的,startIndex、endIndex为mdd-topic的起止位置 从 content 里面进行分割处理
|
|
6353
|
+
// json、html 数据格式互转,暂时只支持文字、短话题
|
|
6354
|
+
jsonToHtml(json) {
|
|
6355
|
+
},
|
|
6356
|
+
htmlToJson(html) {
|
|
6357
|
+
},
|
|
6358
|
+
// 设置富文本组件
|
|
5471
6359
|
initSquire() {
|
|
5472
6360
|
const me2 = this;
|
|
5473
6361
|
const editorDom = me2.editorDom;
|
|
@@ -5555,7 +6443,8 @@
|
|
|
5555
6443
|
event.preventDefault();
|
|
5556
6444
|
});
|
|
5557
6445
|
me2.editor.addEventListener("keydown", function(event) {
|
|
5558
|
-
|
|
6446
|
+
var _a, _b, _c;
|
|
6447
|
+
if (["Backspace", "Delete"].includes(event.key)) {
|
|
5559
6448
|
try {
|
|
5560
6449
|
const selection2 = getSelection();
|
|
5561
6450
|
if (me2.selectDom && me2.moverClasses.includes(me2.selectDom.className)) {
|
|
@@ -5589,32 +6478,10 @@
|
|
|
5589
6478
|
} catch (error) {
|
|
5590
6479
|
console.log(error);
|
|
5591
6480
|
}
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
const startContainer = range.startContainer;
|
|
5597
|
-
let isInMddTopic = false;
|
|
5598
|
-
if (startContainer.nodeType === Node.ELEMENT_NODE && startContainer.tagName === "MDD-TOPIC") {
|
|
5599
|
-
isInMddTopic = true;
|
|
5600
|
-
} else if (startContainer.nodeType === Node.TEXT_NODE) {
|
|
5601
|
-
const parent = startContainer.parentNode;
|
|
5602
|
-
if (parent.tagName === "MDD-TOPIC") {
|
|
5603
|
-
isInMddTopic = true;
|
|
5604
|
-
}
|
|
5605
|
-
}
|
|
5606
|
-
if (isInMddTopic) {
|
|
5607
|
-
if (event.key === "Enter") {
|
|
5608
|
-
event.preventDefault();
|
|
5609
|
-
return;
|
|
5610
|
-
}
|
|
5611
|
-
const isPrintableKey = event.key.length === 1;
|
|
5612
|
-
if (isPrintableKey) {
|
|
5613
|
-
event.preventDefault();
|
|
5614
|
-
return;
|
|
5615
|
-
}
|
|
5616
|
-
}
|
|
5617
|
-
if ((event.key === "Backspace" || event.key === "Delete") && isInMddTopic) {
|
|
6481
|
+
const selection = window.getSelection();
|
|
6482
|
+
if (selection.rangeCount > 0) {
|
|
6483
|
+
const range = selection.getRangeAt(0);
|
|
6484
|
+
const startContainer = range.startContainer;
|
|
5618
6485
|
if (startContainer.nodeType === Node.ELEMENT_NODE && startContainer.tagName === "MDD-TOPIC") {
|
|
5619
6486
|
startContainer.remove();
|
|
5620
6487
|
event.preventDefault();
|
|
@@ -5627,6 +6494,228 @@
|
|
|
5627
6494
|
return;
|
|
5628
6495
|
}
|
|
5629
6496
|
}
|
|
6497
|
+
let currentParagraph = startContainer;
|
|
6498
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6499
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6500
|
+
}
|
|
6501
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
6502
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6503
|
+
}
|
|
6504
|
+
if (currentParagraph && event.key === "Backspace") {
|
|
6505
|
+
const container = range.startContainer;
|
|
6506
|
+
const offset = range.startOffset;
|
|
6507
|
+
let isAtParagraphStart = false;
|
|
6508
|
+
let cursorBeforeContent = null;
|
|
6509
|
+
if (container === currentParagraph && offset === 0) {
|
|
6510
|
+
isAtParagraphStart = true;
|
|
6511
|
+
cursorBeforeContent = currentParagraph.firstChild;
|
|
6512
|
+
} else if (container.nodeType === Node.TEXT_NODE && offset === 0) {
|
|
6513
|
+
let isFirstContent = true;
|
|
6514
|
+
let currentNode = currentParagraph.firstChild;
|
|
6515
|
+
while (currentNode && currentNode !== container) {
|
|
6516
|
+
if (currentNode.nodeType === Node.TEXT_NODE && currentNode.textContent.trim() !== "") {
|
|
6517
|
+
isFirstContent = false;
|
|
6518
|
+
break;
|
|
6519
|
+
} else if (currentNode.nodeType === Node.ELEMENT_NODE) {
|
|
6520
|
+
isFirstContent = false;
|
|
6521
|
+
break;
|
|
6522
|
+
}
|
|
6523
|
+
currentNode = currentNode.nextSibling;
|
|
6524
|
+
}
|
|
6525
|
+
if (isFirstContent) {
|
|
6526
|
+
isAtParagraphStart = true;
|
|
6527
|
+
cursorBeforeContent = container;
|
|
6528
|
+
}
|
|
6529
|
+
} else if (container === currentParagraph && offset > 0) {
|
|
6530
|
+
let hasContentBefore = false;
|
|
6531
|
+
for (let i = 0; i < offset; i++) {
|
|
6532
|
+
const node = currentParagraph.childNodes[i];
|
|
6533
|
+
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== "") {
|
|
6534
|
+
hasContentBefore = true;
|
|
6535
|
+
break;
|
|
6536
|
+
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
6537
|
+
hasContentBefore = true;
|
|
6538
|
+
break;
|
|
6539
|
+
}
|
|
6540
|
+
}
|
|
6541
|
+
if (!hasContentBefore && offset < currentParagraph.childNodes.length) {
|
|
6542
|
+
isAtParagraphStart = true;
|
|
6543
|
+
cursorBeforeContent = currentParagraph.childNodes[offset];
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
if (isAtParagraphStart) {
|
|
6547
|
+
const prevParagraph = currentParagraph.previousElementSibling;
|
|
6548
|
+
if (prevParagraph && prevParagraph.classList.contains("halo-paragraph")) {
|
|
6549
|
+
const prevContent = prevParagraph.innerHTML.trim();
|
|
6550
|
+
if (prevContent === "<br>" || prevContent === "") {
|
|
6551
|
+
prevParagraph.remove();
|
|
6552
|
+
event.preventDefault();
|
|
6553
|
+
me2.updateData(true);
|
|
6554
|
+
return;
|
|
6555
|
+
} else {
|
|
6556
|
+
const mergePoint = prevParagraph.childNodes.length;
|
|
6557
|
+
if (prevParagraph.lastChild && prevParagraph.lastChild.tagName === "BR") {
|
|
6558
|
+
prevParagraph.removeChild(prevParagraph.lastChild);
|
|
6559
|
+
}
|
|
6560
|
+
const nodesToMove = Array.from(currentParagraph.childNodes);
|
|
6561
|
+
nodesToMove.forEach((node) => {
|
|
6562
|
+
prevParagraph.appendChild(node);
|
|
6563
|
+
});
|
|
6564
|
+
currentParagraph.remove();
|
|
6565
|
+
const newRange = document.createRange();
|
|
6566
|
+
if (cursorBeforeContent && prevParagraph.contains(cursorBeforeContent)) {
|
|
6567
|
+
newRange.setStartBefore(cursorBeforeContent);
|
|
6568
|
+
} else {
|
|
6569
|
+
if (mergePoint < prevParagraph.childNodes.length) {
|
|
6570
|
+
newRange.setStartBefore(prevParagraph.childNodes[mergePoint]);
|
|
6571
|
+
} else {
|
|
6572
|
+
newRange.setStart(prevParagraph, prevParagraph.childNodes.length);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
newRange.collapse(true);
|
|
6576
|
+
const selection2 = window.getSelection();
|
|
6577
|
+
selection2.removeAllRanges();
|
|
6578
|
+
selection2.addRange(newRange);
|
|
6579
|
+
event.preventDefault();
|
|
6580
|
+
me2.updateData(true);
|
|
6581
|
+
return;
|
|
6582
|
+
}
|
|
6583
|
+
}
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
if (event.key === "Enter") {
|
|
6589
|
+
const selection = window.getSelection();
|
|
6590
|
+
if (selection.rangeCount > 0) {
|
|
6591
|
+
const range = selection.getRangeAt(0);
|
|
6592
|
+
const startContainer = range.startContainer;
|
|
6593
|
+
let currentParagraph = startContainer;
|
|
6594
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6595
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6596
|
+
}
|
|
6597
|
+
while (currentParagraph && !((_b = currentParagraph.classList) == null ? void 0 : _b.contains("halo-paragraph"))) {
|
|
6598
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6599
|
+
}
|
|
6600
|
+
if (!(currentParagraph == null ? void 0 : currentParagraph.querySelector("mdd-topic"))) {
|
|
6601
|
+
return;
|
|
6602
|
+
}
|
|
6603
|
+
if (me2.isBetweenTwoTopics(range)) {
|
|
6604
|
+
event.preventDefault();
|
|
6605
|
+
me2.handleEnterBetweenTopics(range);
|
|
6606
|
+
return;
|
|
6607
|
+
}
|
|
6608
|
+
if (me2.wouldCreateNestedParagraph(range)) {
|
|
6609
|
+
event.preventDefault();
|
|
6610
|
+
me2.handleEnterKeyInParagraphWithTopic(range);
|
|
6611
|
+
return;
|
|
6612
|
+
}
|
|
6613
|
+
if (currentParagraph && currentParagraph.querySelector("mdd-topic")) {
|
|
6614
|
+
event.preventDefault();
|
|
6615
|
+
me2.handleEnterKeyInParagraphWithTopic(range);
|
|
6616
|
+
return;
|
|
6617
|
+
}
|
|
6618
|
+
}
|
|
6619
|
+
}
|
|
6620
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "ArrowLeft") {
|
|
6621
|
+
const selection = window.getSelection();
|
|
6622
|
+
if (selection.rangeCount > 0) {
|
|
6623
|
+
const range = selection.getRangeAt(0);
|
|
6624
|
+
const container = range.startContainer;
|
|
6625
|
+
let currentParagraph = container;
|
|
6626
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6627
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6628
|
+
}
|
|
6629
|
+
while (currentParagraph && !((_c = currentParagraph.classList) == null ? void 0 : _c.contains("halo-paragraph"))) {
|
|
6630
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6631
|
+
}
|
|
6632
|
+
if (currentParagraph) {
|
|
6633
|
+
const firstTopic = currentParagraph.querySelector("mdd-topic");
|
|
6634
|
+
if (firstTopic) {
|
|
6635
|
+
let hasTextBeforeTopic = false;
|
|
6636
|
+
let currentNode = currentParagraph.firstChild;
|
|
6637
|
+
while (currentNode && currentNode !== firstTopic) {
|
|
6638
|
+
if (currentNode.nodeType === Node.TEXT_NODE && currentNode.textContent.trim() !== "") {
|
|
6639
|
+
hasTextBeforeTopic = true;
|
|
6640
|
+
break;
|
|
6641
|
+
}
|
|
6642
|
+
currentNode = currentNode.nextSibling;
|
|
6643
|
+
}
|
|
6644
|
+
if (hasTextBeforeTopic) {
|
|
6645
|
+
if (container === currentParagraph && range.startOffset === 0) {
|
|
6646
|
+
return;
|
|
6647
|
+
}
|
|
6648
|
+
let shouldMoveToStart = false;
|
|
6649
|
+
const offset2 = range.startOffset;
|
|
6650
|
+
if (container.nodeType === Node.TEXT_NODE && container.parentNode === firstTopic) {
|
|
6651
|
+
shouldMoveToStart = true;
|
|
6652
|
+
} else if (container === firstTopic) {
|
|
6653
|
+
shouldMoveToStart = true;
|
|
6654
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
6655
|
+
let prevSibling = container.previousSibling;
|
|
6656
|
+
while (prevSibling) {
|
|
6657
|
+
if (prevSibling === firstTopic) {
|
|
6658
|
+
shouldMoveToStart = true;
|
|
6659
|
+
break;
|
|
6660
|
+
}
|
|
6661
|
+
prevSibling = prevSibling.previousSibling;
|
|
6662
|
+
}
|
|
6663
|
+
} else if (container === currentParagraph) {
|
|
6664
|
+
const topicRange = document.createRange();
|
|
6665
|
+
topicRange.selectNode(firstTopic);
|
|
6666
|
+
const cursorRange = document.createRange();
|
|
6667
|
+
cursorRange.setStart(container, offset2);
|
|
6668
|
+
cursorRange.collapse(true);
|
|
6669
|
+
if (cursorRange.compareBoundaryPoints(Range.START_TO_END, topicRange) > 0) {
|
|
6670
|
+
shouldMoveToStart = true;
|
|
6671
|
+
}
|
|
6672
|
+
}
|
|
6673
|
+
if (shouldMoveToStart) {
|
|
6674
|
+
event.preventDefault();
|
|
6675
|
+
event.stopPropagation();
|
|
6676
|
+
const newRange = document.createRange();
|
|
6677
|
+
newRange.setStart(currentParagraph, 0);
|
|
6678
|
+
newRange.collapse(true);
|
|
6679
|
+
const selection2 = window.getSelection();
|
|
6680
|
+
selection2.removeAllRanges();
|
|
6681
|
+
selection2.addRange(newRange);
|
|
6682
|
+
return false;
|
|
6683
|
+
}
|
|
6684
|
+
return;
|
|
6685
|
+
}
|
|
6686
|
+
let shouldMoveToTopicStart = false;
|
|
6687
|
+
const offset = range.startOffset;
|
|
6688
|
+
if (container.nodeType === Node.TEXT_NODE && container.parentNode === firstTopic) {
|
|
6689
|
+
shouldMoveToTopicStart = true;
|
|
6690
|
+
} else if (container === firstTopic) {
|
|
6691
|
+
shouldMoveToTopicStart = true;
|
|
6692
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
6693
|
+
let prevSibling = container.previousSibling;
|
|
6694
|
+
while (prevSibling) {
|
|
6695
|
+
if (prevSibling === firstTopic) {
|
|
6696
|
+
shouldMoveToTopicStart = true;
|
|
6697
|
+
break;
|
|
6698
|
+
}
|
|
6699
|
+
prevSibling = prevSibling.previousSibling;
|
|
6700
|
+
}
|
|
6701
|
+
} else if (container === currentParagraph) {
|
|
6702
|
+
const topicRange = document.createRange();
|
|
6703
|
+
topicRange.selectNode(firstTopic);
|
|
6704
|
+
const cursorRange = document.createRange();
|
|
6705
|
+
cursorRange.setStart(container, offset);
|
|
6706
|
+
cursorRange.collapse(true);
|
|
6707
|
+
if (cursorRange.compareBoundaryPoints(Range.START_TO_END, topicRange) > 0) {
|
|
6708
|
+
shouldMoveToTopicStart = true;
|
|
6709
|
+
}
|
|
6710
|
+
}
|
|
6711
|
+
if (shouldMoveToTopicStart) {
|
|
6712
|
+
event.preventDefault();
|
|
6713
|
+
event.stopPropagation();
|
|
6714
|
+
me2.setCursorBeforeElement(firstTopic);
|
|
6715
|
+
return false;
|
|
6716
|
+
}
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
5630
6719
|
}
|
|
5631
6720
|
}
|
|
5632
6721
|
});
|
|
@@ -5689,7 +6778,6 @@
|
|
|
5689
6778
|
this.insertElement(p);
|
|
5690
6779
|
};
|
|
5691
6780
|
window.Squire.prototype.makeHeader = function(content, config = { makeHeader: {} }) {
|
|
5692
|
-
console.log(content);
|
|
5693
6781
|
if (content) {
|
|
5694
6782
|
const h2 = this.createElement("h2", {
|
|
5695
6783
|
class: "halo-paragraph-title"
|
|
@@ -5715,6 +6803,7 @@
|
|
|
5715
6803
|
window.Squire.empty(block)
|
|
5716
6804
|
]);
|
|
5717
6805
|
output.appendChild(
|
|
6806
|
+
// 段落才能添加标题
|
|
5718
6807
|
Array.from(block.classList).indexOf("halo-img-content") > -1 ? block : container
|
|
5719
6808
|
);
|
|
5720
6809
|
}
|
|
@@ -5722,7 +6811,6 @@
|
|
|
5722
6811
|
});
|
|
5723
6812
|
const selection = window.getSelection();
|
|
5724
6813
|
const range = document.createRange();
|
|
5725
|
-
console.log(container);
|
|
5726
6814
|
range.setStart(container, 1);
|
|
5727
6815
|
range.collapse(true);
|
|
5728
6816
|
selection.removeAllRanges();
|
|
@@ -5738,18 +6826,18 @@
|
|
|
5738
6826
|
});
|
|
5739
6827
|
loading.innerHTML = `
|
|
5740
6828
|
<img class="img-loading-icon" src="/img/upload-image-loading.png"/>
|
|
5741
|
-
<span class="img-loading-tip"
|
|
6829
|
+
<span class="img-loading-tip">上传中...</span>
|
|
5742
6830
|
`;
|
|
5743
6831
|
var fail = this.createElement("div", {
|
|
5744
6832
|
class: "img-fail hide",
|
|
5745
6833
|
contenteditable: "false"
|
|
5746
6834
|
});
|
|
5747
|
-
fail.innerHTML = "
|
|
6835
|
+
fail.innerHTML = "上传失败<br>请下载图片至本地后重新上传";
|
|
5748
6836
|
var again = this.createElement("button", {
|
|
5749
6837
|
class: "img-again hide",
|
|
5750
6838
|
contenteditable: "false"
|
|
5751
6839
|
});
|
|
5752
|
-
again.innerHTML = "
|
|
6840
|
+
again.innerHTML = "重新上传";
|
|
5753
6841
|
const isGif = src && src.indexOf(".gif") > -1;
|
|
5754
6842
|
if (isGif) {
|
|
5755
6843
|
src = src.replace(".gif", ".gif!nowater");
|
|
@@ -5804,7 +6892,7 @@
|
|
|
5804
6892
|
});
|
|
5805
6893
|
div.innerHTML = `
|
|
5806
6894
|
<div class="video-progress">
|
|
5807
|
-
<div class="label"
|
|
6895
|
+
<div class="label">上传中...</div>
|
|
5808
6896
|
<div class="box">
|
|
5809
6897
|
<div class="inner" style="width:20%"></div>
|
|
5810
6898
|
</div>
|
|
@@ -5827,6 +6915,7 @@
|
|
|
5827
6915
|
data: JSON.stringify(data),
|
|
5828
6916
|
"data-content": data.content || "",
|
|
5829
6917
|
poster: data.img || ""
|
|
6918
|
+
// 'contenteditable': 'true',
|
|
5830
6919
|
});
|
|
5831
6920
|
var delBtn = me2.genIconDom({
|
|
5832
6921
|
class: "pointer video-delete icon",
|
|
@@ -5836,7 +6925,6 @@
|
|
|
5836
6925
|
e.stopPropagation();
|
|
5837
6926
|
}
|
|
5838
6927
|
});
|
|
5839
|
-
console.log(delBtn);
|
|
5840
6928
|
const posterBtn = me2.insertVideoBtns(this, video);
|
|
5841
6929
|
var p = this.createElement(
|
|
5842
6930
|
"DIV",
|
|
@@ -5885,6 +6973,7 @@
|
|
|
5885
6973
|
}
|
|
5886
6974
|
};
|
|
5887
6975
|
},
|
|
6976
|
+
// 撤销重做 会把 所有的监听全都移除,所以需要重新绑定
|
|
5888
6977
|
setListener(dom) {
|
|
5889
6978
|
const me2 = this;
|
|
5890
6979
|
const doms = dom ? [dom] : Array.from(this.editorDom.children);
|
|
@@ -5895,7 +6984,7 @@
|
|
|
5895
6984
|
p.onclick = function(e) {
|
|
5896
6985
|
var _a;
|
|
5897
6986
|
if (area.nodeName === "VIDEO" && ((_a = me2.selectDom) == null ? void 0 : _a.className) === "halo-video-content") {
|
|
5898
|
-
me2.setToast("
|
|
6987
|
+
me2.setToast("不支持播放");
|
|
5899
6988
|
}
|
|
5900
6989
|
if (e.target.className.includes("desc-input")) {
|
|
5901
6990
|
return;
|
|
@@ -5959,6 +7048,7 @@
|
|
|
5959
7048
|
};
|
|
5960
7049
|
return del;
|
|
5961
7050
|
},
|
|
7051
|
+
// 转换数据,返回给业务
|
|
5962
7052
|
getEditorData() {
|
|
5963
7053
|
const me2 = this;
|
|
5964
7054
|
const children = Array.from(me2.editorDom.children);
|
|
@@ -6016,9 +7106,11 @@
|
|
|
6016
7106
|
videoIds
|
|
6017
7107
|
};
|
|
6018
7108
|
},
|
|
7109
|
+
// 是否是摩托范的图片
|
|
6019
7110
|
isHaloImage(url = "") {
|
|
6020
7111
|
return url.indexOf("jddmoto") > -1 || url.indexOf("58moto") > -1 || url.indexOf("emotofine") > -1 || url.indexOf("dronefine") > -1;
|
|
6021
7112
|
},
|
|
7113
|
+
// 获取待上传图片列表
|
|
6022
7114
|
updateUploads() {
|
|
6023
7115
|
const me2 = this;
|
|
6024
7116
|
setTimeout(() => {
|
|
@@ -6065,8 +7157,8 @@
|
|
|
6065
7157
|
const currentImg = me2.uploadStore[key];
|
|
6066
7158
|
const imageUrl = key.split("|")[1] || "";
|
|
6067
7159
|
if (!currentImg) {
|
|
6068
|
-
console.log("
|
|
6069
|
-
return Promise.reject("
|
|
7160
|
+
console.log("图片不存在", key);
|
|
7161
|
+
return Promise.reject("图片不存在");
|
|
6070
7162
|
}
|
|
6071
7163
|
const parent = currentImg.parentNode || "";
|
|
6072
7164
|
const uploadFailHandler = (currentImg2) => {
|
|
@@ -6110,6 +7202,7 @@
|
|
|
6110
7202
|
parent && uploadFailHandler(currentImg);
|
|
6111
7203
|
});
|
|
6112
7204
|
},
|
|
7205
|
+
// 更新上传的图片
|
|
6113
7206
|
updateImage(img, currentImg = {}) {
|
|
6114
7207
|
const data = JSON.parse(currentImg.getAttribute("data") || "{}");
|
|
6115
7208
|
data.img = img;
|
|
@@ -6132,6 +7225,7 @@
|
|
|
6132
7225
|
parent.appendChild(arr[2]);
|
|
6133
7226
|
}
|
|
6134
7227
|
},
|
|
7228
|
+
// 获取ctrl + v 后内容
|
|
6135
7229
|
getSticker(type, handler) {
|
|
6136
7230
|
this.setSticker(type.fragment.children);
|
|
6137
7231
|
},
|
|
@@ -6149,6 +7243,7 @@
|
|
|
6149
7243
|
});
|
|
6150
7244
|
this.updateData(true);
|
|
6151
7245
|
},
|
|
7246
|
+
// 粘贴
|
|
6152
7247
|
setSticker(data) {
|
|
6153
7248
|
const me2 = this;
|
|
6154
7249
|
data = Array.from(data);
|
|
@@ -6187,6 +7282,7 @@
|
|
|
6187
7282
|
const me2 = this;
|
|
6188
7283
|
me2.updateData();
|
|
6189
7284
|
},
|
|
7285
|
+
// 监测 添加、撤回、恢复、删除
|
|
6190
7286
|
setBack(e, type) {
|
|
6191
7287
|
const me2 = this;
|
|
6192
7288
|
me2.refreshImg();
|
|
@@ -6219,6 +7315,7 @@
|
|
|
6219
7315
|
}
|
|
6220
7316
|
});
|
|
6221
7317
|
},
|
|
7318
|
+
// 设置scoll
|
|
6222
7319
|
sticky() {
|
|
6223
7320
|
const me2 = this;
|
|
6224
7321
|
me2.$nextTick(function() {
|
|
@@ -6238,6 +7335,8 @@
|
|
|
6238
7335
|
document.addEventListener("scroll", onScroll);
|
|
6239
7336
|
});
|
|
6240
7337
|
},
|
|
7338
|
+
// ==========toolbox==========
|
|
7339
|
+
// 撤回、恢复、段落标题
|
|
6241
7340
|
setContent(e, obj) {
|
|
6242
7341
|
const me2 = this;
|
|
6243
7342
|
const id = e.target.id || e.target.dataset.editorId;
|
|
@@ -6279,10 +7378,11 @@
|
|
|
6279
7378
|
this.fontInfo = this.editor.getFontInfo();
|
|
6280
7379
|
this.updateData(true);
|
|
6281
7380
|
},
|
|
7381
|
+
// 增加link
|
|
6282
7382
|
addLink(type) {
|
|
6283
7383
|
const me2 = this;
|
|
6284
|
-
me2.linkTitleName = type === "link" ? "
|
|
6285
|
-
me2.linkPlaceholder = type === "link" ? "
|
|
7384
|
+
me2.linkTitleName = type === "link" ? "添加链接" : "添加导入链接地址";
|
|
7385
|
+
me2.linkPlaceholder = type === "link" ? "请输入链接地址" : "仅支持输入微信链接";
|
|
6286
7386
|
me2.viewStatus = true;
|
|
6287
7387
|
me2.linkStatus = true;
|
|
6288
7388
|
},
|
|
@@ -6290,29 +7390,31 @@
|
|
|
6290
7390
|
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.,;?'&%$#=~_-]+))*$/;
|
|
6291
7391
|
return objExp.test(url);
|
|
6292
7392
|
},
|
|
7393
|
+
// 确认增加link
|
|
6293
7394
|
confirmLink() {
|
|
6294
7395
|
const me2 = this;
|
|
6295
7396
|
if (!me2.linkContent) {
|
|
6296
|
-
return elementPlus.ElMessage.error("
|
|
7397
|
+
return elementPlus.ElMessage.error("请输入链接地址!");
|
|
6297
7398
|
}
|
|
6298
|
-
if (me2.linkTitleName === "
|
|
7399
|
+
if (me2.linkTitleName === "添加导入链接地址" || this.visibleCollectArticle) {
|
|
6299
7400
|
this.visibleCollectArticle = false;
|
|
6300
7401
|
return me2.importLinkData();
|
|
6301
7402
|
}
|
|
6302
7403
|
if (!this.validUrl(me2.linkContent)) {
|
|
6303
|
-
return me2.setToast("URL
|
|
7404
|
+
return me2.setToast("URL无效");
|
|
6304
7405
|
}
|
|
6305
7406
|
if (!me2.isHaloImage(me2.linkContent)) {
|
|
6306
|
-
return me2.setToast("
|
|
7407
|
+
return me2.setToast("请输入摩托范内部网址");
|
|
6307
7408
|
}
|
|
6308
7409
|
me2.editor["insertLink"](me2.linkContent);
|
|
6309
7410
|
me2.linkContent = "";
|
|
6310
7411
|
me2.closeDialog();
|
|
6311
7412
|
},
|
|
7413
|
+
// 增加link导入数据
|
|
6312
7414
|
importLinkData() {
|
|
6313
7415
|
const me2 = this;
|
|
6314
7416
|
if (me2.loading) {
|
|
6315
|
-
return elementPlus.ElMessage("
|
|
7417
|
+
return elementPlus.ElMessage("正在获取信息,请稍后...");
|
|
6316
7418
|
}
|
|
6317
7419
|
me2.loading = true;
|
|
6318
7420
|
const params = {
|
|
@@ -6334,38 +7436,444 @@
|
|
|
6334
7436
|
me2.linkContent = "";
|
|
6335
7437
|
return;
|
|
6336
7438
|
} else {
|
|
6337
|
-
me2.setToast("
|
|
7439
|
+
me2.setToast("导入失败,请重试");
|
|
6338
7440
|
}
|
|
6339
7441
|
}).catch((err) => {
|
|
6340
7442
|
console.log(err.message);
|
|
6341
|
-
me2.setToast("
|
|
7443
|
+
me2.setToast("导入异常,请重试");
|
|
6342
7444
|
}).finally((_) => {
|
|
6343
7445
|
me2.loading = false;
|
|
6344
7446
|
});
|
|
6345
7447
|
},
|
|
7448
|
+
// 打开 图片、视频、一键导入 弹框
|
|
6346
7449
|
openDialog(name) {
|
|
6347
7450
|
const me2 = this;
|
|
6348
|
-
me2.viewName = name === "img" ? "
|
|
6349
|
-
me2.viewButton = name === "img" ? "
|
|
6350
|
-
me2.viewTip = name === "img" ? "" : "
|
|
7451
|
+
me2.viewName = name === "img" ? "添加图片" : "添加视频";
|
|
7452
|
+
me2.viewButton = name === "img" ? "选择图片" : "选择视频";
|
|
7453
|
+
me2.viewTip = name === "img" ? "" : "为了获得更高的推荐和点击量,建议上传720p(1280*720),大小不超过500MB(视频上传需要时间,请耐心等待)";
|
|
6351
7454
|
me2.viewStatus = true;
|
|
6352
7455
|
},
|
|
7456
|
+
// 关闭弹框
|
|
6353
7457
|
closeDialog() {
|
|
6354
7458
|
this.viewStatus = false;
|
|
6355
7459
|
this.linkStatus = false;
|
|
6356
7460
|
this.linkContent = "";
|
|
6357
7461
|
},
|
|
7462
|
+
// ==========toolbox end==========
|
|
7463
|
+
// 弹框提示
|
|
6358
7464
|
setToast(content) {
|
|
6359
7465
|
elementPlus.ElMessage.error(content);
|
|
6360
7466
|
},
|
|
6361
7467
|
setMessageBoxNoCancel(content) {
|
|
6362
7468
|
elementPlus.ElMessageBox.confirm(content, "", {
|
|
6363
|
-
confirmButtonText: "
|
|
6364
|
-
cancelButtonText: "
|
|
7469
|
+
confirmButtonText: "确定",
|
|
7470
|
+
cancelButtonText: "取消",
|
|
6365
7471
|
type: "warning"
|
|
6366
7472
|
}).then(() => {
|
|
6367
7473
|
}).catch(() => {
|
|
6368
7474
|
});
|
|
7475
|
+
},
|
|
7476
|
+
// 检查是否会创建嵌套的halo-paragraph
|
|
7477
|
+
wouldCreateNestedParagraph(range) {
|
|
7478
|
+
let container = range.startContainer;
|
|
7479
|
+
while (container && container !== this.editorDom) {
|
|
7480
|
+
if (container.nodeType === Node.ELEMENT_NODE && container.classList && container.classList.contains("halo-paragraph")) {
|
|
7481
|
+
return true;
|
|
7482
|
+
}
|
|
7483
|
+
container = container.parentNode;
|
|
7484
|
+
}
|
|
7485
|
+
return false;
|
|
7486
|
+
},
|
|
7487
|
+
// 检查光标是否在两个连续的mdd-topic之间
|
|
7488
|
+
isBetweenTwoTopics(range) {
|
|
7489
|
+
const container = range.startContainer;
|
|
7490
|
+
const offset = range.startOffset;
|
|
7491
|
+
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7492
|
+
const prevElement = container.childNodes[offset - 1];
|
|
7493
|
+
const nextElement = container.childNodes[offset];
|
|
7494
|
+
return prevElement && prevElement.tagName === "MDD-TOPIC" && (nextElement && nextElement.tagName === "MDD-TOPIC");
|
|
7495
|
+
}
|
|
7496
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent.trim() === "") {
|
|
7497
|
+
const prevSibling = container.previousSibling;
|
|
7498
|
+
const nextSibling = container.nextSibling;
|
|
7499
|
+
return prevSibling && prevSibling.tagName === "MDD-TOPIC" && (nextSibling && nextSibling.tagName === "MDD-TOPIC");
|
|
7500
|
+
}
|
|
7501
|
+
return false;
|
|
7502
|
+
},
|
|
7503
|
+
// 处理两个话题之间的回车或话题前面的回车
|
|
7504
|
+
handleEnterBetweenTopics(range) {
|
|
7505
|
+
var _a;
|
|
7506
|
+
const me2 = this;
|
|
7507
|
+
let currentParagraph = range.startContainer;
|
|
7508
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
7509
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7510
|
+
}
|
|
7511
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
7512
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7513
|
+
}
|
|
7514
|
+
if (!currentParagraph)
|
|
7515
|
+
return;
|
|
7516
|
+
const newParagraph = document.createElement("p");
|
|
7517
|
+
newParagraph.className = "halo-paragraph";
|
|
7518
|
+
const afterContent = me2.extractContentAfterCursorPrecise(range, currentParagraph);
|
|
7519
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7520
|
+
while (afterContent.firstChild) {
|
|
7521
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7522
|
+
}
|
|
7523
|
+
} else {
|
|
7524
|
+
newParagraph.innerHTML = "<br>";
|
|
7525
|
+
}
|
|
7526
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7527
|
+
const newRange = document.createRange();
|
|
7528
|
+
if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.TEXT_NODE) {
|
|
7529
|
+
newRange.setStart(newParagraph.firstChild, 0);
|
|
7530
|
+
} else if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.ELEMENT_NODE) {
|
|
7531
|
+
newRange.setStart(newParagraph, 0);
|
|
7532
|
+
} else {
|
|
7533
|
+
newRange.setStart(newParagraph, 0);
|
|
7534
|
+
}
|
|
7535
|
+
newRange.collapse(true);
|
|
7536
|
+
const selection = window.getSelection();
|
|
7537
|
+
selection.removeAllRanges();
|
|
7538
|
+
selection.addRange(newRange);
|
|
7539
|
+
me2.updateData(true);
|
|
7540
|
+
},
|
|
7541
|
+
// 更精确地提取光标后的内容(专门用于话题分割)
|
|
7542
|
+
extractContentAfterCursorPrecise(range, paragraph) {
|
|
7543
|
+
const fragment = document.createDocumentFragment();
|
|
7544
|
+
const container = range.startContainer;
|
|
7545
|
+
const offset = range.startOffset;
|
|
7546
|
+
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7547
|
+
const childNodes = Array.from(container.childNodes);
|
|
7548
|
+
for (let i = offset; i < childNodes.length; i++) {
|
|
7549
|
+
fragment.appendChild(childNodes[i]);
|
|
7550
|
+
}
|
|
7551
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
7552
|
+
if (offset < container.textContent.length) {
|
|
7553
|
+
const afterText = container.textContent.slice(offset);
|
|
7554
|
+
container.textContent = container.textContent.slice(0, offset);
|
|
7555
|
+
const textNode = document.createTextNode(afterText);
|
|
7556
|
+
fragment.appendChild(textNode);
|
|
7557
|
+
}
|
|
7558
|
+
let nextSibling = container.nextSibling;
|
|
7559
|
+
while (nextSibling) {
|
|
7560
|
+
const nodeToMove = nextSibling;
|
|
7561
|
+
nextSibling = nextSibling.nextSibling;
|
|
7562
|
+
fragment.appendChild(nodeToMove);
|
|
7563
|
+
}
|
|
7564
|
+
}
|
|
7565
|
+
return fragment;
|
|
7566
|
+
},
|
|
7567
|
+
// 处理包含话题的段落中的回车键
|
|
7568
|
+
handleEnterKeyInParagraphWithTopic(range) {
|
|
7569
|
+
var _a;
|
|
7570
|
+
const me2 = this;
|
|
7571
|
+
let currentParagraph = range.startContainer;
|
|
7572
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
7573
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7574
|
+
}
|
|
7575
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
7576
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7577
|
+
}
|
|
7578
|
+
if (!currentParagraph)
|
|
7579
|
+
return;
|
|
7580
|
+
const newParagraph = document.createElement("p");
|
|
7581
|
+
newParagraph.className = "halo-paragraph";
|
|
7582
|
+
const isAtTopicStart = me2.isCursorBeforeFirstTopic(range, currentParagraph);
|
|
7583
|
+
const isAtEnd = me2.isCursorAtEndOfParagraph(range, currentParagraph);
|
|
7584
|
+
if (isAtTopicStart) {
|
|
7585
|
+
const afterContent = me2.extractContentAfterCursor(range, currentParagraph);
|
|
7586
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7587
|
+
while (afterContent.firstChild) {
|
|
7588
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7589
|
+
}
|
|
7590
|
+
} else {
|
|
7591
|
+
newParagraph.innerHTML = "<br>";
|
|
7592
|
+
}
|
|
7593
|
+
if (currentParagraph.innerHTML.trim() === "" || currentParagraph.childNodes.length === 0) {
|
|
7594
|
+
currentParagraph.innerHTML = "<br>";
|
|
7595
|
+
}
|
|
7596
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7597
|
+
} else if (isAtEnd) {
|
|
7598
|
+
newParagraph.innerHTML = "<br>";
|
|
7599
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7600
|
+
} else {
|
|
7601
|
+
const afterContent = me2.extractContentAfterCursor(range, currentParagraph);
|
|
7602
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7603
|
+
let hasValidContent = false;
|
|
7604
|
+
for (let i = 0; i < afterContent.childNodes.length; i++) {
|
|
7605
|
+
const node = afterContent.childNodes[i];
|
|
7606
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
7607
|
+
if (node.textContent.trim() !== "") {
|
|
7608
|
+
hasValidContent = true;
|
|
7609
|
+
break;
|
|
7610
|
+
}
|
|
7611
|
+
} else {
|
|
7612
|
+
hasValidContent = true;
|
|
7613
|
+
break;
|
|
7614
|
+
}
|
|
7615
|
+
}
|
|
7616
|
+
if (hasValidContent) {
|
|
7617
|
+
while (afterContent.firstChild) {
|
|
7618
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7619
|
+
}
|
|
7620
|
+
} else {
|
|
7621
|
+
newParagraph.innerHTML = "<br>";
|
|
7622
|
+
}
|
|
7623
|
+
} else {
|
|
7624
|
+
newParagraph.innerHTML = "<br>";
|
|
7625
|
+
}
|
|
7626
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7627
|
+
}
|
|
7628
|
+
const newRange = document.createRange();
|
|
7629
|
+
if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.TEXT_NODE) {
|
|
7630
|
+
newRange.setStart(newParagraph.firstChild, 0);
|
|
7631
|
+
} else if (newParagraph.firstChild) {
|
|
7632
|
+
newRange.setStart(newParagraph, 0);
|
|
7633
|
+
} else {
|
|
7634
|
+
newRange.setStart(newParagraph, 0);
|
|
7635
|
+
}
|
|
7636
|
+
newRange.collapse(true);
|
|
7637
|
+
const selection = window.getSelection();
|
|
7638
|
+
selection.removeAllRanges();
|
|
7639
|
+
selection.addRange(newRange);
|
|
7640
|
+
me2.updateData(true);
|
|
7641
|
+
},
|
|
7642
|
+
// 检查光标是否在第一个话题前面
|
|
7643
|
+
isCursorBeforeFirstTopic(range, paragraph) {
|
|
7644
|
+
const container = range.startContainer;
|
|
7645
|
+
const offset = range.startOffset;
|
|
7646
|
+
const firstTopic = paragraph.querySelector("mdd-topic");
|
|
7647
|
+
if (!firstTopic) {
|
|
7648
|
+
return false;
|
|
7649
|
+
}
|
|
7650
|
+
if (container === paragraph && offset === 0) {
|
|
7651
|
+
return true;
|
|
7652
|
+
}
|
|
7653
|
+
if (container === paragraph && offset > 0 && offset <= paragraph.childNodes.length) {
|
|
7654
|
+
if (offset < paragraph.childNodes.length) {
|
|
7655
|
+
const nodeAtOffset = paragraph.childNodes[offset];
|
|
7656
|
+
if (nodeAtOffset === firstTopic) {
|
|
7657
|
+
return true;
|
|
7658
|
+
}
|
|
7659
|
+
}
|
|
7660
|
+
let nextNonEmptyNode = null;
|
|
7661
|
+
for (let i = offset; i < paragraph.childNodes.length; i++) {
|
|
7662
|
+
const node = paragraph.childNodes[i];
|
|
7663
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "MDD-TOPIC") {
|
|
7664
|
+
nextNonEmptyNode = node;
|
|
7665
|
+
break;
|
|
7666
|
+
} else if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== "") {
|
|
7667
|
+
break;
|
|
7668
|
+
}
|
|
7669
|
+
}
|
|
7670
|
+
if (nextNonEmptyNode === firstTopic) {
|
|
7671
|
+
return true;
|
|
7672
|
+
}
|
|
7673
|
+
}
|
|
7674
|
+
try {
|
|
7675
|
+
const topicRange = document.createRange();
|
|
7676
|
+
topicRange.setStartBefore(firstTopic);
|
|
7677
|
+
const comparison = topicRange.comparePoint(container, offset);
|
|
7678
|
+
if (comparison < 0) {
|
|
7679
|
+
return true;
|
|
7680
|
+
}
|
|
7681
|
+
} catch (e) {
|
|
7682
|
+
if (container.nodeType === Node.TEXT_NODE) {
|
|
7683
|
+
const tempRange = document.createRange();
|
|
7684
|
+
tempRange.setStart(container, offset);
|
|
7685
|
+
tempRange.collapse(true);
|
|
7686
|
+
const topicRange = document.createRange();
|
|
7687
|
+
topicRange.setStartBefore(firstTopic);
|
|
7688
|
+
if (tempRange.compareBoundaryPoints(Range.START_TO_START, topicRange) < 0) {
|
|
7689
|
+
return true;
|
|
7690
|
+
}
|
|
7691
|
+
}
|
|
7692
|
+
if (container === paragraph) {
|
|
7693
|
+
const testRange = document.createRange();
|
|
7694
|
+
testRange.setStart(paragraph, 0);
|
|
7695
|
+
testRange.setEnd(paragraph, offset);
|
|
7696
|
+
const containsTopic = testRange.intersectsNode(firstTopic);
|
|
7697
|
+
if (!containsTopic) {
|
|
7698
|
+
return true;
|
|
7699
|
+
}
|
|
7700
|
+
}
|
|
7701
|
+
}
|
|
7702
|
+
return false;
|
|
7703
|
+
},
|
|
7704
|
+
// 获取不包含mdd-topic内部文本的段落文本
|
|
7705
|
+
getParagraphTextExcludingTopics(paragraph, range) {
|
|
7706
|
+
let textContent = "";
|
|
7707
|
+
let cursorPosition = 0;
|
|
7708
|
+
let foundCursor = false;
|
|
7709
|
+
const walker = document.createTreeWalker(
|
|
7710
|
+
paragraph,
|
|
7711
|
+
NodeFilter.SHOW_ALL,
|
|
7712
|
+
{
|
|
7713
|
+
acceptNode: function(node2) {
|
|
7714
|
+
if (node2.nodeType === Node.ELEMENT_NODE && node2.tagName === "MDD-TOPIC") {
|
|
7715
|
+
return NodeFilter.FILTER_REJECT;
|
|
7716
|
+
}
|
|
7717
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
7718
|
+
}
|
|
7719
|
+
},
|
|
7720
|
+
false
|
|
7721
|
+
);
|
|
7722
|
+
let node;
|
|
7723
|
+
while (node = walker.nextNode()) {
|
|
7724
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
7725
|
+
const nodeText = node.textContent;
|
|
7726
|
+
if (!foundCursor && node === range.startContainer) {
|
|
7727
|
+
cursorPosition = textContent.length + range.startOffset;
|
|
7728
|
+
foundCursor = true;
|
|
7729
|
+
}
|
|
7730
|
+
textContent += nodeText;
|
|
7731
|
+
}
|
|
7732
|
+
}
|
|
7733
|
+
return { textContent, cursorPosition };
|
|
7734
|
+
},
|
|
7735
|
+
// 检查光标是否在段落开头
|
|
7736
|
+
isCursorAtStartOfParagraph(range, paragraph) {
|
|
7737
|
+
const { cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
7738
|
+
return cursorPosition === 0;
|
|
7739
|
+
},
|
|
7740
|
+
// 检查光标是否在段落末尾
|
|
7741
|
+
isCursorAtEndOfParagraph(range, paragraph) {
|
|
7742
|
+
const walker = document.createTreeWalker(
|
|
7743
|
+
paragraph,
|
|
7744
|
+
NodeFilter.SHOW_TEXT,
|
|
7745
|
+
{
|
|
7746
|
+
acceptNode: function(node2) {
|
|
7747
|
+
let parent = node2.parentNode;
|
|
7748
|
+
while (parent && parent !== paragraph) {
|
|
7749
|
+
if (parent.tagName === "MDD-TOPIC") {
|
|
7750
|
+
return NodeFilter.FILTER_REJECT;
|
|
7751
|
+
}
|
|
7752
|
+
parent = parent.parentNode;
|
|
7753
|
+
}
|
|
7754
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
7755
|
+
}
|
|
7756
|
+
},
|
|
7757
|
+
false
|
|
7758
|
+
);
|
|
7759
|
+
let totalLength = 0;
|
|
7760
|
+
let node;
|
|
7761
|
+
while (node = walker.nextNode()) {
|
|
7762
|
+
totalLength += node.textContent.length;
|
|
7763
|
+
}
|
|
7764
|
+
const { cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
7765
|
+
return cursorPosition >= totalLength;
|
|
7766
|
+
},
|
|
7767
|
+
// 获取当前段落
|
|
7768
|
+
getCurrentParagraph(range) {
|
|
7769
|
+
let container = range.startContainer;
|
|
7770
|
+
while (container && container !== this.editorDom) {
|
|
7771
|
+
if (container.nodeType === Node.ELEMENT_NODE && container.classList && container.classList.contains("halo-paragraph")) {
|
|
7772
|
+
return container;
|
|
7773
|
+
}
|
|
7774
|
+
container = container.parentNode;
|
|
7775
|
+
}
|
|
7776
|
+
return null;
|
|
7777
|
+
},
|
|
7778
|
+
// 提取光标后的内容
|
|
7779
|
+
extractContentAfterCursor(range, paragraph) {
|
|
7780
|
+
const fragment = document.createDocumentFragment();
|
|
7781
|
+
const container = range.startContainer;
|
|
7782
|
+
const offset = range.startOffset;
|
|
7783
|
+
let topicSpaceNode = null;
|
|
7784
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent === " " && container.previousSibling && container.previousSibling.tagName === "MDD-TOPIC") {
|
|
7785
|
+
topicSpaceNode = container;
|
|
7786
|
+
}
|
|
7787
|
+
const extractRange = document.createRange();
|
|
7788
|
+
let startNode = null;
|
|
7789
|
+
let hasContentToExtract = false;
|
|
7790
|
+
if (topicSpaceNode) {
|
|
7791
|
+
if (topicSpaceNode.nextSibling) {
|
|
7792
|
+
startNode = topicSpaceNode.nextSibling;
|
|
7793
|
+
hasContentToExtract = true;
|
|
7794
|
+
}
|
|
7795
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
7796
|
+
if (container.textContent === "" && offset === 0) {
|
|
7797
|
+
if (container.nextSibling) {
|
|
7798
|
+
startNode = container.nextSibling;
|
|
7799
|
+
hasContentToExtract = true;
|
|
7800
|
+
}
|
|
7801
|
+
} else if (offset < container.textContent.length) {
|
|
7802
|
+
const afterText = container.textContent.slice(offset);
|
|
7803
|
+
container.textContent = container.textContent.slice(0, offset);
|
|
7804
|
+
if (afterText.trim()) {
|
|
7805
|
+
const newTextNode = document.createTextNode(afterText);
|
|
7806
|
+
container.parentNode.insertBefore(newTextNode, container.nextSibling);
|
|
7807
|
+
startNode = newTextNode;
|
|
7808
|
+
hasContentToExtract = true;
|
|
7809
|
+
} else if (container.nextSibling) {
|
|
7810
|
+
startNode = container.nextSibling;
|
|
7811
|
+
hasContentToExtract = true;
|
|
7812
|
+
}
|
|
7813
|
+
} else {
|
|
7814
|
+
if (container.nextSibling) {
|
|
7815
|
+
startNode = container.nextSibling;
|
|
7816
|
+
hasContentToExtract = true;
|
|
7817
|
+
}
|
|
7818
|
+
}
|
|
7819
|
+
} else if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7820
|
+
if (offset < container.childNodes.length) {
|
|
7821
|
+
startNode = container.childNodes[offset];
|
|
7822
|
+
hasContentToExtract = true;
|
|
7823
|
+
} else if (offset === 0 && container === paragraph) {
|
|
7824
|
+
if (paragraph.firstChild) {
|
|
7825
|
+
startNode = paragraph.firstChild;
|
|
7826
|
+
hasContentToExtract = true;
|
|
7827
|
+
}
|
|
7828
|
+
}
|
|
7829
|
+
}
|
|
7830
|
+
if (!hasContentToExtract || !startNode) {
|
|
7831
|
+
return fragment;
|
|
7832
|
+
}
|
|
7833
|
+
if (!paragraph.contains(startNode)) {
|
|
7834
|
+
return fragment;
|
|
7835
|
+
}
|
|
7836
|
+
try {
|
|
7837
|
+
extractRange.setStartBefore(startNode);
|
|
7838
|
+
let lastNode = paragraph.lastChild;
|
|
7839
|
+
while (lastNode && lastNode.nodeType === Node.TEXT_NODE && lastNode.textContent === "" && // 只跳过完全空的文本节点
|
|
7840
|
+
lastNode !== startNode) {
|
|
7841
|
+
lastNode = lastNode.previousSibling;
|
|
7842
|
+
}
|
|
7843
|
+
if (lastNode) {
|
|
7844
|
+
extractRange.setEndAfter(lastNode);
|
|
7845
|
+
} else {
|
|
7846
|
+
extractRange.setEnd(paragraph, paragraph.childNodes.length);
|
|
7847
|
+
}
|
|
7848
|
+
const extractedContent = extractRange.extractContents();
|
|
7849
|
+
fragment.appendChild(extractedContent);
|
|
7850
|
+
} catch (e) {
|
|
7851
|
+
let currentNode = startNode;
|
|
7852
|
+
while (currentNode && currentNode.parentNode === paragraph) {
|
|
7853
|
+
const nextNode = currentNode.nextSibling;
|
|
7854
|
+
fragment.appendChild(currentNode);
|
|
7855
|
+
currentNode = nextNode;
|
|
7856
|
+
}
|
|
7857
|
+
}
|
|
7858
|
+
return fragment;
|
|
7859
|
+
},
|
|
7860
|
+
// 统一的光标设置方法 - 设置光标到元素后面
|
|
7861
|
+
setCursorAfterElement(element) {
|
|
7862
|
+
const newRange = document.createRange();
|
|
7863
|
+
newRange.setStartAfter(element);
|
|
7864
|
+
newRange.collapse(true);
|
|
7865
|
+
const selection = window.getSelection();
|
|
7866
|
+
selection.removeAllRanges();
|
|
7867
|
+
selection.addRange(newRange);
|
|
7868
|
+
},
|
|
7869
|
+
// 统一的光标设置方法 - 设置光标到元素前面
|
|
7870
|
+
setCursorBeforeElement(element) {
|
|
7871
|
+
const newRange = document.createRange();
|
|
7872
|
+
newRange.setStartBefore(element);
|
|
7873
|
+
newRange.collapse(true);
|
|
7874
|
+
const selection = window.getSelection();
|
|
7875
|
+
selection.removeAllRanges();
|
|
7876
|
+
selection.addRange(newRange);
|
|
6369
7877
|
}
|
|
6370
7878
|
},
|
|
6371
7879
|
beforeRouteLeave(to, from, next) {
|
|
@@ -6388,11 +7896,12 @@
|
|
|
6388
7896
|
const _component_ImgUpload = vue.resolveComponent("ImgUpload");
|
|
6389
7897
|
const _component_VideoUpload = vue.resolveComponent("VideoUpload");
|
|
6390
7898
|
const _component_CollectArticle = vue.resolveComponent("CollectArticle");
|
|
7899
|
+
const _component_TopicManager = vue.resolveComponent("TopicManager");
|
|
6391
7900
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
6392
7901
|
vue.withDirectives(vue.createElementVNode("div", {
|
|
6393
7902
|
style: vue.normalizeStyle({ textAlign: $options.align }),
|
|
6394
7903
|
class: "placeholder"
|
|
6395
|
-
},
|
|
7904
|
+
}, vue.toDisplayString($props.placeholder || "请输入正文"), 5), [
|
|
6396
7905
|
[vue.vShow, !$options.isInputing && !$data.titleCount && !$data.hasArticleCard]
|
|
6397
7906
|
]),
|
|
6398
7907
|
$data.overLine ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -6417,26 +7926,26 @@
|
|
|
6417
7926
|
vue.createVNode(_component_el_form, { model: $data.linkForm }, {
|
|
6418
7927
|
default: vue.withCtx(() => [
|
|
6419
7928
|
vue.createVNode(_component_el_form_item, {
|
|
6420
|
-
label: "
|
|
7929
|
+
label: "添加链接",
|
|
6421
7930
|
class: "link-title"
|
|
6422
7931
|
}, {
|
|
6423
7932
|
default: vue.withCtx(() => [
|
|
6424
7933
|
vue.createVNode(_component_el_input, {
|
|
6425
7934
|
modelValue: $data.linkForm.linkAddress,
|
|
6426
7935
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.linkForm.linkAddress = $event),
|
|
6427
|
-
placeholder: "
|
|
7936
|
+
placeholder: "请输入链接地址"
|
|
6428
7937
|
}, null, 8, ["modelValue"])
|
|
6429
7938
|
]),
|
|
6430
7939
|
_: 1
|
|
6431
7940
|
}),
|
|
6432
|
-
vue.createVNode(_component_el_form_item, { label: "
|
|
7941
|
+
vue.createVNode(_component_el_form_item, { label: "链接文案" }, {
|
|
6433
7942
|
default: vue.withCtx(() => [
|
|
6434
7943
|
vue.createVNode(_component_el_input, {
|
|
6435
7944
|
modelValue: $data.linkForm.linkWriting,
|
|
6436
7945
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.linkForm.linkWriting = $event),
|
|
6437
7946
|
type: "textarea",
|
|
6438
7947
|
autosize: "",
|
|
6439
|
-
placeholder: "
|
|
7948
|
+
placeholder: "请输入链接文案"
|
|
6440
7949
|
}, null, 8, ["modelValue"])
|
|
6441
7950
|
]),
|
|
6442
7951
|
_: 1
|
|
@@ -6449,18 +7958,18 @@
|
|
|
6449
7958
|
vue.createVNode(_component_el_button, {
|
|
6450
7959
|
onClick: _cache[3] || (_cache[3] = ($event) => $data.viewLinkDialog = false)
|
|
6451
7960
|
}, {
|
|
6452
|
-
default: vue.withCtx(() => [
|
|
6453
|
-
vue.createTextVNode("
|
|
6454
|
-
]),
|
|
7961
|
+
default: vue.withCtx(() => _cache[14] || (_cache[14] = [
|
|
7962
|
+
vue.createTextVNode("取 消")
|
|
7963
|
+
])),
|
|
6455
7964
|
_: 1
|
|
6456
7965
|
}),
|
|
6457
7966
|
vue.createVNode(_component_el_button, {
|
|
6458
7967
|
type: "primary",
|
|
6459
7968
|
onClick: $options.insertLink
|
|
6460
7969
|
}, {
|
|
6461
|
-
default: vue.withCtx(() => [
|
|
6462
|
-
vue.createTextVNode("
|
|
6463
|
-
]),
|
|
7970
|
+
default: vue.withCtx(() => _cache[15] || (_cache[15] = [
|
|
7971
|
+
vue.createTextVNode("确 定")
|
|
7972
|
+
])),
|
|
6464
7973
|
_: 1
|
|
6465
7974
|
}, 8, ["onClick"])
|
|
6466
7975
|
])
|
|
@@ -6518,7 +8027,14 @@
|
|
|
6518
8027
|
class: "replace-poster hide",
|
|
6519
8028
|
accept: "image/*",
|
|
6520
8029
|
onChange: _cache[13] || (_cache[13] = (...args) => $options.replacePoster && $options.replacePoster(...args))
|
|
6521
|
-
}, null, 32)
|
|
8030
|
+
}, null, 32),
|
|
8031
|
+
vue.createVNode(_component_TopicManager, {
|
|
8032
|
+
ref: "topicManager",
|
|
8033
|
+
"editor-dom": $data.editorDom,
|
|
8034
|
+
request: $props.request,
|
|
8035
|
+
onTopicInserted: $options.onTopicInserted,
|
|
8036
|
+
onUpdateTopicPosition: $options.updateTopicPosition
|
|
8037
|
+
}, null, 8, ["editor-dom", "request", "onTopicInserted", "onUpdateTopicPosition"])
|
|
6522
8038
|
]);
|
|
6523
8039
|
}
|
|
6524
8040
|
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
@@ -6538,7 +8054,7 @@
|
|
|
6538
8054
|
var COLOUR_CLASS = "colour";
|
|
6539
8055
|
var FONT_FAMILY_CLASS = "font";
|
|
6540
8056
|
var FONT_SIZE_CLASS = "size";
|
|
6541
|
-
var ZWS = "
|
|
8057
|
+
var ZWS = "";
|
|
6542
8058
|
var win = doc.defaultView;
|
|
6543
8059
|
var ua = navigator.userAgent;
|
|
6544
8060
|
var isAndroid = /Android/.test(ua);
|
|
@@ -6568,11 +8084,17 @@
|
|
|
6568
8084
|
};
|
|
6569
8085
|
}
|
|
6570
8086
|
var typeToBitArray = {
|
|
8087
|
+
// ELEMENT_NODE
|
|
6571
8088
|
1: 1,
|
|
8089
|
+
// ATTRIBUTE_NODE
|
|
6572
8090
|
2: 2,
|
|
8091
|
+
// TEXT_NODE
|
|
6573
8092
|
3: 4,
|
|
8093
|
+
// COMMENT_NODE
|
|
6574
8094
|
8: 128,
|
|
8095
|
+
// DOCUMENT_NODE
|
|
6575
8096
|
9: 256,
|
|
8097
|
+
// DOCUMENT_FRAGMENT_NODE
|
|
6576
8098
|
11: 1024
|
|
6577
8099
|
};
|
|
6578
8100
|
function TreeWalker(root, nodeType, filter) {
|
|
@@ -6906,7 +8428,7 @@
|
|
|
6906
8428
|
node.appendChild(fixer);
|
|
6907
8429
|
} catch (error) {
|
|
6908
8430
|
self2.didError({
|
|
6909
|
-
name: "Squire: fixCursor
|
|
8431
|
+
name: "Squire: fixCursor – " + error,
|
|
6910
8432
|
message: "Parent: " + node.nodeName + "/" + node.innerHTML + " appendChild: " + fixer.nodeName
|
|
6911
8433
|
});
|
|
6912
8434
|
}
|
|
@@ -6923,17 +8445,6 @@
|
|
|
6923
8445
|
child = children[i];
|
|
6924
8446
|
isBR = child.nodeName === "BR";
|
|
6925
8447
|
if (!isBR && isInline(child)) {
|
|
6926
|
-
if (child.classList && child.classList.contains("halo-picture-area")) {
|
|
6927
|
-
return;
|
|
6928
|
-
}
|
|
6929
|
-
if (!wrapper) {
|
|
6930
|
-
wrapper = createElement(
|
|
6931
|
-
doc2,
|
|
6932
|
-
config.blockTag,
|
|
6933
|
-
config.blockAttributes
|
|
6934
|
-
);
|
|
6935
|
-
}
|
|
6936
|
-
wrapper.appendChild(child);
|
|
6937
8448
|
i -= 1;
|
|
6938
8449
|
l -= 1;
|
|
6939
8450
|
} else if (isBR || wrapper) {
|
|
@@ -7252,7 +8763,8 @@
|
|
|
7252
8763
|
block = getStartBlockOfRange(range, root);
|
|
7253
8764
|
firstBlockInFrag = getNextBlock(frag, frag);
|
|
7254
8765
|
replaceBlock = !!block && isEmptyBlock(block);
|
|
7255
|
-
if (block && firstBlockInFrag && !replaceBlock &&
|
|
8766
|
+
if (block && firstBlockInFrag && !replaceBlock && // Don't merge table cells or PRE elements into block
|
|
8767
|
+
!getNearest(firstBlockInFrag, frag, "PRE") && !getNearest(firstBlockInFrag, frag, "TABLE")) {
|
|
7256
8768
|
moveRangeBoundariesUpTree(range, block, block, root);
|
|
7257
8769
|
range.collapse(true);
|
|
7258
8770
|
container = range.endContainer;
|
|
@@ -7268,7 +8780,10 @@
|
|
|
7268
8780
|
container = nodeAfterSplit.parentNode;
|
|
7269
8781
|
offset = indexOf.call(container.childNodes, nodeAfterSplit);
|
|
7270
8782
|
}
|
|
7271
|
-
if (
|
|
8783
|
+
if (
|
|
8784
|
+
/* isBlock( container ) && */
|
|
8785
|
+
offset !== getLength(container)
|
|
8786
|
+
) {
|
|
7272
8787
|
blockContentsAfterSplit = root.ownerDocument.createDocumentFragment();
|
|
7273
8788
|
while (node = container.childNodes[offset]) {
|
|
7274
8789
|
blockContentsAfterSplit.appendChild(node);
|
|
@@ -8317,9 +9832,11 @@
|
|
|
8317
9832
|
if (hasImage) {
|
|
8318
9833
|
this.fireEvent("dragover", {
|
|
8319
9834
|
dataTransfer: clipboardData,
|
|
9835
|
+
/* jshint loopfunc: true */
|
|
8320
9836
|
preventDefault: function() {
|
|
8321
9837
|
fireDrop = true;
|
|
8322
9838
|
}
|
|
9839
|
+
/* jshint loopfunc: false */
|
|
8323
9840
|
});
|
|
8324
9841
|
if (fireDrop) {
|
|
8325
9842
|
this.fireEvent("drop", {
|
|
@@ -8526,7 +10043,9 @@
|
|
|
8526
10043
|
leafNodeNames,
|
|
8527
10044
|
undo: {
|
|
8528
10045
|
documentSizeThreshold: -1,
|
|
10046
|
+
// -1 means no threshold
|
|
8529
10047
|
undoLimit: -1
|
|
10048
|
+
// -1 means no limit
|
|
8530
10049
|
},
|
|
8531
10050
|
isInsertedHTMLSanitized: true,
|
|
8532
10051
|
isSetHTMLSanitized: true,
|
|
@@ -10168,5 +11687,5 @@
|
|
|
10168
11687
|
exports2.Editor = Editor;
|
|
10169
11688
|
exports2.ToolBar = ToolBar;
|
|
10170
11689
|
exports2.ToolsEnum = ToolsEnum;
|
|
10171
|
-
Object.
|
|
11690
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
10172
11691
|
});
|