@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.js
CHANGED
|
@@ -111,7 +111,6 @@ function _e(e, t, o = {}) {
|
|
|
111
111
|
}
|
|
112
112
|
const D = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, R = "__vueuse_ssr_handlers__";
|
|
113
113
|
D[R] = D[R] || {};
|
|
114
|
-
D[R];
|
|
115
114
|
var q;
|
|
116
115
|
(function(e) {
|
|
117
116
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
@@ -153,7 +152,7 @@ const he = {
|
|
|
153
152
|
ke({
|
|
154
153
|
linear: me
|
|
155
154
|
}, he);
|
|
156
|
-
const J = (e) => (pushScopeId("data-v-b46fc003"), e = e(), popScopeId(), e), we = { class: "hd" }, Oe = { class: "bd" }, Ie = /* @__PURE__ */ J(() => /* @__PURE__ */ createElementVNode("h3", null, "
|
|
155
|
+
const J = (e) => (pushScopeId("data-v-b46fc003"), e = e(), popScopeId(), e), we = { class: "hd" }, Oe = { class: "bd" }, Ie = /* @__PURE__ */ J(() => /* @__PURE__ */ createElementVNode("h3", null, "主题颜色", -1)), Ee = { class: "tColor" }, Pe = ["onMouseover", "onClick"], Me = { class: "bColor" }, Ae = ["onMouseover", "onClick"], $e = /* @__PURE__ */ J(() => /* @__PURE__ */ createElementVNode("h3", null, "标准颜色", -1)), Te = { class: "tColor" }, Be = ["onMouseover", "onClick"], Ve = {
|
|
157
156
|
name: "colorPicker"
|
|
158
157
|
}, Ne = /* @__PURE__ */ defineComponent({
|
|
159
158
|
...Ve,
|
|
@@ -218,13 +217,13 @@ const J = (e) => (pushScopeId("data-v-b46fc003"), e = e(), popScopeId(), e), we
|
|
|
218
217
|
l.stopPropagation();
|
|
219
218
|
})
|
|
220
219
|
}, [
|
|
221
|
-
createCommentVNode("
|
|
220
|
+
createCommentVNode(" 颜色显示小方块 "),
|
|
222
221
|
createElementVNode("div", {
|
|
223
222
|
class: normalizeClass(["colorBtn", { disabled: e.disabled }]),
|
|
224
223
|
style: normalizeStyle(`background-color: ${unref(a)}`),
|
|
225
224
|
onClick: p
|
|
226
225
|
}, null, 6),
|
|
227
|
-
createCommentVNode("
|
|
226
|
+
createCommentVNode(" 颜色色盘 "),
|
|
228
227
|
createElementVNode("div", {
|
|
229
228
|
class: normalizeClass(["box", { open: s.value }])
|
|
230
229
|
}, [
|
|
@@ -238,7 +237,7 @@ const J = (e) => (pushScopeId("data-v-b46fc003"), e = e(), popScopeId(), e), we
|
|
|
238
237
|
onClick: Y,
|
|
239
238
|
onMouseover: r[0] || (r[0] = (l) => d(e.defaultColor)),
|
|
240
239
|
onMouseout: r[1] || (r[1] = (l) => d(""))
|
|
241
|
-
}, "
|
|
240
|
+
}, "默认颜色", 32)
|
|
242
241
|
]),
|
|
243
242
|
createElementVNode("div", Oe, [
|
|
244
243
|
Ie,
|
|
@@ -274,8 +273,8 @@ const J = (e) => (pushScopeId("data-v-b46fc003"), e = e(), popScopeId(), e), we
|
|
|
274
273
|
onClick: (f) => E(l)
|
|
275
274
|
}, null, 44, Be)), 64))
|
|
276
275
|
]),
|
|
277
|
-
createElementVNode("h3", { onClick: X }, "
|
|
278
|
-
createCommentVNode("
|
|
276
|
+
createElementVNode("h3", { onClick: X }, "更多颜色..."),
|
|
277
|
+
createCommentVNode(" 用以激活HTML5颜色面板 "),
|
|
279
278
|
withDirectives(createElementVNode("input", {
|
|
280
279
|
type: "color",
|
|
281
280
|
ref_key: "html5ColorEl",
|
|
@@ -309,7 +308,7 @@ const Se = [
|
|
|
309
308
|
colorPicker: O
|
|
310
309
|
};
|
|
311
310
|
const style = "";
|
|
312
|
-
const
|
|
311
|
+
const ToolBar_vue_vue_type_style_index_0_scoped_50235bb8_lang = "";
|
|
313
312
|
const ToolBar_vue_vue_type_style_index_1_lang = "";
|
|
314
313
|
const _export_sfc = (sfc, props) => {
|
|
315
314
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -318,7 +317,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
318
317
|
}
|
|
319
318
|
return target;
|
|
320
319
|
};
|
|
321
|
-
const _sfc_main$
|
|
320
|
+
const _sfc_main$8 = {
|
|
322
321
|
components: {
|
|
323
322
|
ElTooltip,
|
|
324
323
|
ElDivider,
|
|
@@ -339,15 +338,15 @@ const _sfc_main$7 = {
|
|
|
339
338
|
activeImgType: false,
|
|
340
339
|
activeAlign: "",
|
|
341
340
|
alignMethods: [
|
|
342
|
-
{ value: "left", name: "
|
|
343
|
-
{ value: "right", name: "
|
|
344
|
-
{ value: "center", name: "
|
|
345
|
-
{ value: "justify", name: "
|
|
341
|
+
{ value: "left", name: "左对齐" },
|
|
342
|
+
{ value: "right", name: "右对齐" },
|
|
343
|
+
{ value: "center", name: "居中对齐" },
|
|
344
|
+
{ value: "justify", name: "两端对齐" }
|
|
346
345
|
],
|
|
347
346
|
activeFontsize: "17",
|
|
348
347
|
fontsizes: [
|
|
349
|
-
{ value: "17px", name: "17", desc: "
|
|
350
|
-
{ value: "18px", name: "18", desc: "
|
|
348
|
+
{ value: "17px", name: "17", desc: "默认正文字号" },
|
|
349
|
+
{ value: "18px", name: "18", desc: "默认标题字号" },
|
|
351
350
|
{ value: "19px", name: "19" },
|
|
352
351
|
{ value: "20px", name: "20" },
|
|
353
352
|
{ value: "24px", name: "24" },
|
|
@@ -428,7 +427,7 @@ const _sfc_main$7 = {
|
|
|
428
427
|
this.editor.clearFormat();
|
|
429
428
|
},
|
|
430
429
|
setColor(val) {
|
|
431
|
-
console.log("
|
|
430
|
+
console.log("文字颜色");
|
|
432
431
|
this.updatePosition(() => {
|
|
433
432
|
this.editor.setColor(val);
|
|
434
433
|
});
|
|
@@ -487,6 +486,7 @@ const _sfc_main$7 = {
|
|
|
487
486
|
this.popoverVisibleList = false;
|
|
488
487
|
this.popoverVisibleImg = false;
|
|
489
488
|
},
|
|
489
|
+
// todo 富文本设置样式位置会回到顶部
|
|
490
490
|
updatePosition(fn) {
|
|
491
491
|
const scrollTop = document.documentElement.scrollTop;
|
|
492
492
|
fn && fn();
|
|
@@ -519,13 +519,13 @@ const _sfc_main$7 = {
|
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
};
|
|
522
|
-
const _hoisted_1$
|
|
522
|
+
const _hoisted_1$8 = {
|
|
523
523
|
key: 0,
|
|
524
524
|
class: "tools"
|
|
525
525
|
};
|
|
526
|
-
const _hoisted_2$
|
|
527
|
-
const _hoisted_3$
|
|
528
|
-
const _hoisted_4$
|
|
526
|
+
const _hoisted_2$5 = { class: "tools-content" };
|
|
527
|
+
const _hoisted_3$5 = ["src"];
|
|
528
|
+
const _hoisted_4$3 = ["src"];
|
|
529
529
|
const _hoisted_5$3 = ["src"];
|
|
530
530
|
const _hoisted_6$2 = { class: "box" };
|
|
531
531
|
const _hoisted_7$2 = ["src"];
|
|
@@ -566,9 +566,9 @@ const _hoisted_29$1 = {
|
|
|
566
566
|
key: 0,
|
|
567
567
|
class: "box-mask"
|
|
568
568
|
};
|
|
569
|
-
const _hoisted_30
|
|
570
|
-
const _hoisted_31
|
|
571
|
-
const _hoisted_32
|
|
569
|
+
const _hoisted_30 = { class: "box" };
|
|
570
|
+
const _hoisted_31 = ["src"];
|
|
571
|
+
const _hoisted_32 = ["src"];
|
|
572
572
|
const _hoisted_33 = ["src"];
|
|
573
573
|
const _hoisted_34 = ["src"];
|
|
574
574
|
const _hoisted_35 = { class: "tools-title" };
|
|
@@ -585,18 +585,18 @@ const _hoisted_42 = {
|
|
|
585
585
|
const _hoisted_43 = ["src"];
|
|
586
586
|
const _hoisted_44 = ["src"];
|
|
587
587
|
const _hoisted_45 = ["src"];
|
|
588
|
-
function _sfc_render$
|
|
588
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
589
589
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
590
590
|
const _component_el_divider = resolveComponent("el-divider");
|
|
591
591
|
const _component_el_popover = resolveComponent("el-popover");
|
|
592
592
|
const _component_colorPicker = resolveComponent("colorPicker");
|
|
593
593
|
const _directive_click_outside = resolveDirective("click-outside");
|
|
594
|
-
return $props.editor.fontInfo ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
595
|
-
createElementVNode("div", _hoisted_2$
|
|
594
|
+
return $props.editor.fontInfo ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
595
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
596
596
|
createVNode(_component_el_tooltip, {
|
|
597
597
|
class: "item",
|
|
598
598
|
effect: "dark",
|
|
599
|
-
content: "
|
|
599
|
+
content: "撤回",
|
|
600
600
|
placement: "top"
|
|
601
601
|
}, {
|
|
602
602
|
default: withCtx(() => [
|
|
@@ -608,14 +608,14 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
608
608
|
height: "40",
|
|
609
609
|
alt: "",
|
|
610
610
|
onClick: _cache[0] || (_cache[0] = ($event) => $options.back($event))
|
|
611
|
-
}, null, 12, _hoisted_3$
|
|
611
|
+
}, null, 12, _hoisted_3$5)
|
|
612
612
|
]),
|
|
613
613
|
_: 1
|
|
614
614
|
}),
|
|
615
615
|
createVNode(_component_el_tooltip, {
|
|
616
616
|
class: "item",
|
|
617
617
|
effect: "dark",
|
|
618
|
-
content: "
|
|
618
|
+
content: "反撤回",
|
|
619
619
|
placement: "top"
|
|
620
620
|
}, {
|
|
621
621
|
default: withCtx(() => [
|
|
@@ -627,7 +627,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
627
627
|
height: "40",
|
|
628
628
|
alt: "",
|
|
629
629
|
onClick: _cache[1] || (_cache[1] = ($event) => $options.forward($event))
|
|
630
|
-
}, null, 12, _hoisted_4$
|
|
630
|
+
}, null, 12, _hoisted_4$3)
|
|
631
631
|
]),
|
|
632
632
|
_: 1
|
|
633
633
|
}),
|
|
@@ -638,7 +638,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
638
638
|
createVNode(_component_el_tooltip, {
|
|
639
639
|
class: "item",
|
|
640
640
|
effect: "dark",
|
|
641
|
-
content: "
|
|
641
|
+
content: "清除格式",
|
|
642
642
|
placement: "top"
|
|
643
643
|
}, {
|
|
644
644
|
default: withCtx(() => [
|
|
@@ -655,7 +655,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
655
655
|
createVNode(_component_el_tooltip, {
|
|
656
656
|
class: "item",
|
|
657
657
|
effect: "dark",
|
|
658
|
-
content: "
|
|
658
|
+
content: "格式刷",
|
|
659
659
|
placement: "top"
|
|
660
660
|
}, {
|
|
661
661
|
default: withCtx(() => [
|
|
@@ -686,7 +686,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
686
686
|
createVNode(_component_el_tooltip, {
|
|
687
687
|
class: "item",
|
|
688
688
|
effect: "dark",
|
|
689
|
-
content: "
|
|
689
|
+
content: "字号",
|
|
690
690
|
placement: "top"
|
|
691
691
|
}, {
|
|
692
692
|
default: withCtx(() => [
|
|
@@ -736,7 +736,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
736
736
|
createVNode(_component_el_tooltip, {
|
|
737
737
|
class: "item",
|
|
738
738
|
effect: "dark",
|
|
739
|
-
content: "
|
|
739
|
+
content: "标题",
|
|
740
740
|
placement: "top"
|
|
741
741
|
}, {
|
|
742
742
|
default: withCtx(() => [
|
|
@@ -757,7 +757,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
757
757
|
createVNode(_component_el_tooltip, {
|
|
758
758
|
class: "item",
|
|
759
759
|
effect: "dark",
|
|
760
|
-
content: "
|
|
760
|
+
content: "加粗",
|
|
761
761
|
placement: "top"
|
|
762
762
|
}, {
|
|
763
763
|
default: withCtx(() => [
|
|
@@ -785,7 +785,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
785
785
|
createVNode(_component_el_tooltip, {
|
|
786
786
|
class: "item",
|
|
787
787
|
effect: "dark",
|
|
788
|
-
content: "
|
|
788
|
+
content: "列表",
|
|
789
789
|
placement: "top"
|
|
790
790
|
}, {
|
|
791
791
|
default: withCtx(() => [
|
|
@@ -819,13 +819,13 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
819
819
|
onClick: _cache[8] || (_cache[8] = ($event) => $options.updatePosition(() => {
|
|
820
820
|
$options.setStyle("makeUnorderedList");
|
|
821
821
|
}))
|
|
822
|
-
}, "
|
|
822
|
+
}, "无序列表"),
|
|
823
823
|
createElementVNode("li", {
|
|
824
824
|
"data-editor-id": "makeHeader",
|
|
825
825
|
onClick: _cache[9] || (_cache[9] = ($event) => $options.updatePosition(() => {
|
|
826
826
|
$options.setStyle("makeOrderedList");
|
|
827
827
|
}))
|
|
828
|
-
}, "
|
|
828
|
+
}, "有序列表")
|
|
829
829
|
])), [
|
|
830
830
|
[_directive_click_outside, $options.handlePopover]
|
|
831
831
|
])
|
|
@@ -836,7 +836,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
836
836
|
createVNode(_component_el_tooltip, {
|
|
837
837
|
class: "item",
|
|
838
838
|
effect: "dark",
|
|
839
|
-
content: "
|
|
839
|
+
content: "倾斜",
|
|
840
840
|
placement: "top"
|
|
841
841
|
}, {
|
|
842
842
|
default: withCtx(() => [
|
|
@@ -856,7 +856,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
856
856
|
createVNode(_component_el_tooltip, {
|
|
857
857
|
class: "item",
|
|
858
858
|
effect: "dark",
|
|
859
|
-
content: "
|
|
859
|
+
content: "下划线",
|
|
860
860
|
placement: "top"
|
|
861
861
|
}, {
|
|
862
862
|
default: withCtx(() => [
|
|
@@ -877,18 +877,18 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
877
877
|
key: 0,
|
|
878
878
|
class: "item",
|
|
879
879
|
effect: "dark",
|
|
880
|
-
content: "
|
|
880
|
+
content: "链接",
|
|
881
881
|
placement: "top"
|
|
882
882
|
}, {
|
|
883
883
|
default: withCtx(() => [
|
|
884
|
-
createElementVNode("div", _hoisted_30
|
|
884
|
+
createElementVNode("div", _hoisted_30, [
|
|
885
885
|
createElementVNode("img", {
|
|
886
886
|
src: $options.getImageUrl("icon_web_link@2x.png"),
|
|
887
887
|
width: "40",
|
|
888
888
|
height: "40",
|
|
889
889
|
alt: "",
|
|
890
890
|
onClick: _cache[12] || (_cache[12] = (...args) => $options.insertLink && $options.insertLink(...args))
|
|
891
|
-
}, null, 8, _hoisted_31
|
|
891
|
+
}, null, 8, _hoisted_31)
|
|
892
892
|
])
|
|
893
893
|
]),
|
|
894
894
|
_: 1
|
|
@@ -896,7 +896,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
896
896
|
createVNode(_component_el_tooltip, {
|
|
897
897
|
class: "item",
|
|
898
898
|
effect: "dark",
|
|
899
|
-
content: "
|
|
899
|
+
content: "首行缩进",
|
|
900
900
|
placement: "top"
|
|
901
901
|
}, {
|
|
902
902
|
default: withCtx(() => [
|
|
@@ -906,14 +906,14 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
906
906
|
height: "40",
|
|
907
907
|
alt: "",
|
|
908
908
|
onClick: _cache[13] || (_cache[13] = ($event) => $options.setStyle("setIndent"))
|
|
909
|
-
}, null, 8, _hoisted_32
|
|
909
|
+
}, null, 8, _hoisted_32)
|
|
910
910
|
]),
|
|
911
911
|
_: 1
|
|
912
912
|
}),
|
|
913
913
|
createVNode(_component_el_tooltip, {
|
|
914
914
|
class: "item",
|
|
915
915
|
effect: "dark",
|
|
916
|
-
content: "
|
|
916
|
+
content: "文字颜色",
|
|
917
917
|
placement: "top"
|
|
918
918
|
}, {
|
|
919
919
|
default: withCtx(() => [
|
|
@@ -957,7 +957,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
957
957
|
createVNode(_component_el_tooltip, {
|
|
958
958
|
class: "item",
|
|
959
959
|
effect: "dark",
|
|
960
|
-
content: "
|
|
960
|
+
content: "对齐方式",
|
|
961
961
|
placement: "top"
|
|
962
962
|
}, {
|
|
963
963
|
default: withCtx(() => [
|
|
@@ -1015,7 +1015,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1015
1015
|
createVNode(_component_el_tooltip, {
|
|
1016
1016
|
class: "item",
|
|
1017
1017
|
effect: "dark",
|
|
1018
|
-
content: "
|
|
1018
|
+
content: "插入图片",
|
|
1019
1019
|
placement: "top"
|
|
1020
1020
|
}, {
|
|
1021
1021
|
default: withCtx(() => [
|
|
@@ -1037,11 +1037,11 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1037
1037
|
createElementVNode("li", {
|
|
1038
1038
|
class: normalizeClass([$data.activeImgType === "normal" ? "active" : ""]),
|
|
1039
1039
|
onClick: _cache[18] || (_cache[18] = ($event) => $options.insertImg("normal"))
|
|
1040
|
-
}, toDisplayString("
|
|
1040
|
+
}, toDisplayString("上传图片"), 2),
|
|
1041
1041
|
createElementVNode("li", {
|
|
1042
1042
|
class: normalizeClass([$data.activeImgType === "seamless" ? "active" : ""]),
|
|
1043
1043
|
onClick: _cache[19] || (_cache[19] = ($event) => $options.insertImg("seamless"))
|
|
1044
|
-
}, toDisplayString("
|
|
1044
|
+
}, toDisplayString("上传无缝拼接图片"), 2)
|
|
1045
1045
|
])), [
|
|
1046
1046
|
[_directive_click_outside, $options.handlePopover]
|
|
1047
1047
|
])
|
|
@@ -1052,7 +1052,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1052
1052
|
key: 2,
|
|
1053
1053
|
class: "item",
|
|
1054
1054
|
effect: "dark",
|
|
1055
|
-
content: "
|
|
1055
|
+
content: "插入视频",
|
|
1056
1056
|
placement: "top"
|
|
1057
1057
|
}, {
|
|
1058
1058
|
default: withCtx(() => [
|
|
@@ -1070,7 +1070,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1070
1070
|
key: 3,
|
|
1071
1071
|
class: "item",
|
|
1072
1072
|
effect: "dark",
|
|
1073
|
-
content: "
|
|
1073
|
+
content: "插入文章/视频",
|
|
1074
1074
|
placement: "top"
|
|
1075
1075
|
}, {
|
|
1076
1076
|
default: withCtx(() => [
|
|
@@ -1088,7 +1088,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1088
1088
|
key: 4,
|
|
1089
1089
|
class: "item",
|
|
1090
1090
|
effect: "dark",
|
|
1091
|
-
content: "
|
|
1091
|
+
content: "采集文章",
|
|
1092
1092
|
placement: "top"
|
|
1093
1093
|
}, {
|
|
1094
1094
|
default: withCtx(() => [
|
|
@@ -1105,17 +1105,15 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1105
1105
|
])
|
|
1106
1106
|
])) : createCommentVNode("", true);
|
|
1107
1107
|
}
|
|
1108
|
-
const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1108
|
+
const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$4], ["__scopeId", "data-v-50235bb8"]]);
|
|
1109
1109
|
const __vite_glob_0_0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAmCAYAAAClI5npAAAA0UlEQVR42uWYwQnDMAxFfckAXkFDmGzgS1foDpnFS3gTb+IFtIDyA4UeBKUtNR8qwTvlkAdyfmSletySmRUwgIIJOijXs9VcLxegwNVDRFYLdHtdCg6wrRKY9l4NUFYIqH1WDeTfCXxXE9w5Ar4tQhBwh7SBjSDg2lJJAj47SAI+OwgC7pDuJAGfHQQBnx0kAZ8dBAF3SOtTgCchybjV2QLKFpihW6BAQn6GA0i4KG4g037H4QaSDiTWUMocyweQcFezBjLrer5TFxR/uaKhL6lOdeUQ8G6X1pQAAAAASUVORK5CYII=";
|
|
1110
|
-
const
|
|
1111
|
-
const
|
|
1112
|
-
const
|
|
1113
|
-
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "basic-dialog_divider" }, null, -1);
|
|
1114
|
-
const _hoisted_4$3 = {
|
|
1110
|
+
const _hoisted_1$7 = { key: 0 };
|
|
1111
|
+
const _hoisted_2$4 = { class: "basic-dialog_title" };
|
|
1112
|
+
const _hoisted_3$4 = {
|
|
1115
1113
|
key: 0,
|
|
1116
1114
|
class: "dialog-footer"
|
|
1117
1115
|
};
|
|
1118
|
-
const _sfc_main$
|
|
1116
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1119
1117
|
__name: "index",
|
|
1120
1118
|
props: {
|
|
1121
1119
|
visible: { type: Boolean, default: false },
|
|
@@ -1156,24 +1154,24 @@ const _sfc_main$6 = defineComponent({
|
|
|
1156
1154
|
class: normalizeClass(["basic-dialog", { "hide-title": !_ctx.showTitle }])
|
|
1157
1155
|
}, {
|
|
1158
1156
|
header: withCtx(() => [
|
|
1159
|
-
_ctx.showTitle ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
1160
|
-
createElementVNode("div", _hoisted_2$
|
|
1161
|
-
|
|
1157
|
+
_ctx.showTitle ? (openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
1158
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
1159
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "basic-dialog_divider" }, null, -1)),
|
|
1162
1160
|
renderSlot(_ctx.$slots, "title")
|
|
1163
1161
|
])
|
|
1164
1162
|
])) : createCommentVNode("", true)
|
|
1165
1163
|
]),
|
|
1166
1164
|
footer: withCtx(() => [
|
|
1167
|
-
_ctx.showBtn ? (openBlock(), createElementBlock("span",
|
|
1165
|
+
_ctx.showBtn ? (openBlock(), createElementBlock("span", _hoisted_3$4, [
|
|
1168
1166
|
createVNode(unref(ElButton), {
|
|
1169
1167
|
style: { "width": "120px", "border-color": "#cccccc", "color": "#333333" },
|
|
1170
1168
|
plain: "",
|
|
1171
1169
|
round: "",
|
|
1172
1170
|
onClick: handleClose
|
|
1173
1171
|
}, {
|
|
1174
|
-
default: withCtx(() => [
|
|
1175
|
-
createTextVNode("
|
|
1176
|
-
]),
|
|
1172
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
1173
|
+
createTextVNode("取消")
|
|
1174
|
+
])),
|
|
1177
1175
|
_: 1
|
|
1178
1176
|
}),
|
|
1179
1177
|
createVNode(unref(ElButton), {
|
|
@@ -1182,9 +1180,9 @@ const _sfc_main$6 = defineComponent({
|
|
|
1182
1180
|
type: "primary",
|
|
1183
1181
|
onClick: confirm
|
|
1184
1182
|
}, {
|
|
1185
|
-
default: withCtx(() => [
|
|
1186
|
-
createTextVNode("
|
|
1187
|
-
]),
|
|
1183
|
+
default: withCtx(() => _cache[3] || (_cache[3] = [
|
|
1184
|
+
createTextVNode("确认")
|
|
1185
|
+
])),
|
|
1188
1186
|
_: 1
|
|
1189
1187
|
})
|
|
1190
1188
|
])) : createCommentVNode("", true)
|
|
@@ -1197,12 +1195,14 @@ const _sfc_main$6 = defineComponent({
|
|
|
1197
1195
|
};
|
|
1198
1196
|
}
|
|
1199
1197
|
});
|
|
1198
|
+
const index_vue_vue_type_style_index_0_lang$5 = "";
|
|
1200
1199
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1201
1200
|
function getDefaultExportFromCjs(x) {
|
|
1202
1201
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1203
1202
|
}
|
|
1204
|
-
var date$
|
|
1205
|
-
|
|
1203
|
+
var date$2 = { exports: {} };
|
|
1204
|
+
var date = date$2.exports;
|
|
1205
|
+
Object.defineProperty(date, "__esModule", { value: true });
|
|
1206
1206
|
function replacementDate(data, fmt) {
|
|
1207
1207
|
for (var k in data) {
|
|
1208
1208
|
if (new RegExp("(" + k + ")").test(fmt)) {
|
|
@@ -1217,126 +1217,130 @@ function replacementYear(date2, fmt) {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
return fmt;
|
|
1219
1219
|
}
|
|
1220
|
-
var DateClass =
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
if (fmt === void 0) {
|
|
1225
|
-
fmt = "YYYY-MM-DD HH:mm:ss";
|
|
1220
|
+
var DateClass = (
|
|
1221
|
+
/** @class */
|
|
1222
|
+
function() {
|
|
1223
|
+
function DateClass2() {
|
|
1226
1224
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
"
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1225
|
+
DateClass2.prototype.format = function(date2, fmt) {
|
|
1226
|
+
if (fmt === void 0) {
|
|
1227
|
+
fmt = "YYYY-MM-DD HH:mm:ss";
|
|
1228
|
+
}
|
|
1229
|
+
if (!date2)
|
|
1230
|
+
return "";
|
|
1231
|
+
var timeData = typeof date2 === "string" ? new Date(date2.replace(/-/g, "/")) : date2;
|
|
1232
|
+
timeData = typeof date2 === "number" ? new Date(date2) : timeData;
|
|
1233
|
+
var o = {
|
|
1234
|
+
"M+": timeData.getMonth() + 1,
|
|
1235
|
+
"D+": timeData.getDate(),
|
|
1236
|
+
"h+": timeData.getHours() % 12 === 0 ? 12 : timeData.getHours() % 12,
|
|
1237
|
+
"H+": timeData.getHours(),
|
|
1238
|
+
"m+": timeData.getMinutes(),
|
|
1239
|
+
"s+": timeData.getSeconds(),
|
|
1240
|
+
"q+": Math.floor((timeData.getMonth() + 3) / 3),
|
|
1241
|
+
"S": timeData.getMilliseconds()
|
|
1242
|
+
};
|
|
1243
|
+
var week = {
|
|
1244
|
+
"0": "日",
|
|
1245
|
+
"1": "一",
|
|
1246
|
+
"2": "二",
|
|
1247
|
+
"3": "三",
|
|
1248
|
+
"4": "四",
|
|
1249
|
+
"5": "五",
|
|
1250
|
+
"6": "六"
|
|
1251
|
+
};
|
|
1252
|
+
fmt = replacementYear(timeData, fmt);
|
|
1253
|
+
if (/(E+)/.test(fmt)) {
|
|
1254
|
+
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "星期" : "周" : "") + week["".concat(timeData.getDay(), " ")]);
|
|
1255
|
+
}
|
|
1256
|
+
return replacementDate(o, fmt);
|
|
1240
1257
|
};
|
|
1241
|
-
|
|
1242
|
-
"
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
"3": "\u4E09",
|
|
1246
|
-
"4": "\u56DB",
|
|
1247
|
-
"5": "\u4E94",
|
|
1248
|
-
"6": "\u516D"
|
|
1258
|
+
DateClass2.prototype.addDaysToDate = function(date2, days) {
|
|
1259
|
+
var d = typeof date2 === "object" ? date2 : new Date(date2);
|
|
1260
|
+
d.setDate(d.getDate() + days);
|
|
1261
|
+
return d.toISOString().split("T")[0];
|
|
1249
1262
|
};
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
var hh = Math.floor(ts / 1e3 / 60 / 60 % 24);
|
|
1268
|
-
var mm = Math.floor(ts / 1e3 / 60 % 60);
|
|
1269
|
-
var ss = Math.floor(ts / 1e3 % 60);
|
|
1270
|
-
if (ts <= 0)
|
|
1271
|
-
return false;
|
|
1272
|
-
return {
|
|
1273
|
-
dd: dd < 10 ? "0".concat(dd) : dd,
|
|
1274
|
-
hh: hh < 10 ? "0".concat(hh) : hh,
|
|
1275
|
-
mm: mm < 10 ? "0".concat(mm) : mm,
|
|
1276
|
-
ss: ss < 10 ? "0".concat(ss) : ss
|
|
1263
|
+
DateClass2.prototype.remainTime = function(endTime, startTime) {
|
|
1264
|
+
if (startTime === void 0) {
|
|
1265
|
+
startTime = /* @__PURE__ */ new Date();
|
|
1266
|
+
}
|
|
1267
|
+
var ts = Number(endTime) - Number(startTime);
|
|
1268
|
+
var dd = Math.floor(ts / 1e3 / 60 / 60 / 24);
|
|
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
|
|
1279
|
+
};
|
|
1277
1280
|
};
|
|
1278
|
-
|
|
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
|
-
|
|
1281
|
+
DateClass2.prototype.formatPassTime = function(startTime) {
|
|
1282
|
+
var currentTime = /* @__PURE__ */ new Date();
|
|
1283
|
+
var time = currentTime - startTime;
|
|
1284
|
+
var year = Math.floor(time / (1e3 * 60 * 60 * 24) / 30 / 12);
|
|
1285
|
+
if (year)
|
|
1286
|
+
return "".concat(year, "年前");
|
|
1287
|
+
var month = Math.floor(time / (1e3 * 60 * 60 * 24) / 30);
|
|
1288
|
+
if (month)
|
|
1289
|
+
return "".concat(month, "个月前");
|
|
1290
|
+
var day = Math.floor(time / (1e3 * 60 * 60 * 24));
|
|
1291
|
+
if (day)
|
|
1292
|
+
return "".concat(day, "天前");
|
|
1293
|
+
var hour = Math.floor(time / (1e3 * 60 * 60));
|
|
1294
|
+
if (hour)
|
|
1295
|
+
return "".concat(hour, "小时前");
|
|
1296
|
+
var min = Math.floor(time / (1e3 * 60));
|
|
1297
|
+
if (min)
|
|
1298
|
+
return "".concat(min, "分钟前");
|
|
1299
|
+
else
|
|
1300
|
+
return "刚刚";
|
|
1301
|
+
};
|
|
1302
|
+
DateClass2.prototype.formatPassTimeForList = function(time) {
|
|
1303
|
+
return DateClass2.prototype.formatPassTimeForDetail(time, "YYYY年MM月DD日", true);
|
|
1304
|
+
};
|
|
1305
|
+
DateClass2.prototype.formatPassTimeForDetail = function(time, fmt, noYear) {
|
|
1306
|
+
if (fmt === void 0) {
|
|
1307
|
+
fmt = "YYYY-MM-DD";
|
|
1308
|
+
}
|
|
1309
|
+
var date2 = typeof time === "number" ? new Date(time) : new Date((time || "").replace(/-/g, "/"));
|
|
1310
|
+
var diff = ((/* @__PURE__ */ new Date()).getTime() - date2.getTime()) / 1e3;
|
|
1311
|
+
var dayDiff = Math.floor(diff / 86400);
|
|
1312
|
+
var isValidDate = Object.prototype.toString.call(date2) === "[object Date]" && !isNaN(date2.getTime());
|
|
1313
|
+
if (!isValidDate)
|
|
1314
|
+
return "";
|
|
1315
|
+
var formatDate = function() {
|
|
1316
|
+
var today = new Date(date2);
|
|
1317
|
+
var o = {
|
|
1318
|
+
"Y+": today.getFullYear(),
|
|
1319
|
+
"M+": ("0" + (today.getMonth() + 1)).slice(-2),
|
|
1320
|
+
"D+": ("0" + today.getDate()).slice(-2)
|
|
1321
|
+
};
|
|
1322
|
+
fmt = replacementYear(date2, fmt);
|
|
1323
|
+
var year = today.getFullYear();
|
|
1324
|
+
if (!((/* @__PURE__ */ new Date()).getFullYear() > year) && noYear) {
|
|
1325
|
+
var backData = replacementDate(o, fmt);
|
|
1326
|
+
return backData.split("年")[1];
|
|
1327
|
+
}
|
|
1328
|
+
return replacementDate(o, fmt);
|
|
1319
1329
|
};
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
if (
|
|
1323
|
-
|
|
1324
|
-
return backData.split("\u5E74")[1];
|
|
1330
|
+
if (dayDiff === -1) {
|
|
1331
|
+
return "刚刚";
|
|
1332
|
+
} else if (isNaN(dayDiff) || dayDiff < 0 || dayDiff >= 15) {
|
|
1333
|
+
return formatDate();
|
|
1325
1334
|
}
|
|
1326
|
-
return
|
|
1335
|
+
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 + "天前";
|
|
1327
1336
|
};
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
return DateClass2;
|
|
1336
|
-
}();
|
|
1337
|
-
date$1.exports = new DateClass();
|
|
1338
|
-
const date = /* @__PURE__ */ getDefaultExportFromCjs(date$1.exports);
|
|
1339
|
-
var tools$1 = { exports: {} };
|
|
1337
|
+
return DateClass2;
|
|
1338
|
+
}()
|
|
1339
|
+
);
|
|
1340
|
+
date$2.exports = new DateClass();
|
|
1341
|
+
var dateExports = date$2.exports;
|
|
1342
|
+
const date$1 = /* @__PURE__ */ getDefaultExportFromCjs(dateExports);
|
|
1343
|
+
var tools$2 = { exports: {} };
|
|
1340
1344
|
var _listCacheClear;
|
|
1341
1345
|
var hasRequired_listCacheClear;
|
|
1342
1346
|
function require_listCacheClear() {
|
|
@@ -2243,6 +2247,7 @@ function requireStubFalse() {
|
|
|
2243
2247
|
stubFalse_1 = stubFalse;
|
|
2244
2248
|
return stubFalse_1;
|
|
2245
2249
|
}
|
|
2250
|
+
isBuffer.exports;
|
|
2246
2251
|
var hasRequiredIsBuffer;
|
|
2247
2252
|
function requireIsBuffer() {
|
|
2248
2253
|
if (hasRequiredIsBuffer)
|
|
@@ -2322,6 +2327,7 @@ function require_baseUnary() {
|
|
|
2322
2327
|
return _baseUnary;
|
|
2323
2328
|
}
|
|
2324
2329
|
var _nodeUtil = { exports: {} };
|
|
2330
|
+
_nodeUtil.exports;
|
|
2325
2331
|
var hasRequired_nodeUtil;
|
|
2326
2332
|
function require_nodeUtil() {
|
|
2327
2333
|
if (hasRequired_nodeUtil)
|
|
@@ -2371,7 +2377,11 @@ function require_arrayLikeKeys() {
|
|
|
2371
2377
|
function arrayLikeKeys(value, inherited) {
|
|
2372
2378
|
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;
|
|
2373
2379
|
for (var key in value) {
|
|
2374
|
-
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes &&
|
|
2380
|
+
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
2381
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
2382
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
2383
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
2384
|
+
isIndex(key, length)))) {
|
|
2375
2385
|
result.push(key);
|
|
2376
2386
|
}
|
|
2377
2387
|
}
|
|
@@ -2551,6 +2561,7 @@ function require_baseAssignIn() {
|
|
|
2551
2561
|
return _baseAssignIn;
|
|
2552
2562
|
}
|
|
2553
2563
|
var _cloneBuffer = { exports: {} };
|
|
2564
|
+
_cloneBuffer.exports;
|
|
2554
2565
|
var hasRequired_cloneBuffer;
|
|
2555
2566
|
function require_cloneBuffer() {
|
|
2556
2567
|
if (hasRequired_cloneBuffer)
|
|
@@ -3164,13 +3175,13 @@ function requireCloneDeep() {
|
|
|
3164
3175
|
return cloneDeep_1;
|
|
3165
3176
|
}
|
|
3166
3177
|
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3167
|
-
var
|
|
3168
|
-
var
|
|
3169
|
-
function
|
|
3170
|
-
if (
|
|
3171
|
-
return
|
|
3172
|
-
|
|
3173
|
-
|
|
3178
|
+
var clipboardCopy_1;
|
|
3179
|
+
var hasRequiredClipboardCopy;
|
|
3180
|
+
function requireClipboardCopy() {
|
|
3181
|
+
if (hasRequiredClipboardCopy)
|
|
3182
|
+
return clipboardCopy_1;
|
|
3183
|
+
hasRequiredClipboardCopy = 1;
|
|
3184
|
+
clipboardCopy_1 = clipboardCopy;
|
|
3174
3185
|
function makeError() {
|
|
3175
3186
|
return new DOMException("The request is not allowed", "NotAllowedError");
|
|
3176
3187
|
}
|
|
@@ -3213,266 +3224,270 @@ function require_clipboardCopy_4_0_1_clipboardCopy() {
|
|
|
3213
3224
|
}
|
|
3214
3225
|
}
|
|
3215
3226
|
}
|
|
3216
|
-
return
|
|
3227
|
+
return clipboardCopy_1;
|
|
3217
3228
|
}
|
|
3218
|
-
|
|
3229
|
+
var tools = tools$2.exports;
|
|
3230
|
+
Object.defineProperty(tools, "__esModule", { value: true });
|
|
3219
3231
|
var previous = 0;
|
|
3220
3232
|
var timeout = null;
|
|
3221
|
-
var ToolsClass =
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3233
|
+
var ToolsClass = (
|
|
3234
|
+
/** @class */
|
|
3235
|
+
function() {
|
|
3236
|
+
function ToolsClass2() {
|
|
3237
|
+
var _this = this;
|
|
3238
|
+
this.stopScroll = function(className) {
|
|
3239
|
+
if (!(window && window.document)) {
|
|
3240
|
+
return new Error("仅支持浏览器");
|
|
3241
|
+
}
|
|
3242
|
+
var html = document.documentElement;
|
|
3243
|
+
html.style.overflow = "hidden";
|
|
3244
|
+
html.style.height = "100%";
|
|
3245
|
+
var body = document.body;
|
|
3246
|
+
body.style.overflow = "hidden";
|
|
3247
|
+
body.style.height = "100%";
|
|
3248
|
+
if (className) {
|
|
3249
|
+
var dom = document.querySelector(".".concat(className));
|
|
3250
|
+
dom && dom.addEventListener("touchmove", _this.__setDefault__);
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
this.startScroll = function(className) {
|
|
3254
|
+
if (!(window && window.document)) {
|
|
3255
|
+
return new Error("仅支持浏览器");
|
|
3256
|
+
}
|
|
3257
|
+
var html = document.documentElement;
|
|
3258
|
+
html.style.overflow = "visible";
|
|
3259
|
+
html.style.height = "auto";
|
|
3260
|
+
var body = document.body;
|
|
3261
|
+
body.style.overflow = "visible";
|
|
3262
|
+
body.style.height = "auto";
|
|
3263
|
+
if (className) {
|
|
3264
|
+
var dom = document.querySelector(".".concat(className));
|
|
3265
|
+
dom && dom.removeEventListener("touchmove", _this.__setDefault__);
|
|
3266
|
+
}
|
|
3267
|
+
};
|
|
3268
|
+
this.objectToArray = function(obj) {
|
|
3269
|
+
var arr = [];
|
|
3270
|
+
if (typeof obj === "object") {
|
|
3271
|
+
for (var key in obj) {
|
|
3272
|
+
if (obj.hasOwnProperty(key)) {
|
|
3273
|
+
arr.push([key, obj[key]].join("="));
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
return arr;
|
|
3278
|
+
};
|
|
3279
|
+
this.convertKeyValueEnum = function(obj) {
|
|
3280
|
+
var result = {};
|
|
3281
|
+
if (typeof obj === "object") {
|
|
3282
|
+
for (var key in obj) {
|
|
3283
|
+
if (obj.hasOwnProperty(key)) {
|
|
3284
|
+
result[obj[key]] = key;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
return result;
|
|
3289
|
+
};
|
|
3290
|
+
this.isDefined = function(val) {
|
|
3291
|
+
return val !== void 0 && val !== null;
|
|
3292
|
+
};
|
|
3293
|
+
this.__loaded__ = {};
|
|
3294
|
+
this.__setDefault__ = function(e) {
|
|
3295
|
+
e && e.preventDefault();
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
ToolsClass2.prototype.deepCopy = function(data) {
|
|
3299
|
+
return JSON.parse(JSON.stringify(data));
|
|
3238
3300
|
};
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
var html = document.documentElement;
|
|
3244
|
-
html.style.overflow = "visible";
|
|
3245
|
-
html.style.height = "auto";
|
|
3246
|
-
var body = document.body;
|
|
3247
|
-
body.style.overflow = "visible";
|
|
3248
|
-
body.style.height = "auto";
|
|
3249
|
-
if (className) {
|
|
3250
|
-
var dom = document.querySelector(".".concat(className));
|
|
3251
|
-
dom && dom.removeEventListener("touchmove", _this.__setDefault__);
|
|
3301
|
+
ToolsClass2.prototype.deepCopy2 = function(obj) {
|
|
3302
|
+
var _obj = Array.isArray(obj) ? [] : {};
|
|
3303
|
+
for (var i in obj) {
|
|
3304
|
+
_obj[i] = typeof obj[i] === "object" ? this.deepCopy2(obj[i]) : obj[i];
|
|
3252
3305
|
}
|
|
3306
|
+
return _obj;
|
|
3253
3307
|
};
|
|
3254
|
-
|
|
3255
|
-
var
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3308
|
+
ToolsClass2.prototype.deepCopy3 = function(obj) {
|
|
3309
|
+
var deepcopy = requireCloneDeep();
|
|
3310
|
+
return deepcopy(obj);
|
|
3311
|
+
};
|
|
3312
|
+
ToolsClass2.prototype.debounce = function(func, wait) {
|
|
3313
|
+
var delay = function() {
|
|
3314
|
+
var args = arguments;
|
|
3315
|
+
if (timeout)
|
|
3316
|
+
clearTimeout(timeout);
|
|
3317
|
+
timeout = setTimeout(function() {
|
|
3318
|
+
func.apply(delay, args);
|
|
3319
|
+
}, wait);
|
|
3320
|
+
};
|
|
3321
|
+
return delay;
|
|
3322
|
+
};
|
|
3323
|
+
ToolsClass2.prototype.throttle = function(func, wait) {
|
|
3324
|
+
var delay = function() {
|
|
3325
|
+
var now = Date.now();
|
|
3326
|
+
if (now - previous > wait) {
|
|
3327
|
+
func.apply(delay, arguments);
|
|
3328
|
+
previous = now;
|
|
3261
3329
|
}
|
|
3330
|
+
};
|
|
3331
|
+
return delay;
|
|
3332
|
+
};
|
|
3333
|
+
ToolsClass2.prototype.getUrlName = function(url) {
|
|
3334
|
+
return url && url.split("?")[0].split("/").reverse()[0];
|
|
3335
|
+
};
|
|
3336
|
+
ToolsClass2.prototype.loadJs = function(url) {
|
|
3337
|
+
var _this = this;
|
|
3338
|
+
if (!(window && window.document)) {
|
|
3339
|
+
return new Error("仅支持浏览器");
|
|
3262
3340
|
}
|
|
3263
|
-
|
|
3341
|
+
var name = this.getUrlName(url);
|
|
3342
|
+
var id = "js_" + name;
|
|
3343
|
+
return new Promise(function(resolve, reject) {
|
|
3344
|
+
if (_this.__loaded__[id]) {
|
|
3345
|
+
return resolve();
|
|
3346
|
+
}
|
|
3347
|
+
var script = document.createElement("script");
|
|
3348
|
+
script.type = "text/javascript";
|
|
3349
|
+
script.async = true;
|
|
3350
|
+
script.src = url;
|
|
3351
|
+
script.id = id;
|
|
3352
|
+
script.onload = function() {
|
|
3353
|
+
_this.__loaded__[id] = true;
|
|
3354
|
+
resolve();
|
|
3355
|
+
};
|
|
3356
|
+
script.onerror = function(e) {
|
|
3357
|
+
reject(e);
|
|
3358
|
+
};
|
|
3359
|
+
document.body.appendChild(script);
|
|
3360
|
+
});
|
|
3264
3361
|
};
|
|
3265
|
-
|
|
3266
|
-
var
|
|
3267
|
-
if (
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3362
|
+
ToolsClass2.prototype.loadCss = function(url) {
|
|
3363
|
+
var _this = this;
|
|
3364
|
+
if (!(window && window.document)) {
|
|
3365
|
+
return new Error("仅支持浏览器");
|
|
3366
|
+
}
|
|
3367
|
+
var name = this.getUrlName(url);
|
|
3368
|
+
var id = "css_" + name;
|
|
3369
|
+
return new Promise(function(resolve, reject) {
|
|
3370
|
+
if (_this.__loaded__[id]) {
|
|
3371
|
+
return resolve();
|
|
3272
3372
|
}
|
|
3373
|
+
var link = document.createElement("link");
|
|
3374
|
+
link.type = "text/css";
|
|
3375
|
+
link.rel = "stylesheet";
|
|
3376
|
+
link.href = url;
|
|
3377
|
+
link.id = id;
|
|
3378
|
+
link.onload = function() {
|
|
3379
|
+
_this.__loaded__[id] = true;
|
|
3380
|
+
resolve();
|
|
3381
|
+
};
|
|
3382
|
+
link.onerror = function(e) {
|
|
3383
|
+
reject(e);
|
|
3384
|
+
};
|
|
3385
|
+
document.head.appendChild(link);
|
|
3386
|
+
});
|
|
3387
|
+
};
|
|
3388
|
+
ToolsClass2.prototype.clipboard = function(str) {
|
|
3389
|
+
if (!(window && window.document)) {
|
|
3390
|
+
return new Error("仅支持浏览器");
|
|
3273
3391
|
}
|
|
3274
|
-
|
|
3392
|
+
var copy = requireClipboardCopy();
|
|
3393
|
+
return copy(str);
|
|
3275
3394
|
};
|
|
3276
|
-
|
|
3277
|
-
return
|
|
3395
|
+
ToolsClass2.prototype.firstUpperCase = function(str) {
|
|
3396
|
+
return str.charAt(0).toUpperCase() + str.toString().slice(1);
|
|
3278
3397
|
};
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3398
|
+
ToolsClass2.prototype.slice = function(target, length) {
|
|
3399
|
+
if (target === void 0) {
|
|
3400
|
+
target = "";
|
|
3401
|
+
}
|
|
3402
|
+
if (length === void 0) {
|
|
3403
|
+
length = 0;
|
|
3404
|
+
}
|
|
3405
|
+
return target.slice(0, length);
|
|
3282
3406
|
};
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
var _obj = Array.isArray(obj) ? [] : {};
|
|
3289
|
-
for (var i in obj) {
|
|
3290
|
-
_obj[i] = typeof obj[i] === "object" ? this.deepCopy2(obj[i]) : obj[i];
|
|
3291
|
-
}
|
|
3292
|
-
return _obj;
|
|
3293
|
-
};
|
|
3294
|
-
ToolsClass2.prototype.deepCopy3 = function(obj) {
|
|
3295
|
-
var deepcopy = requireCloneDeep();
|
|
3296
|
-
return deepcopy(obj);
|
|
3297
|
-
};
|
|
3298
|
-
ToolsClass2.prototype.debounce = function(func, wait) {
|
|
3299
|
-
var delay = function() {
|
|
3300
|
-
var args = arguments;
|
|
3301
|
-
if (timeout)
|
|
3302
|
-
clearTimeout(timeout);
|
|
3303
|
-
timeout = setTimeout(function() {
|
|
3304
|
-
func.apply(delay, args);
|
|
3305
|
-
}, wait);
|
|
3407
|
+
ToolsClass2.prototype.guid = function() {
|
|
3408
|
+
function S4() {
|
|
3409
|
+
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
3410
|
+
}
|
|
3411
|
+
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
|
|
3306
3412
|
};
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
var delay = function() {
|
|
3311
|
-
var now = Date.now();
|
|
3312
|
-
if (now - previous > wait) {
|
|
3313
|
-
func.apply(delay, arguments);
|
|
3314
|
-
previous = now;
|
|
3413
|
+
ToolsClass2.prototype.getBytesOfText = function(str) {
|
|
3414
|
+
if (str === void 0) {
|
|
3415
|
+
str = "";
|
|
3315
3416
|
}
|
|
3417
|
+
return str.replace(/[^\u0000-\u00ff]/g, "aa").length;
|
|
3316
3418
|
};
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
var
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
}
|
|
3359
|
-
var link = document.createElement("link");
|
|
3360
|
-
link.type = "text/css";
|
|
3361
|
-
link.rel = "stylesheet";
|
|
3362
|
-
link.href = url;
|
|
3363
|
-
link.id = id;
|
|
3364
|
-
link.onload = function() {
|
|
3365
|
-
_this.__loaded__[id] = true;
|
|
3366
|
-
resolve();
|
|
3367
|
-
};
|
|
3368
|
-
link.onerror = function(e) {
|
|
3369
|
-
reject(e);
|
|
3370
|
-
};
|
|
3371
|
-
document.head.appendChild(link);
|
|
3372
|
-
});
|
|
3373
|
-
};
|
|
3374
|
-
ToolsClass2.prototype.clipboard = function(str) {
|
|
3375
|
-
if (!(window && window.document)) {
|
|
3376
|
-
return new Error("\u4EC5\u652F\u6301\u6D4F\u89C8\u5668");
|
|
3377
|
-
}
|
|
3378
|
-
var copy = require_clipboardCopy_4_0_1_clipboardCopy();
|
|
3379
|
-
return copy(str);
|
|
3380
|
-
};
|
|
3381
|
-
ToolsClass2.prototype.firstUpperCase = function(str) {
|
|
3382
|
-
return str.charAt(0).toUpperCase() + str.toString().slice(1);
|
|
3383
|
-
};
|
|
3384
|
-
ToolsClass2.prototype.slice = function(target, length) {
|
|
3385
|
-
if (target === void 0) {
|
|
3386
|
-
target = "";
|
|
3387
|
-
}
|
|
3388
|
-
if (length === void 0) {
|
|
3389
|
-
length = 0;
|
|
3390
|
-
}
|
|
3391
|
-
return target.slice(0, length);
|
|
3392
|
-
};
|
|
3393
|
-
ToolsClass2.prototype.guid = function() {
|
|
3394
|
-
function S4() {
|
|
3395
|
-
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
3396
|
-
}
|
|
3397
|
-
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
|
|
3398
|
-
};
|
|
3399
|
-
ToolsClass2.prototype.getBytesOfText = function(str) {
|
|
3400
|
-
if (str === void 0) {
|
|
3401
|
-
str = "";
|
|
3402
|
-
}
|
|
3403
|
-
return str.replace(/[^\u0000-\u00ff]/g, "aa").length;
|
|
3404
|
-
};
|
|
3405
|
-
ToolsClass2.prototype.uniqueArr = function(arr) {
|
|
3406
|
-
return Array.from(new Set(arr));
|
|
3407
|
-
};
|
|
3408
|
-
ToolsClass2.prototype.swapArray = function(array, index1, index2) {
|
|
3409
|
-
var _a;
|
|
3410
|
-
_a = [array[index2], array[index1]], array[index1] = _a[0], array[index2] = _a[1];
|
|
3411
|
-
return array;
|
|
3412
|
-
};
|
|
3413
|
-
ToolsClass2.prototype.filterEmoji = function(str) {
|
|
3414
|
-
return str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg, "");
|
|
3415
|
-
};
|
|
3416
|
-
ToolsClass2.prototype.containsEmoji = function(str) {
|
|
3417
|
-
var reg = /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg;
|
|
3418
|
-
return reg.test(str);
|
|
3419
|
-
};
|
|
3420
|
-
ToolsClass2.prototype.containsHanZi = function(str) {
|
|
3421
|
-
var reg = /[\u4e00-\u9fa5]/mg;
|
|
3422
|
-
return reg.test(str);
|
|
3423
|
-
};
|
|
3424
|
-
ToolsClass2.prototype.isEmpty = function(val) {
|
|
3425
|
-
if (val == null)
|
|
3426
|
-
return true;
|
|
3427
|
-
if (typeof val === "boolean")
|
|
3419
|
+
ToolsClass2.prototype.uniqueArr = function(arr) {
|
|
3420
|
+
return Array.from(new Set(arr));
|
|
3421
|
+
};
|
|
3422
|
+
ToolsClass2.prototype.swapArray = function(array, index1, index2) {
|
|
3423
|
+
var _a;
|
|
3424
|
+
_a = [array[index2], array[index1]], array[index1] = _a[0], array[index2] = _a[1];
|
|
3425
|
+
return array;
|
|
3426
|
+
};
|
|
3427
|
+
ToolsClass2.prototype.filterEmoji = function(str) {
|
|
3428
|
+
return str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg, "");
|
|
3429
|
+
};
|
|
3430
|
+
ToolsClass2.prototype.containsEmoji = function(str) {
|
|
3431
|
+
var reg = /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/mg;
|
|
3432
|
+
return reg.test(str);
|
|
3433
|
+
};
|
|
3434
|
+
ToolsClass2.prototype.containsHanZi = function(str) {
|
|
3435
|
+
var reg = /[\u4e00-\u9fa5]/mg;
|
|
3436
|
+
return reg.test(str);
|
|
3437
|
+
};
|
|
3438
|
+
ToolsClass2.prototype.isEmpty = function(val) {
|
|
3439
|
+
if (val == null)
|
|
3440
|
+
return true;
|
|
3441
|
+
if (typeof val === "boolean")
|
|
3442
|
+
return false;
|
|
3443
|
+
if (typeof val === "number")
|
|
3444
|
+
return !val;
|
|
3445
|
+
if (val instanceof Error)
|
|
3446
|
+
return val.message === "";
|
|
3447
|
+
switch (Object.prototype.toString.call(val)) {
|
|
3448
|
+
case "[object String]":
|
|
3449
|
+
case "[object Array]":
|
|
3450
|
+
return !val.length;
|
|
3451
|
+
case "[object File]":
|
|
3452
|
+
case "[object Map]":
|
|
3453
|
+
case "[object Set]": {
|
|
3454
|
+
return !val.size;
|
|
3455
|
+
}
|
|
3456
|
+
case "[object Object]": {
|
|
3457
|
+
return !Object.keys(val).length;
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3428
3460
|
return false;
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
switch (Object.prototype.toString.call(val)) {
|
|
3434
|
-
case "[object String]":
|
|
3435
|
-
case "[object Array]":
|
|
3436
|
-
return !val.length;
|
|
3437
|
-
case "[object File]":
|
|
3438
|
-
case "[object Map]":
|
|
3439
|
-
case "[object Set]": {
|
|
3440
|
-
return !val.size;
|
|
3441
|
-
}
|
|
3442
|
-
case "[object Object]": {
|
|
3443
|
-
return !Object.keys(val).length;
|
|
3461
|
+
};
|
|
3462
|
+
ToolsClass2.prototype.sensitiveField = function(field, before, after) {
|
|
3463
|
+
if (before === void 0) {
|
|
3464
|
+
before = 3;
|
|
3444
3465
|
}
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
}
|
|
3470
|
-
tools$1.exports = new ToolsClass();
|
|
3471
|
-
const tools = /* @__PURE__ */ getDefaultExportFromCjs(tools$1.exports);
|
|
3472
|
-
const index_vue_vue_type_style_index_0_lang$3 = "";
|
|
3473
|
-
const _hoisted_1$5 = { style: { "margin-left": "20px", "color": "#FF5A25" } };
|
|
3474
|
-
const _hoisted_2$5 = { class: "insert-article" };
|
|
3475
|
-
const _hoisted_3$5 = { class: "insert-article_input" };
|
|
3466
|
+
if (after === void 0) {
|
|
3467
|
+
after = 4;
|
|
3468
|
+
}
|
|
3469
|
+
if (!field) {
|
|
3470
|
+
return "";
|
|
3471
|
+
}
|
|
3472
|
+
field = String(field);
|
|
3473
|
+
var sensitiveLen = field.length - before - after;
|
|
3474
|
+
if (sensitiveLen < 0) {
|
|
3475
|
+
sensitiveLen = 0;
|
|
3476
|
+
}
|
|
3477
|
+
var regItem = "[一-龥a-zA-Z0-9]";
|
|
3478
|
+
var regExp = "(".concat(regItem, "{").concat(before, "})").concat(regItem, "*(").concat(regItem, "{").concat(after, "})");
|
|
3479
|
+
var reg = new RegExp(regExp);
|
|
3480
|
+
return field.replace(reg, "$1".concat("*".repeat(sensitiveLen), "$2"));
|
|
3481
|
+
};
|
|
3482
|
+
return ToolsClass2;
|
|
3483
|
+
}()
|
|
3484
|
+
);
|
|
3485
|
+
tools$2.exports = new ToolsClass();
|
|
3486
|
+
var toolsExports = tools$2.exports;
|
|
3487
|
+
const tools$1 = /* @__PURE__ */ getDefaultExportFromCjs(toolsExports);
|
|
3488
|
+
const _hoisted_1$6 = { style: { "margin-left": "20px", "color": "#FF5A25" } };
|
|
3489
|
+
const _hoisted_2$3 = { class: "insert-article" };
|
|
3490
|
+
const _hoisted_3$3 = { class: "insert-article_input" };
|
|
3476
3491
|
const _hoisted_4$2 = {
|
|
3477
3492
|
key: 0,
|
|
3478
3493
|
class: "nodata"
|
|
@@ -3491,7 +3506,7 @@ const _hoisted_12$1 = {
|
|
|
3491
3506
|
key: 1,
|
|
3492
3507
|
style: { "display": "inline-flex", "flex-direction": "column" }
|
|
3493
3508
|
};
|
|
3494
|
-
const _sfc_main$
|
|
3509
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
3495
3510
|
__name: "index",
|
|
3496
3511
|
props: {
|
|
3497
3512
|
visible: { type: Boolean, default: false },
|
|
@@ -3499,7 +3514,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
3499
3514
|
},
|
|
3500
3515
|
emits: ["change", "submit", "update:visible"],
|
|
3501
3516
|
setup(__props, { emit: __emit }) {
|
|
3502
|
-
const { debounce } = tools;
|
|
3517
|
+
const { debounce } = tools$1;
|
|
3503
3518
|
const vInfiniteScroll = ElInfiniteScroll;
|
|
3504
3519
|
const Radio_Type = {
|
|
3505
3520
|
MY_ARITICLE: "1",
|
|
@@ -3550,7 +3565,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
3550
3565
|
};
|
|
3551
3566
|
const confirm = () => {
|
|
3552
3567
|
if (!data.article) {
|
|
3553
|
-
ElMessage.error(
|
|
3568
|
+
ElMessage.error(`请选择${isVideo ? "视频" : "文章"}`);
|
|
3554
3569
|
return;
|
|
3555
3570
|
}
|
|
3556
3571
|
data.article.isVideo = isVideo;
|
|
@@ -3567,11 +3582,14 @@ const _sfc_main$5 = defineComponent({
|
|
|
3567
3582
|
data.busy = true;
|
|
3568
3583
|
const userInfo = JSON.parse(localStorage.getItem("user")) || JSON.parse(localStorage.getItem("userInfo"));
|
|
3569
3584
|
const userId = userInfo.uid || userInfo.userid;
|
|
3585
|
+
if (!getList.value)
|
|
3586
|
+
return;
|
|
3570
3587
|
const res = await getList.value({
|
|
3571
3588
|
uid: data.params.radio !== Radio_Type.ALL_ARITICLE ? userId : "",
|
|
3572
3589
|
autherid: data.params.radio !== Radio_Type.ALL_ARITICLE ? userId : "",
|
|
3573
3590
|
limit: 20,
|
|
3574
3591
|
allType: data.params.radio,
|
|
3592
|
+
// 只有4 是查视频 其他是文章
|
|
3575
3593
|
title: data.params.title,
|
|
3576
3594
|
page: ++data.page
|
|
3577
3595
|
});
|
|
@@ -3585,27 +3603,27 @@ const _sfc_main$5 = defineComponent({
|
|
|
3585
3603
|
data.busy = false;
|
|
3586
3604
|
}, 1e3);
|
|
3587
3605
|
return (_ctx, _cache) => {
|
|
3588
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3606
|
+
return openBlock(), createBlock(_sfc_main$7, {
|
|
3589
3607
|
visible: unref(visible),
|
|
3590
3608
|
onSubmit: confirm
|
|
3591
3609
|
}, {
|
|
3592
3610
|
title: withCtx(() => [
|
|
3593
3611
|
createElementVNode("span", null, [
|
|
3594
|
-
createTextVNode("
|
|
3595
|
-
createElementVNode("strong", _hoisted_1$
|
|
3612
|
+
_cache[8] || (_cache[8] = createTextVNode("插入文章/视频")),
|
|
3613
|
+
createElementVNode("strong", _hoisted_1$6, "平台仅支持插入" + toDisplayString(`${isVideo.value ? "2年" : "18个月"}`) + "内的推荐内容", 1)
|
|
3596
3614
|
])
|
|
3597
3615
|
]),
|
|
3598
3616
|
default: withCtx(() => [
|
|
3599
|
-
createElementVNode("div", _hoisted_2$
|
|
3617
|
+
createElementVNode("div", _hoisted_2$3, [
|
|
3600
3618
|
createElementVNode("div", null, [
|
|
3601
3619
|
createVNode(unref(ElRadio), {
|
|
3602
3620
|
modelValue: data.params.radio,
|
|
3603
3621
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => data.params.radio = $event),
|
|
3604
3622
|
label: Radio_Type.MY_ARITICLE
|
|
3605
3623
|
}, {
|
|
3606
|
-
default: withCtx(() => [
|
|
3607
|
-
createTextVNode("
|
|
3608
|
-
]),
|
|
3624
|
+
default: withCtx(() => _cache[9] || (_cache[9] = [
|
|
3625
|
+
createTextVNode("从我的文章中选择")
|
|
3626
|
+
])),
|
|
3609
3627
|
_: 1
|
|
3610
3628
|
}, 8, ["modelValue", "label"]),
|
|
3611
3629
|
createVNode(unref(ElRadio), {
|
|
@@ -3613,9 +3631,9 @@ const _sfc_main$5 = defineComponent({
|
|
|
3613
3631
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => data.params.radio = $event),
|
|
3614
3632
|
label: Radio_Type.MY_VIDEO
|
|
3615
3633
|
}, {
|
|
3616
|
-
default: withCtx(() => [
|
|
3617
|
-
createTextVNode("
|
|
3618
|
-
]),
|
|
3634
|
+
default: withCtx(() => _cache[10] || (_cache[10] = [
|
|
3635
|
+
createTextVNode("从我的视频中选择")
|
|
3636
|
+
])),
|
|
3619
3637
|
_: 1
|
|
3620
3638
|
}, 8, ["modelValue", "label"]),
|
|
3621
3639
|
createVNode(unref(ElRadio), {
|
|
@@ -3623,17 +3641,17 @@ const _sfc_main$5 = defineComponent({
|
|
|
3623
3641
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => data.params.radio = $event),
|
|
3624
3642
|
label: Radio_Type.ALL_ARITICLE
|
|
3625
3643
|
}, {
|
|
3626
|
-
default: withCtx(() => [
|
|
3627
|
-
createTextVNode("
|
|
3628
|
-
]),
|
|
3644
|
+
default: withCtx(() => _cache[11] || (_cache[11] = [
|
|
3645
|
+
createTextVNode("从所有文章中选择")
|
|
3646
|
+
])),
|
|
3629
3647
|
_: 1
|
|
3630
3648
|
}, 8, ["modelValue", "label"])
|
|
3631
3649
|
]),
|
|
3632
|
-
createElementVNode("div", _hoisted_3$
|
|
3650
|
+
createElementVNode("div", _hoisted_3$3, [
|
|
3633
3651
|
createVNode(unref(ElInput), {
|
|
3634
3652
|
modelValue: data.params.title,
|
|
3635
3653
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => data.params.title = $event),
|
|
3636
|
-
placeholder: isVideo.value ? "
|
|
3654
|
+
placeholder: isVideo.value ? "输入视频描述查找平台发布过的视频" : "输入标题名查找平台发过的文章",
|
|
3637
3655
|
onKeyup: _cache[5] || (_cache[5] = withKeys(($event) => unref(getArticleList)(true), ["enter", "native"])),
|
|
3638
3656
|
onInput: _cache[6] || (_cache[6] = ($event) => unref(getArticleList)(true))
|
|
3639
3657
|
}, {
|
|
@@ -3647,7 +3665,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
3647
3665
|
_: 1
|
|
3648
3666
|
}, 8, ["modelValue", "placeholder"])
|
|
3649
3667
|
]),
|
|
3650
|
-
data.data.length === 0 && !data.busy ? (openBlock(), createElementBlock("div", _hoisted_4$2, toDisplayString(
|
|
3668
|
+
data.data.length === 0 && !data.busy ? (openBlock(), createElementBlock("div", _hoisted_4$2, toDisplayString(`没有符合条件的${isVideo.value ? "视频" : "文章"}哦,你可以试试搜索其他${isVideo.value ? "视频" : "文章"}~`), 1)) : withDirectives((openBlock(), createElementBlock("div", {
|
|
3651
3669
|
key: 1,
|
|
3652
3670
|
"infinite-scroll-immediate": false,
|
|
3653
3671
|
class: "insert-article_list",
|
|
@@ -3679,12 +3697,12 @@ const _sfc_main$5 = defineComponent({
|
|
|
3679
3697
|
}, null, 8, _hoisted_9$1)
|
|
3680
3698
|
]),
|
|
3681
3699
|
createElementVNode("div", _hoisted_10$1, [
|
|
3682
|
-
createElementVNode("span", _hoisted_11$1, toDisplayString(item.content || "[
|
|
3683
|
-
createElementVNode("span", null, toDisplayString(unref(date).format(item.createTime * 1e3, "YYYY-MM-DD hh-mm")), 1)
|
|
3700
|
+
createElementVNode("span", _hoisted_11$1, toDisplayString(item.content || "[无标题]"), 1),
|
|
3701
|
+
createElementVNode("span", null, toDisplayString(unref(date$1).format(item.createTime * 1e3, "YYYY-MM-DD hh-mm")), 1)
|
|
3684
3702
|
])
|
|
3685
3703
|
])) : (openBlock(), createElementBlock("div", _hoisted_12$1, [
|
|
3686
|
-
createElementVNode("span", null, toDisplayString(item.title || "[
|
|
3687
|
-
createElementVNode("span", null, toDisplayString(unref(date).format(item.createTime * 1e3, "YYYY-MM-DD")), 1)
|
|
3704
|
+
createElementVNode("span", null, toDisplayString(item.title || "[无标题]"), 1),
|
|
3705
|
+
createElementVNode("span", null, toDisplayString(unref(date$1).format(item.createTime * 1e3, "YYYY-MM-DD")), 1)
|
|
3688
3706
|
]))
|
|
3689
3707
|
];
|
|
3690
3708
|
}),
|
|
@@ -3702,6 +3720,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
3702
3720
|
};
|
|
3703
3721
|
}
|
|
3704
3722
|
});
|
|
3723
|
+
const index_vue_vue_type_style_index_0_lang$4 = "";
|
|
3705
3724
|
let getRandomValues;
|
|
3706
3725
|
const rnds8 = new Uint8Array(16);
|
|
3707
3726
|
function rng() {
|
|
@@ -3741,10 +3760,9 @@ function v4(options, buf, offset) {
|
|
|
3741
3760
|
}
|
|
3742
3761
|
return unsafeStringify(rnds);
|
|
3743
3762
|
}
|
|
3744
|
-
const
|
|
3745
|
-
const
|
|
3746
|
-
const
|
|
3747
|
-
const _hoisted_3$4 = ["onClick"];
|
|
3763
|
+
const _hoisted_1$5 = { class: "img-upload-content" };
|
|
3764
|
+
const _hoisted_2$2 = { class: "title-box" };
|
|
3765
|
+
const _hoisted_3$2 = ["onClick"];
|
|
3748
3766
|
const _hoisted_4$1 = {
|
|
3749
3767
|
key: 0,
|
|
3750
3768
|
class: "line"
|
|
@@ -3773,41 +3791,38 @@ const _hoisted_13 = {
|
|
|
3773
3791
|
key: 0,
|
|
3774
3792
|
class: "upload-wrap"
|
|
3775
3793
|
};
|
|
3776
|
-
const _hoisted_14 =
|
|
3777
|
-
const _hoisted_15 = /* @__PURE__ */ createElementVNode("span", { class: "remark" }, "\u652F\u6301jpg\u3001jpeg\u3001png\u7B49\u591A\u79CD\u683C\u5F0F\uFF0C\u5355\u5F20\u56FE\u7247\u6700\u5927\u652F\u630120MB", -1);
|
|
3778
|
-
const _hoisted_16 = {
|
|
3794
|
+
const _hoisted_14 = {
|
|
3779
3795
|
key: 1,
|
|
3780
3796
|
class: "img-list"
|
|
3781
3797
|
};
|
|
3782
|
-
const
|
|
3783
|
-
const
|
|
3784
|
-
const
|
|
3798
|
+
const _hoisted_15 = ["src"];
|
|
3799
|
+
const _hoisted_16 = { class: "upload-btn" };
|
|
3800
|
+
const _hoisted_17 = {
|
|
3785
3801
|
key: 2,
|
|
3786
3802
|
class: "map-depot"
|
|
3787
3803
|
};
|
|
3788
|
-
const
|
|
3789
|
-
const
|
|
3790
|
-
const
|
|
3791
|
-
const
|
|
3792
|
-
const
|
|
3804
|
+
const _hoisted_18 = { class: "screen" };
|
|
3805
|
+
const _hoisted_19 = { key: 0 };
|
|
3806
|
+
const _hoisted_20 = { class: "tab-box" };
|
|
3807
|
+
const _hoisted_21 = ["onClick"];
|
|
3808
|
+
const _hoisted_22 = {
|
|
3793
3809
|
key: 0,
|
|
3794
3810
|
class: "line"
|
|
3795
3811
|
};
|
|
3796
|
-
const
|
|
3797
|
-
const
|
|
3798
|
-
const
|
|
3799
|
-
const
|
|
3812
|
+
const _hoisted_23 = { class: "image-list depot-image" };
|
|
3813
|
+
const _hoisted_24 = ["onClick"];
|
|
3814
|
+
const _hoisted_25 = ["src"];
|
|
3815
|
+
const _hoisted_26 = {
|
|
3800
3816
|
key: 0,
|
|
3801
3817
|
class: "shade"
|
|
3802
3818
|
};
|
|
3803
|
-
const
|
|
3804
|
-
const
|
|
3819
|
+
const _hoisted_27 = { class: "num" };
|
|
3820
|
+
const _hoisted_28 = {
|
|
3805
3821
|
key: 1,
|
|
3806
3822
|
class: "protocol-box"
|
|
3807
3823
|
};
|
|
3808
|
-
const
|
|
3809
|
-
const
|
|
3810
|
-
const _sfc_main$4 = defineComponent({
|
|
3824
|
+
const _hoisted_29 = ["href"];
|
|
3825
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3811
3826
|
__name: "index",
|
|
3812
3827
|
props: {
|
|
3813
3828
|
visible: { type: Boolean, default: false },
|
|
@@ -3842,7 +3857,7 @@ const _sfc_main$4 = defineComponent({
|
|
|
3842
3857
|
const tempImgs = [...props.imgList];
|
|
3843
3858
|
Array.from(imgFile).forEach((file) => {
|
|
3844
3859
|
if (file.size > 20 * 1024 * 1024) {
|
|
3845
|
-
ElMessage.error("
|
|
3860
|
+
ElMessage.error("单张图片最大支持20M");
|
|
3846
3861
|
return;
|
|
3847
3862
|
}
|
|
3848
3863
|
const id = v4();
|
|
@@ -3872,14 +3887,14 @@ const _sfc_main$4 = defineComponent({
|
|
|
3872
3887
|
const list = [
|
|
3873
3888
|
{
|
|
3874
3889
|
id: 2,
|
|
3875
|
-
value: "
|
|
3890
|
+
value: "上传图片"
|
|
3876
3891
|
}
|
|
3877
3892
|
];
|
|
3878
3893
|
activeTitle.value = 2;
|
|
3879
3894
|
if (props.imgNum < 20) {
|
|
3880
3895
|
list.unshift({
|
|
3881
3896
|
id: 1,
|
|
3882
|
-
value: "
|
|
3897
|
+
value: "正文图片"
|
|
3883
3898
|
});
|
|
3884
3899
|
activeTitle.value = 1;
|
|
3885
3900
|
getContentImgList();
|
|
@@ -3887,7 +3902,7 @@ const _sfc_main$4 = defineComponent({
|
|
|
3887
3902
|
if (props.chartGallery) {
|
|
3888
3903
|
list.push({
|
|
3889
3904
|
id: 3,
|
|
3890
|
-
value: isEmotofine ? "
|
|
3905
|
+
value: isEmotofine ? "电摩范图库" : "摩托范图库"
|
|
3891
3906
|
});
|
|
3892
3907
|
}
|
|
3893
3908
|
titleList.value = list;
|
|
@@ -4032,13 +4047,13 @@ const _sfc_main$4 = defineComponent({
|
|
|
4032
4047
|
const tabList = ref([]);
|
|
4033
4048
|
const search = () => {
|
|
4034
4049
|
if (!selectData.brandId) {
|
|
4035
|
-
return ElMessage.error("
|
|
4050
|
+
return ElMessage.error("请选择品牌");
|
|
4036
4051
|
}
|
|
4037
4052
|
if (!selectData.goodId) {
|
|
4038
|
-
return ElMessage.error("
|
|
4053
|
+
return ElMessage.error("请选择车型");
|
|
4039
4054
|
}
|
|
4040
4055
|
if (!selectData.carId) {
|
|
4041
|
-
return ElMessage.error("
|
|
4056
|
+
return ElMessage.error("请选择款型");
|
|
4042
4057
|
}
|
|
4043
4058
|
tabList.value = [];
|
|
4044
4059
|
emits("update:imgList", []);
|
|
@@ -4089,13 +4104,13 @@ const _sfc_main$4 = defineComponent({
|
|
|
4089
4104
|
emits("update:imgList", list);
|
|
4090
4105
|
};
|
|
4091
4106
|
return (_ctx, _cache) => {
|
|
4092
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4107
|
+
return openBlock(), createBlock(_sfc_main$7, {
|
|
4093
4108
|
visible: props.visible,
|
|
4094
4109
|
showTitle: false
|
|
4095
4110
|
}, {
|
|
4096
4111
|
default: withCtx(() => [
|
|
4097
|
-
createElementVNode("div", _hoisted_1$
|
|
4098
|
-
createElementVNode("div", _hoisted_2$
|
|
4112
|
+
createElementVNode("div", _hoisted_1$5, [
|
|
4113
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
4099
4114
|
(openBlock(true), createElementBlock(Fragment, null, renderList(titleList.value, (item, index) => {
|
|
4100
4115
|
return openBlock(), createElementBlock("div", {
|
|
4101
4116
|
key: index,
|
|
@@ -4104,10 +4119,10 @@ const _sfc_main$4 = defineComponent({
|
|
|
4104
4119
|
}, [
|
|
4105
4120
|
createTextVNode(toDisplayString(item.value) + " ", 1),
|
|
4106
4121
|
item.id === activeTitle.value ? (openBlock(), createElementBlock("div", _hoisted_4$1)) : createCommentVNode("", true)
|
|
4107
|
-
], 10, _hoisted_3$
|
|
4122
|
+
], 10, _hoisted_3$2);
|
|
4108
4123
|
}), 128)),
|
|
4109
|
-
[1, 3].includes(activeTitle.value) && props.imgList.length ? (openBlock(), createElementBlock("div", _hoisted_5$1, "
|
|
4110
|
-
activeTitle.value === 2 && props.imgList.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(props.imgList.length) + "
|
|
4124
|
+
[1, 3].includes(activeTitle.value) && props.imgList.length ? (openBlock(), createElementBlock("div", _hoisted_5$1, " 最多可选" + toDisplayString(props.imgNum) + "张图片,已选" + toDisplayString(props.imgList.length) + "张 ", 1)) : createCommentVNode("", true),
|
|
4125
|
+
activeTitle.value === 2 && props.imgList.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(props.imgList.length) + "张上传成功 拖动可调整顺序 ", 1)) : createCommentVNode("", true)
|
|
4111
4126
|
]),
|
|
4112
4127
|
activeTitle.value === 1 ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
4113
4128
|
createElementVNode("div", _hoisted_8, [
|
|
@@ -4144,10 +4159,10 @@ const _sfc_main$4 = defineComponent({
|
|
|
4144
4159
|
]),
|
|
4145
4160
|
_: 1
|
|
4146
4161
|
}),
|
|
4147
|
-
|
|
4162
|
+
_cache[7] || (_cache[7] = createElementVNode("span", null, "本地上传", -1))
|
|
4148
4163
|
]),
|
|
4149
|
-
|
|
4150
|
-
])) : (openBlock(), createElementBlock("div",
|
|
4164
|
+
_cache[8] || (_cache[8] = createElementVNode("span", { class: "remark" }, "支持jpg、jpeg、png等多种格式,单张图片最大支持20MB", -1))
|
|
4165
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_14, [
|
|
4151
4166
|
createVNode(unref(draggable), {
|
|
4152
4167
|
modelValue: imgListTemp.value,
|
|
4153
4168
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => imgListTemp.value = $event),
|
|
@@ -4168,7 +4183,7 @@ const _sfc_main$4 = defineComponent({
|
|
|
4168
4183
|
style: { "object-fit": "contain" },
|
|
4169
4184
|
width: "120",
|
|
4170
4185
|
height: "120"
|
|
4171
|
-
}, null, 8,
|
|
4186
|
+
}, null, 8, _hoisted_15),
|
|
4172
4187
|
createVNode(unref(CircleCloseFilled), {
|
|
4173
4188
|
class: "icon pointer",
|
|
4174
4189
|
onClick: ($event) => deleteImg(element)
|
|
@@ -4191,7 +4206,7 @@ const _sfc_main$4 = defineComponent({
|
|
|
4191
4206
|
_: 1
|
|
4192
4207
|
}, 8, ["modelValue"])
|
|
4193
4208
|
])),
|
|
4194
|
-
createElementVNode("div",
|
|
4209
|
+
createElementVNode("div", _hoisted_16, [
|
|
4195
4210
|
createElementVNode("input", {
|
|
4196
4211
|
type: "file",
|
|
4197
4212
|
name: "file",
|
|
@@ -4202,13 +4217,13 @@ const _sfc_main$4 = defineComponent({
|
|
|
4202
4217
|
}, null, 32)
|
|
4203
4218
|
])
|
|
4204
4219
|
], 2)) : createCommentVNode("", true),
|
|
4205
|
-
activeTitle.value === 3 ? (openBlock(), createElementBlock("div",
|
|
4206
|
-
createElementVNode("div",
|
|
4220
|
+
activeTitle.value === 3 ? (openBlock(), createElementBlock("div", _hoisted_17, [
|
|
4221
|
+
createElementVNode("div", _hoisted_18, [
|
|
4207
4222
|
createElementVNode("div", null, [
|
|
4208
4223
|
createVNode(unref(ElSelect), {
|
|
4209
4224
|
modelValue: selectData.brandId,
|
|
4210
4225
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => selectData.brandId = $event),
|
|
4211
|
-
placeholder: "
|
|
4226
|
+
placeholder: "请选择品牌",
|
|
4212
4227
|
size: "large",
|
|
4213
4228
|
class: "select_1",
|
|
4214
4229
|
filterable: "",
|
|
@@ -4229,7 +4244,7 @@ const _sfc_main$4 = defineComponent({
|
|
|
4229
4244
|
createVNode(unref(ElSelect), {
|
|
4230
4245
|
modelValue: selectData.goodId,
|
|
4231
4246
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => selectData.goodId = $event),
|
|
4232
|
-
placeholder: "
|
|
4247
|
+
placeholder: "请选择车型",
|
|
4233
4248
|
size: "large",
|
|
4234
4249
|
class: "select_1",
|
|
4235
4250
|
filterable: "",
|
|
@@ -4250,7 +4265,7 @@ const _sfc_main$4 = defineComponent({
|
|
|
4250
4265
|
createVNode(unref(ElSelect), {
|
|
4251
4266
|
modelValue: selectData.carId,
|
|
4252
4267
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => selectData.carId = $event),
|
|
4253
|
-
placeholder: "
|
|
4268
|
+
placeholder: "请选择款型",
|
|
4254
4269
|
size: "large",
|
|
4255
4270
|
class: "select_2",
|
|
4256
4271
|
filterable: "",
|
|
@@ -4274,14 +4289,14 @@ const _sfc_main$4 = defineComponent({
|
|
|
4274
4289
|
style: { "width": "80px" },
|
|
4275
4290
|
onClick: search
|
|
4276
4291
|
}, {
|
|
4277
|
-
default: withCtx(() => [
|
|
4278
|
-
createTextVNode("
|
|
4279
|
-
]),
|
|
4292
|
+
default: withCtx(() => _cache[9] || (_cache[9] = [
|
|
4293
|
+
createTextVNode("搜索")
|
|
4294
|
+
])),
|
|
4280
4295
|
_: 1
|
|
4281
4296
|
})
|
|
4282
4297
|
]),
|
|
4283
|
-
tabList.value && tabList.value.length ? (openBlock(), createElementBlock("div",
|
|
4284
|
-
createElementVNode("div",
|
|
4298
|
+
tabList.value && tabList.value.length ? (openBlock(), createElementBlock("div", _hoisted_19, [
|
|
4299
|
+
createElementVNode("div", _hoisted_20, [
|
|
4285
4300
|
(openBlock(true), createElementBlock(Fragment, null, renderList(tabList.value, (item, index) => {
|
|
4286
4301
|
return openBlock(), createElementBlock("div", {
|
|
4287
4302
|
key: index,
|
|
@@ -4289,11 +4304,11 @@ const _sfc_main$4 = defineComponent({
|
|
|
4289
4304
|
onClick: ($event) => activeTab.value = item.type
|
|
4290
4305
|
}, [
|
|
4291
4306
|
createTextVNode(toDisplayString(item.name) + " ", 1),
|
|
4292
|
-
item.type === activeTab.value ? (openBlock(), createElementBlock("div",
|
|
4293
|
-
], 10,
|
|
4307
|
+
item.type === activeTab.value ? (openBlock(), createElementBlock("div", _hoisted_22)) : createCommentVNode("", true)
|
|
4308
|
+
], 10, _hoisted_21);
|
|
4294
4309
|
}), 128))
|
|
4295
4310
|
]),
|
|
4296
|
-
createElementVNode("div",
|
|
4311
|
+
createElementVNode("div", _hoisted_23, [
|
|
4297
4312
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageList.value, (item, index) => {
|
|
4298
4313
|
return openBlock(), createElementBlock("div", {
|
|
4299
4314
|
key: index,
|
|
@@ -4304,25 +4319,25 @@ const _sfc_main$4 = defineComponent({
|
|
|
4304
4319
|
src: item.imgOrgUrl,
|
|
4305
4320
|
alt: "",
|
|
4306
4321
|
class: "image"
|
|
4307
|
-
}, null, 8,
|
|
4308
|
-
item.num ? (openBlock(), createElementBlock("div",
|
|
4309
|
-
createElementVNode("div",
|
|
4322
|
+
}, null, 8, _hoisted_25),
|
|
4323
|
+
item.num ? (openBlock(), createElementBlock("div", _hoisted_26, [
|
|
4324
|
+
createElementVNode("div", _hoisted_27, toDisplayString(item.num), 1)
|
|
4310
4325
|
])) : createCommentVNode("", true)
|
|
4311
|
-
], 8,
|
|
4326
|
+
], 8, _hoisted_24);
|
|
4312
4327
|
}), 128))
|
|
4313
4328
|
])
|
|
4314
|
-
])) : (openBlock(), createElementBlock("div",
|
|
4329
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_28, [
|
|
4315
4330
|
createElementVNode("div", null, [
|
|
4316
|
-
|
|
4331
|
+
_cache[12] || (_cache[12] = createElementVNode("div", null, " 图库中的图片仅限下载摩托范以编辑发布文章使用,不得用于其他任何平台及用途 ", -1)),
|
|
4317
4332
|
createElementVNode("div", null, [
|
|
4318
|
-
createTextVNode("
|
|
4333
|
+
_cache[10] || (_cache[10] = createTextVNode(" 请阅读")),
|
|
4319
4334
|
createElementVNode("a", {
|
|
4320
4335
|
href: `https://${unref(hostName)}/about?type=imageLicenseAgreement`,
|
|
4321
4336
|
target: "_blank",
|
|
4322
4337
|
rel: "noopener noreferrer",
|
|
4323
4338
|
class: "link"
|
|
4324
|
-
}, "
|
|
4325
|
-
createTextVNode("
|
|
4339
|
+
}, "《摩托范图片许可使用协议》", 8, _hoisted_29),
|
|
4340
|
+
_cache[11] || (_cache[11] = createTextVNode(",您的行为视为您已同意该协议。 "))
|
|
4326
4341
|
])
|
|
4327
4342
|
])
|
|
4328
4343
|
]))
|
|
@@ -4334,11 +4349,9 @@ const _sfc_main$4 = defineComponent({
|
|
|
4334
4349
|
};
|
|
4335
4350
|
}
|
|
4336
4351
|
});
|
|
4337
|
-
const index_vue_vue_type_style_index_0_lang$
|
|
4338
|
-
const _hoisted_1$
|
|
4339
|
-
const
|
|
4340
|
-
const _hoisted_3$3 = /* @__PURE__ */ 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);
|
|
4341
|
-
const _sfc_main$3 = defineComponent({
|
|
4352
|
+
const index_vue_vue_type_style_index_0_lang$3 = "";
|
|
4353
|
+
const _hoisted_1$4 = { class: "insert-video" };
|
|
4354
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
4342
4355
|
__name: "index",
|
|
4343
4356
|
props: {
|
|
4344
4357
|
visible: { type: Boolean, default: false },
|
|
@@ -4360,29 +4373,29 @@ const _sfc_main$3 = defineComponent({
|
|
|
4360
4373
|
ele[0].dispatchEvent(event);
|
|
4361
4374
|
};
|
|
4362
4375
|
return (_ctx, _cache) => {
|
|
4363
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4376
|
+
return openBlock(), createBlock(_sfc_main$7, {
|
|
4364
4377
|
"show-btn": false,
|
|
4365
4378
|
visible: unref(visible),
|
|
4366
4379
|
width: "600px",
|
|
4367
4380
|
height: "100px"
|
|
4368
4381
|
}, {
|
|
4369
|
-
title: withCtx(() => [
|
|
4370
|
-
|
|
4371
|
-
]),
|
|
4382
|
+
title: withCtx(() => _cache[1] || (_cache[1] = [
|
|
4383
|
+
createElementVNode("span", null, "插入视频", -1)
|
|
4384
|
+
])),
|
|
4372
4385
|
default: withCtx(() => [
|
|
4373
|
-
createElementVNode("div",
|
|
4386
|
+
createElementVNode("div", _hoisted_1$4, [
|
|
4374
4387
|
createVNode(unref(ElButton), {
|
|
4375
4388
|
style: { "width": "120px" },
|
|
4376
4389
|
round: "",
|
|
4377
4390
|
type: "primary",
|
|
4378
4391
|
onClick: emitEvent
|
|
4379
4392
|
}, {
|
|
4380
|
-
default: withCtx(() => [
|
|
4381
|
-
createTextVNode("
|
|
4382
|
-
]),
|
|
4393
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
4394
|
+
createTextVNode("选择视频")
|
|
4395
|
+
])),
|
|
4383
4396
|
_: 1
|
|
4384
4397
|
}),
|
|
4385
|
-
|
|
4398
|
+
_cache[3] || (_cache[3] = createElementVNode("span", { class: "remark" }, "为了获得更高的推荐量和点击量,建议上传720p(1280*720)或更高分辨率的视频,视频格式为.mp4或.mov,大小不超过1G", -1)),
|
|
4386
4399
|
createElementVNode("input", {
|
|
4387
4400
|
type: "file",
|
|
4388
4401
|
accept: "video/*",
|
|
@@ -4397,112 +4410,955 @@ const _sfc_main$3 = defineComponent({
|
|
|
4397
4410
|
};
|
|
4398
4411
|
}
|
|
4399
4412
|
});
|
|
4400
|
-
const index_vue_vue_type_style_index_0_lang = "";
|
|
4401
|
-
const
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
vm: this
|
|
4405
|
-
};
|
|
4406
|
-
},
|
|
4407
|
-
components: {
|
|
4408
|
-
ElInput,
|
|
4409
|
-
BasicDialog: _sfc_main$6,
|
|
4410
|
-
draggable
|
|
4411
|
-
},
|
|
4413
|
+
const index_vue_vue_type_style_index_0_lang$2 = "";
|
|
4414
|
+
const index_vue_vue_type_style_index_0_lang$1 = "";
|
|
4415
|
+
const _sfc_main$3 = {
|
|
4416
|
+
name: "TopicManager",
|
|
4412
4417
|
props: {
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
linkContent: {
|
|
4418
|
-
type: String,
|
|
4419
|
-
default: ""
|
|
4418
|
+
// 编辑器DOM引用
|
|
4419
|
+
editorDom: {
|
|
4420
|
+
type: Object,
|
|
4421
|
+
default: null
|
|
4420
4422
|
},
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4423
|
+
// 话题API请求方法
|
|
4424
|
+
request: {
|
|
4425
|
+
type: Object,
|
|
4426
|
+
default: null
|
|
4425
4427
|
}
|
|
4426
4428
|
},
|
|
4427
4429
|
data() {
|
|
4428
|
-
return {
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4430
|
+
return {
|
|
4431
|
+
// 话题弹框相关数据
|
|
4432
|
+
topicPopover: {
|
|
4433
|
+
visible: false,
|
|
4434
|
+
type: "hot",
|
|
4435
|
+
// 'hot' 热门话题, 'search' 搜索话题
|
|
4436
|
+
activeTab: "hot",
|
|
4437
|
+
// 'hot' 热门话题, 'recent' 最近使用
|
|
4438
|
+
position: { top: 0, left: 0 },
|
|
4439
|
+
searchKeyword: "",
|
|
4440
|
+
hotTopics: [],
|
|
4441
|
+
searchTopics: [],
|
|
4442
|
+
recentTopics: [],
|
|
4443
|
+
loading: false,
|
|
4444
|
+
page: 1,
|
|
4445
|
+
hasMore: true,
|
|
4446
|
+
searchPage: 1,
|
|
4447
|
+
searchHasMore: true,
|
|
4448
|
+
// 用于增量更新的计数器
|
|
4449
|
+
newHotTopicsCount: 0,
|
|
4450
|
+
newSearchTopicsCount: 0,
|
|
4451
|
+
// 保存原始的selection和range信息
|
|
4452
|
+
originalRange: null,
|
|
4453
|
+
originalSelection: null,
|
|
4454
|
+
// 保存触发位置信息
|
|
4455
|
+
triggerInfo: {
|
|
4456
|
+
paragraph: null,
|
|
4457
|
+
hashIndex: -1,
|
|
4458
|
+
cursorPosition: 0
|
|
4459
|
+
},
|
|
4460
|
+
// 全局弹框DOM引用
|
|
4461
|
+
globalContainer: null,
|
|
4462
|
+
globalMask: null
|
|
4437
4463
|
}
|
|
4438
|
-
}
|
|
4439
|
-
},
|
|
4440
|
-
mounted() {
|
|
4441
|
-
},
|
|
4442
|
-
methods: {
|
|
4443
|
-
emitEvent() {
|
|
4444
|
-
var event = new MouseEvent("click");
|
|
4445
|
-
var ele = document.getElementsByClassName("video-input");
|
|
4446
|
-
ele[0].dispatchEvent(event);
|
|
4447
|
-
},
|
|
4448
|
-
setStatus(val) {
|
|
4449
|
-
this.$emit("update:visible", val);
|
|
4450
|
-
}
|
|
4451
|
-
}
|
|
4452
|
-
};
|
|
4453
|
-
const _hoisted_1$2 = /* @__PURE__ */ createElementVNode("div", null, [
|
|
4454
|
-
/* @__PURE__ */ createElementVNode("span", null, "\u91C7\u96C6\u6587\u7AE0"),
|
|
4455
|
-
/* @__PURE__ */ createElementVNode("span", { class: "collect-article_lable" }, "\u5982\u9700\u83B7\u5F97\u6B63\u5F0F\u4F7F\u7528\u6743\uFF0C\u8BF7\u81EA\u884C\u8054\u7CFB\u7248\u6743\u6240\u6709\u8005")
|
|
4456
|
-
], -1);
|
|
4457
|
-
const _hoisted_2$2 = { class: "collect-article_content" };
|
|
4458
|
-
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("div", { class: "tip" }, "\u8BF7\u628A\u9700\u8981\u91C7\u96C6\u7684\u6587\u7AE0\u94FE\u63A5\u7C98\u8D34\u5728\u4E0B\u65B9\u7684\u8F93\u5165\u6846\uFF1A", -1);
|
|
4459
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4460
|
-
const _component_el_input = resolveComponent("el-input");
|
|
4461
|
-
const _component_BasicDialog = resolveComponent("BasicDialog");
|
|
4462
|
-
return openBlock(), createBlock(_component_BasicDialog, {
|
|
4463
|
-
visible: $props.visible,
|
|
4464
|
-
width: "600px",
|
|
4465
|
-
height: "50px"
|
|
4466
|
-
}, {
|
|
4467
|
-
title: withCtx(() => [
|
|
4468
|
-
_hoisted_1$2
|
|
4469
|
-
]),
|
|
4470
|
-
default: withCtx(() => [
|
|
4471
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
4472
|
-
_hoisted_3$2,
|
|
4473
|
-
createVNode(_component_el_input, {
|
|
4474
|
-
modelValue: $options.input,
|
|
4475
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.input = $event),
|
|
4476
|
-
placeholder: "\u4EC5\u652F\u6301\u5FAE\u4FE1\u94FE\u63A5"
|
|
4477
|
-
}, null, 8, ["modelValue"])
|
|
4478
|
-
])
|
|
4479
|
-
]),
|
|
4480
|
-
_: 1
|
|
4481
|
-
}, 8, ["visible"]);
|
|
4482
|
-
}
|
|
4483
|
-
const CollectArticle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
4484
|
-
const index_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
4485
|
-
const _sfc_main$1 = {
|
|
4486
|
-
components: {
|
|
4487
|
-
ElIconError: CircleCloseFilled
|
|
4488
|
-
},
|
|
4489
|
-
props: {
|
|
4490
|
-
article: {
|
|
4491
|
-
type: Object,
|
|
4492
|
-
default: () => ({})
|
|
4493
|
-
}
|
|
4464
|
+
};
|
|
4494
4465
|
},
|
|
4495
4466
|
methods: {
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
break;
|
|
4502
|
-
}
|
|
4503
|
-
child = child.parentNode;
|
|
4467
|
+
// 初始化话题管理器
|
|
4468
|
+
init() {
|
|
4469
|
+
if (!this.editorDom) {
|
|
4470
|
+
console.warn("TopicManager: editorDom is required");
|
|
4471
|
+
return;
|
|
4504
4472
|
}
|
|
4505
|
-
this
|
|
4473
|
+
setTimeout(() => this.bindEditorEvents(), 0);
|
|
4474
|
+
},
|
|
4475
|
+
// 绑定编辑器事件
|
|
4476
|
+
bindEditorEvents() {
|
|
4477
|
+
if (!this.editorDom)
|
|
4478
|
+
return;
|
|
4479
|
+
this.editorDom.addEventListener("keydown", this.handleTopicInput.bind(this));
|
|
4480
|
+
},
|
|
4481
|
+
// 解绑编辑器事件
|
|
4482
|
+
unbindEditorEvents() {
|
|
4483
|
+
if (!this.editorDom)
|
|
4484
|
+
return;
|
|
4485
|
+
this.editorDom.removeEventListener("keydown", this.handleTopicInput.bind(this));
|
|
4486
|
+
},
|
|
4487
|
+
// 话题输入处理
|
|
4488
|
+
handleTopicInput(event) {
|
|
4489
|
+
var _a;
|
|
4490
|
+
const activeElement = document.activeElement;
|
|
4491
|
+
if (activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA")) {
|
|
4492
|
+
return;
|
|
4493
|
+
}
|
|
4494
|
+
const selection = window.getSelection();
|
|
4495
|
+
if (selection.rangeCount === 0)
|
|
4496
|
+
return;
|
|
4497
|
+
const range = selection.getRangeAt(0);
|
|
4498
|
+
const container = range.startContainer;
|
|
4499
|
+
if (!this.editorDom.contains(container))
|
|
4500
|
+
return;
|
|
4501
|
+
let currentNode = container;
|
|
4502
|
+
while (currentNode && currentNode !== this.editorDom) {
|
|
4503
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.tagName === "MDD-TOPIC") {
|
|
4504
|
+
return;
|
|
4505
|
+
}
|
|
4506
|
+
currentNode = currentNode.parentNode;
|
|
4507
|
+
}
|
|
4508
|
+
let paragraph = container;
|
|
4509
|
+
while (paragraph && paragraph.nodeType !== Node.ELEMENT_NODE) {
|
|
4510
|
+
paragraph = paragraph.parentNode;
|
|
4511
|
+
}
|
|
4512
|
+
while (paragraph && !((_a = paragraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
4513
|
+
paragraph = paragraph.parentNode;
|
|
4514
|
+
}
|
|
4515
|
+
if (!paragraph)
|
|
4516
|
+
return;
|
|
4517
|
+
const { textContent: paragraphText, cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
4518
|
+
if (event.key === "#") {
|
|
4519
|
+
const afterCursor = paragraphText.substring(cursorPosition);
|
|
4520
|
+
if (afterCursor.length > 0 && afterCursor[0] === " ") {
|
|
4521
|
+
return;
|
|
4522
|
+
}
|
|
4523
|
+
setTimeout(() => {
|
|
4524
|
+
const position = this.getCaretPosition();
|
|
4525
|
+
const triggerInfo = {
|
|
4526
|
+
paragraph,
|
|
4527
|
+
hashIndex: cursorPosition,
|
|
4528
|
+
// #号的位置
|
|
4529
|
+
cursorPosition: cursorPosition + 1
|
|
4530
|
+
// #号后的位置
|
|
4531
|
+
};
|
|
4532
|
+
this.showTopicPopover("hot", position, "", triggerInfo);
|
|
4533
|
+
}, 10);
|
|
4534
|
+
} else if (this.shouldTriggerSearch(event.key)) {
|
|
4535
|
+
setTimeout(() => {
|
|
4536
|
+
this.checkAndTriggerSearch(paragraph);
|
|
4537
|
+
}, 10);
|
|
4538
|
+
} else {
|
|
4539
|
+
this.hideTopicPopover();
|
|
4540
|
+
}
|
|
4541
|
+
},
|
|
4542
|
+
shouldTriggerSearch(key) {
|
|
4543
|
+
return key.length === 1 || key === "Backspace" || key === "Delete";
|
|
4544
|
+
},
|
|
4545
|
+
checkAndTriggerSearch(paragraph) {
|
|
4546
|
+
const selection = window.getSelection();
|
|
4547
|
+
if (selection.rangeCount === 0)
|
|
4548
|
+
return;
|
|
4549
|
+
const range = selection.getRangeAt(0);
|
|
4550
|
+
let currentNode = range.startContainer;
|
|
4551
|
+
while (currentNode && currentNode !== paragraph) {
|
|
4552
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.tagName === "MDD-TOPIC") {
|
|
4553
|
+
this.hideTopicPopover();
|
|
4554
|
+
return;
|
|
4555
|
+
}
|
|
4556
|
+
currentNode = currentNode.parentNode;
|
|
4557
|
+
}
|
|
4558
|
+
const { textContent: paragraphText, cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
4559
|
+
const beforeCursor = paragraphText.substring(0, cursorPosition);
|
|
4560
|
+
const hashIndex = beforeCursor.lastIndexOf("#");
|
|
4561
|
+
if (hashIndex !== -1) {
|
|
4562
|
+
const afterHash = beforeCursor.substring(hashIndex + 1).replace(/\u00A0/g, " ");
|
|
4563
|
+
if (afterHash.indexOf(" ") === -1) {
|
|
4564
|
+
if (afterHash.length <= 15) {
|
|
4565
|
+
const position = this.getCaretPosition();
|
|
4566
|
+
const triggerInfo = {
|
|
4567
|
+
paragraph,
|
|
4568
|
+
hashIndex,
|
|
4569
|
+
cursorPosition
|
|
4570
|
+
};
|
|
4571
|
+
if (afterHash.length === 0) {
|
|
4572
|
+
this.showTopicPopover("hot", position, "", triggerInfo);
|
|
4573
|
+
} else {
|
|
4574
|
+
this.showTopicPopover("search", position, afterHash, triggerInfo);
|
|
4575
|
+
}
|
|
4576
|
+
} else if (afterHash.length > 15) {
|
|
4577
|
+
this.hideTopicPopover();
|
|
4578
|
+
}
|
|
4579
|
+
} else {
|
|
4580
|
+
this.hideTopicPopover();
|
|
4581
|
+
}
|
|
4582
|
+
} else {
|
|
4583
|
+
this.hideTopicPopover();
|
|
4584
|
+
}
|
|
4585
|
+
},
|
|
4586
|
+
getParagraphTextExcludingTopics(paragraph, range) {
|
|
4587
|
+
let textContent = "";
|
|
4588
|
+
let cursorPosition = 0;
|
|
4589
|
+
let foundCursor = false;
|
|
4590
|
+
const walker = document.createTreeWalker(
|
|
4591
|
+
paragraph,
|
|
4592
|
+
NodeFilter.SHOW_ALL,
|
|
4593
|
+
{
|
|
4594
|
+
acceptNode: function(node2) {
|
|
4595
|
+
if (node2.nodeType === Node.ELEMENT_NODE && node2.tagName === "MDD-TOPIC") {
|
|
4596
|
+
return NodeFilter.FILTER_REJECT;
|
|
4597
|
+
}
|
|
4598
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
4599
|
+
}
|
|
4600
|
+
},
|
|
4601
|
+
false
|
|
4602
|
+
);
|
|
4603
|
+
let node;
|
|
4604
|
+
while (node = walker.nextNode()) {
|
|
4605
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
4606
|
+
const nodeText = node.textContent;
|
|
4607
|
+
if (!foundCursor && node === range.startContainer) {
|
|
4608
|
+
cursorPosition = textContent.length + range.startOffset;
|
|
4609
|
+
foundCursor = true;
|
|
4610
|
+
}
|
|
4611
|
+
textContent += nodeText;
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4614
|
+
return { textContent, cursorPosition };
|
|
4615
|
+
},
|
|
4616
|
+
getCaretPosition() {
|
|
4617
|
+
const selection = window.getSelection();
|
|
4618
|
+
if (selection.rangeCount === 0)
|
|
4619
|
+
return { top: 0, left: 0 };
|
|
4620
|
+
const range = selection.getRangeAt(0);
|
|
4621
|
+
const tempElement = document.createElement("span");
|
|
4622
|
+
tempElement.style.position = "absolute";
|
|
4623
|
+
tempElement.style.visibility = "hidden";
|
|
4624
|
+
tempElement.style.pointerEvents = "none";
|
|
4625
|
+
tempElement.style.whiteSpace = "nowrap";
|
|
4626
|
+
tempElement.textContent = "|";
|
|
4627
|
+
try {
|
|
4628
|
+
const clonedRange = range.cloneRange();
|
|
4629
|
+
clonedRange.collapse(true);
|
|
4630
|
+
clonedRange.insertNode(tempElement);
|
|
4631
|
+
const rect = tempElement.getBoundingClientRect();
|
|
4632
|
+
tempElement.remove();
|
|
4633
|
+
const position = {
|
|
4634
|
+
top: rect.bottom,
|
|
4635
|
+
// 弹框显示在光标下方
|
|
4636
|
+
left: rect.left
|
|
4637
|
+
};
|
|
4638
|
+
const viewportWidth = window.innerWidth;
|
|
4639
|
+
const viewportHeight = window.innerHeight;
|
|
4640
|
+
const popoverWidth = 430;
|
|
4641
|
+
const popoverHeight = 286;
|
|
4642
|
+
if (position.left + popoverWidth > viewportWidth) {
|
|
4643
|
+
position.left = Math.max(10, viewportWidth - popoverWidth - 10);
|
|
4644
|
+
}
|
|
4645
|
+
if (position.top + popoverHeight > viewportHeight) {
|
|
4646
|
+
position.top = rect.top - popoverHeight;
|
|
4647
|
+
if (position.top < 0) {
|
|
4648
|
+
position.top = Math.min(rect.bottom, viewportHeight - popoverHeight - 10);
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
return position;
|
|
4652
|
+
} catch (error) {
|
|
4653
|
+
console.warn("获取光标位置失败,使用fallback方法:", error);
|
|
4654
|
+
const rect = range.getBoundingClientRect();
|
|
4655
|
+
return {
|
|
4656
|
+
top: rect.bottom,
|
|
4657
|
+
left: Math.max(10, rect.left)
|
|
4658
|
+
};
|
|
4659
|
+
}
|
|
4660
|
+
},
|
|
4661
|
+
// 话题弹框相关方法
|
|
4662
|
+
showTopicPopover(type, position, searchKeyword = "", triggerInfo = null) {
|
|
4663
|
+
if (!this.request || !this.request.getTopic) {
|
|
4664
|
+
console.warn("话题功能需要提供 request.getTopic 方法");
|
|
4665
|
+
return;
|
|
4666
|
+
}
|
|
4667
|
+
const selection = window.getSelection();
|
|
4668
|
+
if (selection.rangeCount > 0) {
|
|
4669
|
+
this.topicPopover.originalRange = selection.getRangeAt(0).cloneRange();
|
|
4670
|
+
this.topicPopover.originalSelection = selection;
|
|
4671
|
+
}
|
|
4672
|
+
if (triggerInfo) {
|
|
4673
|
+
this.topicPopover.triggerInfo = triggerInfo;
|
|
4674
|
+
}
|
|
4675
|
+
this.topicPopover.visible = true;
|
|
4676
|
+
this.topicPopover.type = type;
|
|
4677
|
+
this.topicPopover.position = position;
|
|
4678
|
+
this.topicPopover.searchKeyword = searchKeyword;
|
|
4679
|
+
if (type === "hot") {
|
|
4680
|
+
this.topicPopover.activeTab = "hot";
|
|
4681
|
+
this.loadHotTopics();
|
|
4682
|
+
this.loadRecentTopics();
|
|
4683
|
+
} else if (type === "search") {
|
|
4684
|
+
this.searchTopics(searchKeyword);
|
|
4685
|
+
}
|
|
4686
|
+
this.createGlobalTopicPopover();
|
|
4687
|
+
},
|
|
4688
|
+
hideTopicPopover() {
|
|
4689
|
+
this.topicPopover.visible = false;
|
|
4690
|
+
this.topicPopover.hotTopics = [];
|
|
4691
|
+
this.topicPopover.searchTopics = [];
|
|
4692
|
+
this.topicPopover.page = 1;
|
|
4693
|
+
this.topicPopover.searchPage = 1;
|
|
4694
|
+
this.topicPopover.hasMore = true;
|
|
4695
|
+
this.topicPopover.searchHasMore = true;
|
|
4696
|
+
this.topicPopover.originalRange = null;
|
|
4697
|
+
this.topicPopover.originalSelection = null;
|
|
4698
|
+
this.topicPopover.triggerInfo = {
|
|
4699
|
+
paragraph: null,
|
|
4700
|
+
hashIndex: -1,
|
|
4701
|
+
cursorPosition: 0
|
|
4702
|
+
};
|
|
4703
|
+
this.removeGlobalTopicPopover();
|
|
4704
|
+
},
|
|
4705
|
+
switchTopicTab(tab) {
|
|
4706
|
+
this.topicPopover.activeTab = tab;
|
|
4707
|
+
this.updateGlobalTopicPopover();
|
|
4708
|
+
},
|
|
4709
|
+
async loadHotTopics() {
|
|
4710
|
+
if (this.topicPopover.loading || !this.topicPopover.hasMore)
|
|
4711
|
+
return;
|
|
4712
|
+
this.topicPopover.loading = true;
|
|
4713
|
+
try {
|
|
4714
|
+
const response = await this.request.getTopic({
|
|
4715
|
+
action: "201023",
|
|
4716
|
+
page: this.topicPopover.page,
|
|
4717
|
+
limit: 50,
|
|
4718
|
+
hoopId: 0,
|
|
4719
|
+
type: 0,
|
|
4720
|
+
orderBy: "view"
|
|
4721
|
+
});
|
|
4722
|
+
if (response && response.data && response.data.code === 0) {
|
|
4723
|
+
const topics = response.data.data || [];
|
|
4724
|
+
if (topics.length === 0) {
|
|
4725
|
+
this.topicPopover.hasMore = false;
|
|
4726
|
+
} else {
|
|
4727
|
+
const existingIds = new Set(this.topicPopover.hotTopics.map((t) => t.id));
|
|
4728
|
+
const newTopics = topics.filter((t) => !existingIds.has(t.id));
|
|
4729
|
+
this.topicPopover.newHotTopicsCount = newTopics.length;
|
|
4730
|
+
this.topicPopover.hotTopics.push(...newTopics);
|
|
4731
|
+
this.topicPopover.page++;
|
|
4732
|
+
if (newTopics.length === 0) {
|
|
4733
|
+
this.topicPopover.hasMore = false;
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
} else {
|
|
4737
|
+
console.warn("加载热门话题失败:", response);
|
|
4738
|
+
this.topicPopover.hasMore = false;
|
|
4739
|
+
}
|
|
4740
|
+
} catch (error) {
|
|
4741
|
+
console.error("加载热门话题失败:", error);
|
|
4742
|
+
this.topicPopover.hasMore = false;
|
|
4743
|
+
} finally {
|
|
4744
|
+
this.topicPopover.loading = false;
|
|
4745
|
+
this.appendHotTopicsToDOM();
|
|
4746
|
+
}
|
|
4747
|
+
},
|
|
4748
|
+
async searchTopics(keyword) {
|
|
4749
|
+
this.topicPopover.searchKeyword = keyword;
|
|
4750
|
+
this.topicPopover.searchTopics = [];
|
|
4751
|
+
this.topicPopover.searchPage = 1;
|
|
4752
|
+
this.topicPopover.searchHasMore = true;
|
|
4753
|
+
if (this.topicPopover.loading) {
|
|
4754
|
+
this.topicPopover.loading = false;
|
|
4755
|
+
}
|
|
4756
|
+
this.topicPopover.loading = true;
|
|
4757
|
+
try {
|
|
4758
|
+
const response = await this.request.getTopic({
|
|
4759
|
+
action: "201023",
|
|
4760
|
+
title: keyword,
|
|
4761
|
+
highlightTitle: "title",
|
|
4762
|
+
page: this.topicPopover.searchPage,
|
|
4763
|
+
limit: 50
|
|
4764
|
+
});
|
|
4765
|
+
if (response && response.data && response.data.code === 0) {
|
|
4766
|
+
const topics = response.data.data || [];
|
|
4767
|
+
this.topicPopover.searchTopics = topics;
|
|
4768
|
+
this.topicPopover.searchPage++;
|
|
4769
|
+
if (topics.length === 0) {
|
|
4770
|
+
this.topicPopover.searchHasMore = false;
|
|
4771
|
+
} else {
|
|
4772
|
+
this.topicPopover.searchHasMore = topics.length >= 50;
|
|
4773
|
+
}
|
|
4774
|
+
} else {
|
|
4775
|
+
console.warn("搜索话题失败:", response);
|
|
4776
|
+
this.topicPopover.searchHasMore = false;
|
|
4777
|
+
}
|
|
4778
|
+
} catch (error) {
|
|
4779
|
+
console.error("搜索话题失败:", error);
|
|
4780
|
+
this.topicPopover.searchHasMore = false;
|
|
4781
|
+
} finally {
|
|
4782
|
+
this.topicPopover.loading = false;
|
|
4783
|
+
this.updateGlobalTopicPopover();
|
|
4784
|
+
}
|
|
4785
|
+
},
|
|
4786
|
+
// 加载更多搜索话题
|
|
4787
|
+
async loadSearchTopics() {
|
|
4788
|
+
if (this.topicPopover.loading || !this.topicPopover.searchHasMore)
|
|
4789
|
+
return;
|
|
4790
|
+
this.topicPopover.loading = true;
|
|
4791
|
+
try {
|
|
4792
|
+
const response = await this.request.getTopic({
|
|
4793
|
+
action: "201023",
|
|
4794
|
+
title: this.topicPopover.searchKeyword,
|
|
4795
|
+
highlightTitle: "title",
|
|
4796
|
+
page: this.topicPopover.searchPage,
|
|
4797
|
+
limit: 50
|
|
4798
|
+
});
|
|
4799
|
+
if (response && response.data && response.data.code === 0) {
|
|
4800
|
+
const topics = response.data.data || [];
|
|
4801
|
+
if (topics.length === 0) {
|
|
4802
|
+
this.topicPopover.searchHasMore = false;
|
|
4803
|
+
} else {
|
|
4804
|
+
const existingIds = new Set(this.topicPopover.searchTopics.map((t) => t.id));
|
|
4805
|
+
const newTopics = topics.filter((t) => !existingIds.has(t.id));
|
|
4806
|
+
this.topicPopover.newSearchTopicsCount = newTopics.length;
|
|
4807
|
+
this.topicPopover.searchTopics.push(...newTopics);
|
|
4808
|
+
this.topicPopover.searchPage++;
|
|
4809
|
+
if (newTopics.length === 0 || topics.length < 50) {
|
|
4810
|
+
this.topicPopover.searchHasMore = false;
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
} else {
|
|
4814
|
+
console.warn("加载更多搜索话题失败:", response);
|
|
4815
|
+
this.topicPopover.searchHasMore = false;
|
|
4816
|
+
}
|
|
4817
|
+
} catch (error) {
|
|
4818
|
+
console.error("加载更多搜索话题失败:", error);
|
|
4819
|
+
this.topicPopover.searchHasMore = false;
|
|
4820
|
+
} finally {
|
|
4821
|
+
this.topicPopover.loading = false;
|
|
4822
|
+
this.appendSearchTopicsToDOM();
|
|
4823
|
+
}
|
|
4824
|
+
},
|
|
4825
|
+
loadRecentTopics() {
|
|
4826
|
+
try {
|
|
4827
|
+
const localTopics = JSON.parse(localStorage.getItem("localTopic") || "[]");
|
|
4828
|
+
this.topicPopover.recentTopics = localTopics;
|
|
4829
|
+
} catch (error) {
|
|
4830
|
+
console.error("加载最近使用话题失败:", error);
|
|
4831
|
+
this.topicPopover.recentTopics = [];
|
|
4832
|
+
}
|
|
4833
|
+
},
|
|
4834
|
+
selectTopic(topic) {
|
|
4835
|
+
this.saveToRecentTopics(topic);
|
|
4836
|
+
this.insertTopicToEditor(topic);
|
|
4837
|
+
this.hideTopicPopover();
|
|
4838
|
+
this.$emit("topic-inserted", topic);
|
|
4839
|
+
},
|
|
4840
|
+
saveToRecentTopics(topic) {
|
|
4841
|
+
try {
|
|
4842
|
+
let recentTopics = JSON.parse(localStorage.getItem("localTopic") || "[]");
|
|
4843
|
+
recentTopics = recentTopics.filter((item) => item.id !== topic.id);
|
|
4844
|
+
recentTopics.unshift(topic);
|
|
4845
|
+
if (recentTopics.length > 20) {
|
|
4846
|
+
recentTopics = recentTopics.slice(0, 20);
|
|
4847
|
+
}
|
|
4848
|
+
localStorage.setItem("localTopic", JSON.stringify(recentTopics));
|
|
4849
|
+
} catch (error) {
|
|
4850
|
+
console.error("保存最近使用话题失败:", error);
|
|
4851
|
+
}
|
|
4852
|
+
},
|
|
4853
|
+
// 创建全局话题弹框
|
|
4854
|
+
createGlobalTopicPopover() {
|
|
4855
|
+
this.removeGlobalTopicPopover();
|
|
4856
|
+
const mask = document.createElement("div");
|
|
4857
|
+
mask.className = "topic-popover-mask";
|
|
4858
|
+
mask.addEventListener("click", () => {
|
|
4859
|
+
this.hideTopicPopover();
|
|
4860
|
+
});
|
|
4861
|
+
const container = document.createElement("div");
|
|
4862
|
+
container.className = "topic-popover";
|
|
4863
|
+
container.style.position = "fixed";
|
|
4864
|
+
container.style.top = this.topicPopover.position.top + "px";
|
|
4865
|
+
container.style.left = this.topicPopover.position.left + "px";
|
|
4866
|
+
container.style.zIndex = "9999";
|
|
4867
|
+
container.addEventListener("click", (e) => {
|
|
4868
|
+
e.stopPropagation();
|
|
4869
|
+
});
|
|
4870
|
+
container.innerHTML = this.createTopicPopoverContent();
|
|
4871
|
+
document.body.appendChild(mask);
|
|
4872
|
+
document.body.appendChild(container);
|
|
4873
|
+
this.topicPopover.globalMask = mask;
|
|
4874
|
+
this.topicPopover.globalContainer = container;
|
|
4875
|
+
this.bindTopicPopoverEvents();
|
|
4876
|
+
},
|
|
4877
|
+
// 移除全局话题弹框
|
|
4878
|
+
removeGlobalTopicPopover() {
|
|
4879
|
+
if (this.topicPopover.globalMask) {
|
|
4880
|
+
document.body.removeChild(this.topicPopover.globalMask);
|
|
4881
|
+
this.topicPopover.globalMask = null;
|
|
4882
|
+
}
|
|
4883
|
+
if (this.topicPopover.globalContainer) {
|
|
4884
|
+
document.body.removeChild(this.topicPopover.globalContainer);
|
|
4885
|
+
this.topicPopover.globalContainer = null;
|
|
4886
|
+
}
|
|
4887
|
+
},
|
|
4888
|
+
// 更新全局话题弹框内容
|
|
4889
|
+
updateGlobalTopicPopover() {
|
|
4890
|
+
if (!this.topicPopover.globalContainer)
|
|
4891
|
+
return;
|
|
4892
|
+
this.topicPopover.globalContainer.innerHTML = this.createTopicPopoverContent();
|
|
4893
|
+
this.bindTopicPopoverEvents();
|
|
4894
|
+
},
|
|
4895
|
+
// 增量添加热门话题到DOM,避免重绘
|
|
4896
|
+
appendHotTopicsToDOM() {
|
|
4897
|
+
if (!this.topicPopover.globalContainer || this.topicPopover.newHotTopicsCount === 0)
|
|
4898
|
+
return;
|
|
4899
|
+
const topicList = this.topicPopover.globalContainer.querySelector(".topic-list");
|
|
4900
|
+
if (!topicList)
|
|
4901
|
+
return;
|
|
4902
|
+
const startIndex = this.topicPopover.hotTopics.length - this.topicPopover.newHotTopicsCount;
|
|
4903
|
+
const endIndex = this.topicPopover.hotTopics.length;
|
|
4904
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
4905
|
+
const topic = this.topicPopover.hotTopics[i];
|
|
4906
|
+
const topicElement = document.createElement("div");
|
|
4907
|
+
topicElement.className = "topic-item";
|
|
4908
|
+
topicElement.setAttribute("data-topic-id", topic.id);
|
|
4909
|
+
topicElement.textContent = `#${topic.title}`;
|
|
4910
|
+
topicElement.addEventListener("click", () => {
|
|
4911
|
+
this.insertTopicToEditor(topic);
|
|
4912
|
+
});
|
|
4913
|
+
topicList.appendChild(topicElement);
|
|
4914
|
+
}
|
|
4915
|
+
this.updateLoadingState(topicList, this.topicPopover.loading, this.topicPopover.hasMore);
|
|
4916
|
+
this.topicPopover.newHotTopicsCount = 0;
|
|
4917
|
+
},
|
|
4918
|
+
// 增量添加搜索话题到DOM,避免重绘
|
|
4919
|
+
appendSearchTopicsToDOM() {
|
|
4920
|
+
if (!this.topicPopover.globalContainer || this.topicPopover.newSearchTopicsCount === 0)
|
|
4921
|
+
return;
|
|
4922
|
+
const topicList = this.topicPopover.globalContainer.querySelector(".topic-list");
|
|
4923
|
+
if (!topicList)
|
|
4924
|
+
return;
|
|
4925
|
+
const startIndex = this.topicPopover.searchTopics.length - this.topicPopover.newSearchTopicsCount;
|
|
4926
|
+
const endIndex = this.topicPopover.searchTopics.length;
|
|
4927
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
4928
|
+
const topic = this.topicPopover.searchTopics[i];
|
|
4929
|
+
const topicElement = document.createElement("div");
|
|
4930
|
+
topicElement.className = "topic-item";
|
|
4931
|
+
topicElement.setAttribute("data-topic-id", topic.id);
|
|
4932
|
+
topicElement.textContent = `#${topic.exactlyMatchTitle || topic.title}`;
|
|
4933
|
+
topicElement.addEventListener("click", () => {
|
|
4934
|
+
this.insertTopicToEditor(topic);
|
|
4935
|
+
});
|
|
4936
|
+
topicList.appendChild(topicElement);
|
|
4937
|
+
}
|
|
4938
|
+
this.updateLoadingState(topicList, this.topicPopover.loading, this.topicPopover.searchHasMore);
|
|
4939
|
+
this.topicPopover.newSearchTopicsCount = 0;
|
|
4940
|
+
},
|
|
4941
|
+
// 更新加载状态显示
|
|
4942
|
+
updateLoadingState(topicList, loading, hasMore) {
|
|
4943
|
+
const existingLoading = topicList.querySelector(".topic-loading");
|
|
4944
|
+
const existingEmpty = topicList.querySelector(".topic-empty");
|
|
4945
|
+
if (existingLoading)
|
|
4946
|
+
existingLoading.remove();
|
|
4947
|
+
if (existingEmpty)
|
|
4948
|
+
existingEmpty.remove();
|
|
4949
|
+
if (loading) {
|
|
4950
|
+
const loadingElement = document.createElement("div");
|
|
4951
|
+
loadingElement.className = "topic-loading";
|
|
4952
|
+
loadingElement.textContent = "加载更多...";
|
|
4953
|
+
topicList.appendChild(loadingElement);
|
|
4954
|
+
} else if (!hasMore) {
|
|
4955
|
+
const emptyElement = document.createElement("div");
|
|
4956
|
+
emptyElement.className = "topic-empty";
|
|
4957
|
+
emptyElement.textContent = "没有更多了";
|
|
4958
|
+
topicList.appendChild(emptyElement);
|
|
4959
|
+
}
|
|
4960
|
+
},
|
|
4961
|
+
// 创建话题弹框内容
|
|
4962
|
+
createTopicPopoverContent() {
|
|
4963
|
+
if (this.topicPopover.type === "hot") {
|
|
4964
|
+
return this.getHotTopicPopoverHTML();
|
|
4965
|
+
} else if (this.topicPopover.type === "search") {
|
|
4966
|
+
return this.getSearchTopicPopoverHTML();
|
|
4967
|
+
}
|
|
4968
|
+
return "";
|
|
4969
|
+
},
|
|
4970
|
+
// 获取热门话题弹框HTML
|
|
4971
|
+
getHotTopicPopoverHTML() {
|
|
4972
|
+
const activeTab = this.topicPopover.activeTab;
|
|
4973
|
+
const hotTopics = this.topicPopover.hotTopics;
|
|
4974
|
+
const recentTopics = this.topicPopover.recentTopics;
|
|
4975
|
+
const loading = this.topicPopover.loading;
|
|
4976
|
+
const hasMore = this.topicPopover.hasMore;
|
|
4977
|
+
let topicListHTML = "";
|
|
4978
|
+
if (activeTab === "hot") {
|
|
4979
|
+
if (loading && hotTopics.length === 0) {
|
|
4980
|
+
topicListHTML = '<div class="topic-loading">加载中...</div>';
|
|
4981
|
+
} else if (hotTopics.length === 0) {
|
|
4982
|
+
topicListHTML = '<div class="topic-empty">暂无热门话题</div>';
|
|
4983
|
+
} else {
|
|
4984
|
+
topicListHTML = hotTopics.map(
|
|
4985
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
4986
|
+
).join("");
|
|
4987
|
+
if (loading) {
|
|
4988
|
+
topicListHTML += '<div class="topic-loading">加载更多...</div>';
|
|
4989
|
+
} else if (!hasMore) {
|
|
4990
|
+
topicListHTML += '<div class="topic-empty">没有更多了</div>';
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
} else {
|
|
4994
|
+
if (recentTopics.length === 0) {
|
|
4995
|
+
topicListHTML = '<div class="topic-empty">暂无最近使用记录</div>';
|
|
4996
|
+
} else {
|
|
4997
|
+
topicListHTML = recentTopics.map(
|
|
4998
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
4999
|
+
).join("");
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
return `
|
|
5003
|
+
<div class="topic-popover-content">
|
|
5004
|
+
<div class="topic-tabs">
|
|
5005
|
+
<div class="topic-tab ${activeTab === "hot" ? "active" : ""}" data-tab="hot">
|
|
5006
|
+
热门话题
|
|
5007
|
+
</div>
|
|
5008
|
+
<div class="topic-tab ${activeTab === "recent" ? "active" : ""}" data-tab="recent">
|
|
5009
|
+
最近使用
|
|
5010
|
+
</div>
|
|
5011
|
+
</div>
|
|
5012
|
+
<div class="topic-list-container">
|
|
5013
|
+
<div class="topic-list">
|
|
5014
|
+
${topicListHTML}
|
|
5015
|
+
</div>
|
|
5016
|
+
</div>
|
|
5017
|
+
</div>
|
|
5018
|
+
`;
|
|
5019
|
+
},
|
|
5020
|
+
// 获取搜索话题弹框HTML
|
|
5021
|
+
getSearchTopicPopoverHTML() {
|
|
5022
|
+
const searchKeyword = this.topicPopover.searchKeyword;
|
|
5023
|
+
const searchTopics = this.topicPopover.searchTopics;
|
|
5024
|
+
const loading = this.topicPopover.loading;
|
|
5025
|
+
const searchHasMore = this.topicPopover.searchHasMore;
|
|
5026
|
+
let topicListHTML = "";
|
|
5027
|
+
if (loading && searchTopics.length === 0) {
|
|
5028
|
+
topicListHTML = '<div class="topic-loading">搜索中...</div>';
|
|
5029
|
+
} else if (searchTopics.length === 0) {
|
|
5030
|
+
topicListHTML = '<div class="topic-empty">没有匹配到话题,请重新输入</div>';
|
|
5031
|
+
} else {
|
|
5032
|
+
topicListHTML = searchTopics.map(
|
|
5033
|
+
(topic) => `<div class="topic-item" data-topic-id="${topic.id}">#${topic.exactlyMatchTitle}</div>`
|
|
5034
|
+
).join("");
|
|
5035
|
+
if (loading) {
|
|
5036
|
+
topicListHTML += '<div class="topic-loading">加载更多...</div>';
|
|
5037
|
+
} else if (!searchHasMore) {
|
|
5038
|
+
topicListHTML += '<div class="topic-empty">没有更多了</div>';
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
return `
|
|
5042
|
+
<div class="topic-popover-content">
|
|
5043
|
+
<div class="topic-search-header">
|
|
5044
|
+
<span class="topic-search-title">#${searchKeyword}</span>
|
|
5045
|
+
</div>
|
|
5046
|
+
<div class="topic-list-container">
|
|
5047
|
+
<div class="topic-list">
|
|
5048
|
+
${topicListHTML}
|
|
5049
|
+
</div>
|
|
5050
|
+
</div>
|
|
5051
|
+
</div>
|
|
5052
|
+
`;
|
|
5053
|
+
},
|
|
5054
|
+
// 绑定话题弹框事件
|
|
5055
|
+
bindTopicPopoverEvents() {
|
|
5056
|
+
if (!this.topicPopover.globalContainer)
|
|
5057
|
+
return;
|
|
5058
|
+
const tabs = this.topicPopover.globalContainer.querySelectorAll(".topic-tab");
|
|
5059
|
+
tabs.forEach((tab) => {
|
|
5060
|
+
tab.addEventListener("click", (e) => {
|
|
5061
|
+
const tabType = e.target.getAttribute("data-tab");
|
|
5062
|
+
this.switchTopicTab(tabType);
|
|
5063
|
+
});
|
|
5064
|
+
});
|
|
5065
|
+
const topicItems = this.topicPopover.globalContainer.querySelectorAll(".topic-item");
|
|
5066
|
+
topicItems.forEach((item) => {
|
|
5067
|
+
item.addEventListener("click", (e) => {
|
|
5068
|
+
const topicId = parseInt(e.target.getAttribute("data-topic-id"));
|
|
5069
|
+
const topic = this.findTopicById(topicId);
|
|
5070
|
+
if (topic) {
|
|
5071
|
+
this.selectTopic(topic);
|
|
5072
|
+
}
|
|
5073
|
+
});
|
|
5074
|
+
});
|
|
5075
|
+
const listContainer = this.topicPopover.globalContainer.querySelector(".topic-list-container");
|
|
5076
|
+
if (listContainer) {
|
|
5077
|
+
listContainer.addEventListener("scroll", (e) => {
|
|
5078
|
+
if (this.topicPopover.type === "hot") {
|
|
5079
|
+
this.handleHotTopicScroll(e);
|
|
5080
|
+
} else if (this.topicPopover.type === "search") {
|
|
5081
|
+
this.handleSearchTopicScroll(e);
|
|
5082
|
+
}
|
|
5083
|
+
});
|
|
5084
|
+
}
|
|
5085
|
+
},
|
|
5086
|
+
// 根据ID查找话题
|
|
5087
|
+
findTopicById(topicId) {
|
|
5088
|
+
let topic = this.topicPopover.hotTopics.find((t) => t.id === topicId);
|
|
5089
|
+
if (topic)
|
|
5090
|
+
return topic;
|
|
5091
|
+
topic = this.topicPopover.searchTopics.find((t) => t.id === topicId);
|
|
5092
|
+
if (topic)
|
|
5093
|
+
return topic;
|
|
5094
|
+
topic = this.topicPopover.recentTopics.find((t) => t.id === topicId);
|
|
5095
|
+
if (topic)
|
|
5096
|
+
return topic;
|
|
5097
|
+
return null;
|
|
5098
|
+
},
|
|
5099
|
+
handleHotTopicScroll(event) {
|
|
5100
|
+
if (this.topicPopover.activeTab !== "hot")
|
|
5101
|
+
return;
|
|
5102
|
+
const container = event.target;
|
|
5103
|
+
const scrollTop = container.scrollTop;
|
|
5104
|
+
const scrollHeight = container.scrollHeight;
|
|
5105
|
+
const clientHeight = container.clientHeight;
|
|
5106
|
+
if (scrollTop + clientHeight >= scrollHeight - 10) {
|
|
5107
|
+
this.loadHotTopics();
|
|
5108
|
+
}
|
|
5109
|
+
},
|
|
5110
|
+
handleSearchTopicScroll(event) {
|
|
5111
|
+
const container = event.target;
|
|
5112
|
+
const scrollTop = container.scrollTop;
|
|
5113
|
+
const scrollHeight = container.scrollHeight;
|
|
5114
|
+
const clientHeight = container.clientHeight;
|
|
5115
|
+
if (scrollTop + clientHeight >= scrollHeight - 10) {
|
|
5116
|
+
this.loadSearchTopics();
|
|
5117
|
+
}
|
|
5118
|
+
},
|
|
5119
|
+
insertTopicToEditor(topic) {
|
|
5120
|
+
const originalRange = this.topicPopover.originalRange;
|
|
5121
|
+
const triggerInfo = this.topicPopover.triggerInfo;
|
|
5122
|
+
const popoverType = this.topicPopover.type;
|
|
5123
|
+
this.hideTopicPopover();
|
|
5124
|
+
let range = originalRange;
|
|
5125
|
+
if (!range) {
|
|
5126
|
+
const selection2 = window.getSelection();
|
|
5127
|
+
if (selection2.rangeCount === 0)
|
|
5128
|
+
return;
|
|
5129
|
+
range = selection2.getRangeAt(0);
|
|
5130
|
+
}
|
|
5131
|
+
const topicText = `#${topic.exactlyMatchTitle}`;
|
|
5132
|
+
if (popoverType === "search" && triggerInfo && triggerInfo.paragraph) {
|
|
5133
|
+
const paragraph = triggerInfo.paragraph;
|
|
5134
|
+
const hashIndex = triggerInfo.hashIndex;
|
|
5135
|
+
const deleteRange = document.createRange();
|
|
5136
|
+
const walker = document.createTreeWalker(
|
|
5137
|
+
paragraph,
|
|
5138
|
+
NodeFilter.SHOW_TEXT,
|
|
5139
|
+
{
|
|
5140
|
+
acceptNode: function(node2) {
|
|
5141
|
+
let parent = node2.parentNode;
|
|
5142
|
+
while (parent && parent !== paragraph) {
|
|
5143
|
+
if (parent.tagName === "MDD-TOPIC") {
|
|
5144
|
+
return NodeFilter.FILTER_REJECT;
|
|
5145
|
+
}
|
|
5146
|
+
parent = parent.parentNode;
|
|
5147
|
+
}
|
|
5148
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
5149
|
+
}
|
|
5150
|
+
},
|
|
5151
|
+
false
|
|
5152
|
+
);
|
|
5153
|
+
let position = 0;
|
|
5154
|
+
let startNode = null;
|
|
5155
|
+
let startOffset = 0;
|
|
5156
|
+
let endNode = null;
|
|
5157
|
+
let endOffset = 0;
|
|
5158
|
+
let node;
|
|
5159
|
+
while (node = walker.nextNode()) {
|
|
5160
|
+
if (position + node.textContent.length > hashIndex) {
|
|
5161
|
+
startNode = node;
|
|
5162
|
+
startOffset = hashIndex - position;
|
|
5163
|
+
break;
|
|
5164
|
+
}
|
|
5165
|
+
position += node.textContent.length;
|
|
5166
|
+
}
|
|
5167
|
+
const currentCursorPosition = triggerInfo.cursorPosition;
|
|
5168
|
+
position = 0;
|
|
5169
|
+
walker.currentNode = paragraph;
|
|
5170
|
+
while (node = walker.nextNode()) {
|
|
5171
|
+
if (position + node.textContent.length >= currentCursorPosition) {
|
|
5172
|
+
endNode = node;
|
|
5173
|
+
endOffset = currentCursorPosition - position;
|
|
5174
|
+
break;
|
|
5175
|
+
}
|
|
5176
|
+
position += node.textContent.length;
|
|
5177
|
+
}
|
|
5178
|
+
if (startNode && endNode) {
|
|
5179
|
+
deleteRange.setStart(startNode, startOffset);
|
|
5180
|
+
deleteRange.setEnd(endNode, endOffset);
|
|
5181
|
+
deleteRange.deleteContents();
|
|
5182
|
+
range = document.createRange();
|
|
5183
|
+
range.setStart(startNode, startOffset);
|
|
5184
|
+
range.collapse(true);
|
|
5185
|
+
}
|
|
5186
|
+
} else if (popoverType === "hot") {
|
|
5187
|
+
const container = range.startContainer;
|
|
5188
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent) {
|
|
5189
|
+
const offset = range.startOffset;
|
|
5190
|
+
if (offset > 0 && container.textContent[offset - 1] === "#") {
|
|
5191
|
+
const deleteRange = document.createRange();
|
|
5192
|
+
deleteRange.setStart(container, offset - 1);
|
|
5193
|
+
deleteRange.setEnd(container, offset);
|
|
5194
|
+
deleteRange.deleteContents();
|
|
5195
|
+
range.setStart(container, offset - 1);
|
|
5196
|
+
range.collapse(true);
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
const topicElement = document.createElement("mdd-topic");
|
|
5201
|
+
topicElement.setAttribute("data-topic", JSON.stringify({
|
|
5202
|
+
topicId: topic.id,
|
|
5203
|
+
topicType: 0,
|
|
5204
|
+
startIndex: 0,
|
|
5205
|
+
// 会在updateTopicPosition中更新
|
|
5206
|
+
endIndex: 0
|
|
5207
|
+
// 会在updateTopicPosition中更新
|
|
5208
|
+
}));
|
|
5209
|
+
topicElement.textContent = topicText;
|
|
5210
|
+
topicElement.setAttribute("contenteditable", "false");
|
|
5211
|
+
range.deleteContents();
|
|
5212
|
+
range.insertNode(topicElement);
|
|
5213
|
+
const spaceNode = document.createTextNode(" ");
|
|
5214
|
+
range.setStartAfter(topicElement);
|
|
5215
|
+
range.insertNode(spaceNode);
|
|
5216
|
+
const newRange = document.createRange();
|
|
5217
|
+
newRange.setStartAfter(spaceNode);
|
|
5218
|
+
newRange.collapse(true);
|
|
5219
|
+
const selection = window.getSelection();
|
|
5220
|
+
selection.removeAllRanges();
|
|
5221
|
+
selection.addRange(newRange);
|
|
5222
|
+
setTimeout(() => {
|
|
5223
|
+
const currentSelection = window.getSelection();
|
|
5224
|
+
if (currentSelection.rangeCount > 0) {
|
|
5225
|
+
const currentRange = currentSelection.getRangeAt(0);
|
|
5226
|
+
if (currentRange.startContainer !== spaceNode.nextSibling) {
|
|
5227
|
+
const correctRange = document.createRange();
|
|
5228
|
+
correctRange.setStartAfter(spaceNode);
|
|
5229
|
+
correctRange.collapse(true);
|
|
5230
|
+
currentSelection.removeAllRanges();
|
|
5231
|
+
currentSelection.addRange(correctRange);
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5234
|
+
}, 0);
|
|
5235
|
+
this.$emit("update-topic-position");
|
|
5236
|
+
},
|
|
5237
|
+
// 销毁话题管理器
|
|
5238
|
+
destroy() {
|
|
5239
|
+
this.unbindEditorEvents();
|
|
5240
|
+
this.hideTopicPopover();
|
|
5241
|
+
}
|
|
5242
|
+
},
|
|
5243
|
+
mounted() {
|
|
5244
|
+
this.init();
|
|
5245
|
+
},
|
|
5246
|
+
beforeUnmount() {
|
|
5247
|
+
this.destroy();
|
|
5248
|
+
}
|
|
5249
|
+
};
|
|
5250
|
+
const _hoisted_1$3 = { class: "topic-manager" };
|
|
5251
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5252
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3);
|
|
5253
|
+
}
|
|
5254
|
+
const TopicManager = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
5255
|
+
const index_vue_vue_type_style_index_0_lang = "";
|
|
5256
|
+
const _sfc_main$2 = {
|
|
5257
|
+
provide() {
|
|
5258
|
+
return {
|
|
5259
|
+
vm: this
|
|
5260
|
+
};
|
|
5261
|
+
},
|
|
5262
|
+
components: {
|
|
5263
|
+
ElInput,
|
|
5264
|
+
BasicDialog: _sfc_main$7,
|
|
5265
|
+
draggable
|
|
5266
|
+
},
|
|
5267
|
+
props: {
|
|
5268
|
+
visible: {
|
|
5269
|
+
type: Boolean,
|
|
5270
|
+
default: false
|
|
5271
|
+
},
|
|
5272
|
+
linkContent: {
|
|
5273
|
+
type: String,
|
|
5274
|
+
default: ""
|
|
5275
|
+
},
|
|
5276
|
+
fileSelected: {
|
|
5277
|
+
type: Function,
|
|
5278
|
+
default: () => {
|
|
5279
|
+
}
|
|
5280
|
+
}
|
|
5281
|
+
},
|
|
5282
|
+
data() {
|
|
5283
|
+
return {};
|
|
5284
|
+
},
|
|
5285
|
+
computed: {
|
|
5286
|
+
input: {
|
|
5287
|
+
get() {
|
|
5288
|
+
return this.linkContent;
|
|
5289
|
+
},
|
|
5290
|
+
set(val) {
|
|
5291
|
+
this.$emit("update:linkContent", val);
|
|
5292
|
+
}
|
|
5293
|
+
}
|
|
5294
|
+
},
|
|
5295
|
+
mounted() {
|
|
5296
|
+
},
|
|
5297
|
+
methods: {
|
|
5298
|
+
emitEvent() {
|
|
5299
|
+
var event = new MouseEvent("click");
|
|
5300
|
+
var ele = document.getElementsByClassName("video-input");
|
|
5301
|
+
ele[0].dispatchEvent(event);
|
|
5302
|
+
},
|
|
5303
|
+
setStatus(val) {
|
|
5304
|
+
this.$emit("update:visible", val);
|
|
5305
|
+
}
|
|
5306
|
+
// submit() {
|
|
5307
|
+
// this.$emit('submit')
|
|
5308
|
+
// }
|
|
5309
|
+
}
|
|
5310
|
+
};
|
|
5311
|
+
const _hoisted_1$2 = { class: "collect-article_content" };
|
|
5312
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5313
|
+
const _component_el_input = resolveComponent("el-input");
|
|
5314
|
+
const _component_BasicDialog = resolveComponent("BasicDialog");
|
|
5315
|
+
return openBlock(), createBlock(_component_BasicDialog, {
|
|
5316
|
+
visible: $props.visible,
|
|
5317
|
+
width: "600px",
|
|
5318
|
+
height: "50px"
|
|
5319
|
+
}, {
|
|
5320
|
+
title: withCtx(() => _cache[1] || (_cache[1] = [
|
|
5321
|
+
createElementVNode("div", null, [
|
|
5322
|
+
createElementVNode("span", null, "采集文章"),
|
|
5323
|
+
createElementVNode("span", { class: "collect-article_lable" }, "如需获得正式使用权,请自行联系版权所有者")
|
|
5324
|
+
], -1)
|
|
5325
|
+
])),
|
|
5326
|
+
default: withCtx(() => [
|
|
5327
|
+
createElementVNode("div", _hoisted_1$2, [
|
|
5328
|
+
_cache[2] || (_cache[2] = createElementVNode("div", { class: "tip" }, "请把需要采集的文章链接粘贴在下方的输入框:", -1)),
|
|
5329
|
+
createVNode(_component_el_input, {
|
|
5330
|
+
modelValue: $options.input,
|
|
5331
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.input = $event),
|
|
5332
|
+
placeholder: "仅支持微信链接"
|
|
5333
|
+
}, null, 8, ["modelValue"])
|
|
5334
|
+
])
|
|
5335
|
+
]),
|
|
5336
|
+
_: 1
|
|
5337
|
+
}, 8, ["visible"]);
|
|
5338
|
+
}
|
|
5339
|
+
const CollectArticle = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
5340
|
+
const index_vue_vue_type_style_index_0_scoped_4ebe06df_lang = "";
|
|
5341
|
+
const _sfc_main$1 = {
|
|
5342
|
+
components: {
|
|
5343
|
+
ElIconError: CircleCloseFilled
|
|
5344
|
+
},
|
|
5345
|
+
props: {
|
|
5346
|
+
article: {
|
|
5347
|
+
type: Object,
|
|
5348
|
+
default: () => ({})
|
|
5349
|
+
}
|
|
5350
|
+
},
|
|
5351
|
+
methods: {
|
|
5352
|
+
close(e) {
|
|
5353
|
+
let child = e.target;
|
|
5354
|
+
while (child) {
|
|
5355
|
+
if (child.dataset.article) {
|
|
5356
|
+
child.parentNode.removeChild(child);
|
|
5357
|
+
break;
|
|
5358
|
+
}
|
|
5359
|
+
child = child.parentNode;
|
|
5360
|
+
}
|
|
5361
|
+
this.$emit("delete");
|
|
4506
5362
|
}
|
|
4507
5363
|
}
|
|
4508
5364
|
};
|
|
@@ -4526,8 +5382,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4526
5382
|
createElementVNode("div", _hoisted_4, toDisplayString($props.article.title), 1),
|
|
4527
5383
|
createElementVNode("div", _hoisted_5, [
|
|
4528
5384
|
createElementVNode("span", null, toDisplayString($props.article.author), 1),
|
|
4529
|
-
createElementVNode("span", null, toDisplayString($props.article.viewNum) + "
|
|
4530
|
-
createElementVNode("span", null, toDisplayString($props.article.replycnt) + "
|
|
5385
|
+
createElementVNode("span", null, toDisplayString($props.article.viewNum) + "浏览", 1),
|
|
5386
|
+
createElementVNode("span", null, toDisplayString($props.article.replycnt) + "评论", 1)
|
|
4531
5387
|
])
|
|
4532
5388
|
]),
|
|
4533
5389
|
createVNode(_component_el_icon_error, {
|
|
@@ -4539,10 +5395,10 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4539
5395
|
class: normalizeClass([{
|
|
4540
5396
|
"article-bg-height": $props.article.img || $props.article.mediaInfo && $props.article.mediaInfo.length
|
|
4541
5397
|
}, "article-bg"])
|
|
4542
|
-
}, "
|
|
5398
|
+
}, " 平台仅支持展示18个月的推荐内容 ", 2)) : createCommentVNode("", true)
|
|
4543
5399
|
]);
|
|
4544
5400
|
}
|
|
4545
|
-
const Item = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
|
5401
|
+
const Item = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-4ebe06df"]]);
|
|
4546
5402
|
const mountArticleDom = (props, del) => {
|
|
4547
5403
|
const className = "article-wrap";
|
|
4548
5404
|
const article = props.article;
|
|
@@ -4576,14 +5432,15 @@ const _sfc_main = {
|
|
|
4576
5432
|
name: "Edit",
|
|
4577
5433
|
components: {
|
|
4578
5434
|
ElInput,
|
|
4579
|
-
InsertArticle: _sfc_main$
|
|
4580
|
-
ImgUpload: _sfc_main$
|
|
4581
|
-
VideoUpload: _sfc_main$
|
|
5435
|
+
InsertArticle: _sfc_main$6,
|
|
5436
|
+
ImgUpload: _sfc_main$5,
|
|
5437
|
+
VideoUpload: _sfc_main$4,
|
|
4582
5438
|
CollectArticle,
|
|
4583
5439
|
ElFormItem,
|
|
4584
5440
|
ElForm,
|
|
4585
5441
|
ElDialog,
|
|
4586
|
-
ElButton
|
|
5442
|
+
ElButton,
|
|
5443
|
+
TopicManager
|
|
4587
5444
|
},
|
|
4588
5445
|
props: [
|
|
4589
5446
|
"disabled",
|
|
@@ -4593,13 +5450,15 @@ const _sfc_main = {
|
|
|
4593
5450
|
"importEssay",
|
|
4594
5451
|
"uploadImageByOther",
|
|
4595
5452
|
"chartGallery",
|
|
4596
|
-
"request"
|
|
5453
|
+
"request",
|
|
5454
|
+
"placeholder"
|
|
4597
5455
|
],
|
|
4598
5456
|
data() {
|
|
4599
5457
|
return {
|
|
4600
5458
|
hasArticleCard: false,
|
|
4601
5459
|
cursorStyle: "auto",
|
|
4602
5460
|
titleCount: 0,
|
|
5461
|
+
// 标题数量
|
|
4603
5462
|
viewLinkDialog: false,
|
|
4604
5463
|
linkForm: {
|
|
4605
5464
|
linkAddress: "",
|
|
@@ -4607,39 +5466,54 @@ const _sfc_main = {
|
|
|
4607
5466
|
},
|
|
4608
5467
|
setAlignFlag: true,
|
|
4609
5468
|
article: {},
|
|
5469
|
+
// 插入的文章
|
|
4610
5470
|
imgList: [],
|
|
4611
5471
|
imgNum: 20,
|
|
4612
5472
|
videoList: [],
|
|
4613
5473
|
visibleVideo: false,
|
|
4614
5474
|
visibleCollectArticle: false,
|
|
4615
5475
|
visibleArticle: false,
|
|
5476
|
+
// 插入文章
|
|
4616
5477
|
visibleImg: false,
|
|
5478
|
+
// 插入图片
|
|
4617
5479
|
imgType: "normal",
|
|
5480
|
+
//
|
|
4618
5481
|
typeEnum: {
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
5482
|
+
文字: "1",
|
|
5483
|
+
图片: "2",
|
|
5484
|
+
图文: "3",
|
|
5485
|
+
段落标题: "4",
|
|
5486
|
+
关联: "5",
|
|
5487
|
+
// 关联车辆、轨迹、活动、商家、话题
|
|
5488
|
+
单视频: "6",
|
|
5489
|
+
视频文字: "7",
|
|
4626
5490
|
URL: "8",
|
|
4627
|
-
|
|
5491
|
+
文章卡片: "11"
|
|
4628
5492
|
},
|
|
4629
5493
|
fontInfo: {
|
|
4630
5494
|
size: ""
|
|
4631
5495
|
},
|
|
4632
5496
|
user: {},
|
|
5497
|
+
// 用户
|
|
4633
5498
|
editor: {},
|
|
5499
|
+
// 编辑器实例对象
|
|
4634
5500
|
editorDom: {},
|
|
5501
|
+
// 编辑器Dom
|
|
4635
5502
|
uploadStore: {},
|
|
5503
|
+
// 待上传的图片池
|
|
4636
5504
|
linkContent: "",
|
|
5505
|
+
// 插入链接的地址
|
|
4637
5506
|
loadingText: "",
|
|
5507
|
+
// loaing的提示文字
|
|
4638
5508
|
progressPercent: "",
|
|
5509
|
+
// 上传进度
|
|
4639
5510
|
currentIndex: 0,
|
|
4640
5511
|
loading: false,
|
|
5512
|
+
// 是否提交中
|
|
4641
5513
|
viewStatus: false,
|
|
5514
|
+
// todo: 改名
|
|
4642
5515
|
linkStatus: false,
|
|
5516
|
+
// todo: 改名
|
|
4643
5517
|
styleStatus: {
|
|
4644
5518
|
bold: false,
|
|
4645
5519
|
italic: false,
|
|
@@ -4663,6 +5537,7 @@ const _sfc_main = {
|
|
|
4663
5537
|
targetMove: "",
|
|
4664
5538
|
moverClasses: ["halo-img-content", "halo-video-content"],
|
|
4665
5539
|
selectDom: null
|
|
5540
|
+
//选中的dom
|
|
4666
5541
|
};
|
|
4667
5542
|
},
|
|
4668
5543
|
computed: {
|
|
@@ -4679,12 +5554,12 @@ const _sfc_main = {
|
|
|
4679
5554
|
watch: {
|
|
4680
5555
|
progressPercent(val) {
|
|
4681
5556
|
const inner = document.querySelector(".video-progress .inner");
|
|
4682
|
-
console.log(val, "
|
|
5557
|
+
console.log(val, "视频上传进度");
|
|
4683
5558
|
if (inner) {
|
|
4684
5559
|
inner.style.width = val + "%";
|
|
4685
5560
|
if (val === 100) {
|
|
4686
5561
|
document.querySelector(".video-progress").innerHTML = `
|
|
4687
|
-
<div class="no-calc" style="text-align:center;color:#999999;font-size:18px;"
|
|
5562
|
+
<div class="no-calc" style="text-align:center;color:#999999;font-size:18px;">正在获取视频封面</div>
|
|
4688
5563
|
`;
|
|
4689
5564
|
}
|
|
4690
5565
|
}
|
|
@@ -4713,7 +5588,7 @@ const _sfc_main = {
|
|
|
4713
5588
|
me2.editorDom = document.getElementById("editor-content");
|
|
4714
5589
|
me2.editorDom.addEventListener("blur", this.canSetAlign);
|
|
4715
5590
|
if (!window.Squire) {
|
|
4716
|
-
import("./squire-raw.
|
|
5591
|
+
import("./squire-raw-1aaeff0b.js").then(function() {
|
|
4717
5592
|
me2.initSquire();
|
|
4718
5593
|
});
|
|
4719
5594
|
} else {
|
|
@@ -4736,7 +5611,6 @@ const _sfc_main = {
|
|
|
4736
5611
|
},
|
|
4737
5612
|
setCursor() {
|
|
4738
5613
|
this.cursorStyle = this.cursorStyle === cursorImg ? "auto" : cursorImg;
|
|
4739
|
-
console.log(this.styleStatus, 999);
|
|
4740
5614
|
this.curStyle = { ...this.styleStatus };
|
|
4741
5615
|
this.editorDom.addEventListener("mouseup", this.handleCopyFormatUp);
|
|
4742
5616
|
},
|
|
@@ -4774,10 +5648,10 @@ const _sfc_main = {
|
|
|
4774
5648
|
this.visibleVideo = false;
|
|
4775
5649
|
const fileName = (files[0] && files[0].name || "").toLowerCase();
|
|
4776
5650
|
if (files[0].size > 1 * 1024 * 1024 * 1024) {
|
|
4777
|
-
return me2.setToast("
|
|
5651
|
+
return me2.setToast("视频大小不能超过1GB");
|
|
4778
5652
|
}
|
|
4779
5653
|
if (fileName.indexOf(".mp4") === -1 && fileName.indexOf(".mov") === -1) {
|
|
4780
|
-
return me2.setToast("
|
|
5654
|
+
return me2.setToast("视频格式不是mp4或mov");
|
|
4781
5655
|
}
|
|
4782
5656
|
const me2 = this;
|
|
4783
5657
|
if (me2.loading)
|
|
@@ -4797,7 +5671,9 @@ const _sfc_main = {
|
|
|
4797
5671
|
id: result.videoId,
|
|
4798
5672
|
desc: "",
|
|
4799
5673
|
vodSize: result.vodSize || "",
|
|
5674
|
+
// 视频大小
|
|
4800
5675
|
vodType: result.vodType || ""
|
|
5676
|
+
// 图片尺寸
|
|
4801
5677
|
};
|
|
4802
5678
|
me2.$emit("updateAddVideo", true);
|
|
4803
5679
|
me2.editor["insertVideo"](result.videoUrl, video);
|
|
@@ -4851,11 +5727,11 @@ const _sfc_main = {
|
|
|
4851
5727
|
},
|
|
4852
5728
|
insertLink() {
|
|
4853
5729
|
if (!this.linkForm.linkAddress)
|
|
4854
|
-
return ElMessage.error("
|
|
5730
|
+
return ElMessage.error("请输入链接地址");
|
|
4855
5731
|
if (!this.linkForm.linkWriting)
|
|
4856
|
-
return ElMessage.error("
|
|
5732
|
+
return ElMessage.error("请输入链接文案");
|
|
4857
5733
|
if (!this.validUrl(this.linkForm.linkAddress)) {
|
|
4858
|
-
return this.setToast("URL
|
|
5734
|
+
return this.setToast("URL无效");
|
|
4859
5735
|
}
|
|
4860
5736
|
this.editor.insertLink(
|
|
4861
5737
|
this.linkForm.linkAddress,
|
|
@@ -4884,6 +5760,10 @@ const _sfc_main = {
|
|
|
4884
5760
|
});
|
|
4885
5761
|
});
|
|
4886
5762
|
},
|
|
5763
|
+
// TopicManager事件处理
|
|
5764
|
+
onTopicInserted(topic) {
|
|
5765
|
+
this.updateData(true);
|
|
5766
|
+
},
|
|
4887
5767
|
getHtml(type) {
|
|
4888
5768
|
this.updateTopicPosition();
|
|
4889
5769
|
const html = this.editor.getHTML();
|
|
@@ -4985,6 +5865,8 @@ const _sfc_main = {
|
|
|
4985
5865
|
const frag = document.createDocumentFragment();
|
|
4986
5866
|
frag.appendChild(this.editor.empty(div));
|
|
4987
5867
|
const nodes = [...frag.childNodes];
|
|
5868
|
+
const mddTopics = frag.querySelectorAll("mdd-topic");
|
|
5869
|
+
mddTopics.forEach((topic) => topic.setAttribute("contenteditable", "false"));
|
|
4988
5870
|
for (let i = 0; i < nodes.length; i++) {
|
|
4989
5871
|
const node = nodes[i];
|
|
4990
5872
|
if (node.nodeType === 1) {
|
|
@@ -5078,6 +5960,8 @@ const _sfc_main = {
|
|
|
5078
5960
|
},
|
|
5079
5961
|
async parseArticle(node) {
|
|
5080
5962
|
const data = JSON.parse(node.dataset.article);
|
|
5963
|
+
if (!this.getEassyDetail)
|
|
5964
|
+
return;
|
|
5081
5965
|
await this.getEassyDetail(data.id, (info) => {
|
|
5082
5966
|
const el = mountArticleDom(
|
|
5083
5967
|
{
|
|
@@ -5334,7 +6218,7 @@ const _sfc_main = {
|
|
|
5334
6218
|
}
|
|
5335
6219
|
this.updateData(true);
|
|
5336
6220
|
} else {
|
|
5337
|
-
this.setToast(rst.origin.name + "
|
|
6221
|
+
this.setToast(rst.origin.name + "上传失败,请重试");
|
|
5338
6222
|
}
|
|
5339
6223
|
},
|
|
5340
6224
|
insertVideoBtns(editor, node) {
|
|
@@ -5349,7 +6233,7 @@ const _sfc_main = {
|
|
|
5349
6233
|
me2.currentVideo = node;
|
|
5350
6234
|
e.stopPropagation();
|
|
5351
6235
|
};
|
|
5352
|
-
replaceBtn.innerText = "
|
|
6236
|
+
replaceBtn.innerText = "更换封面";
|
|
5353
6237
|
return replaceBtn;
|
|
5354
6238
|
},
|
|
5355
6239
|
insertImgOperateBtns(editor, data) {
|
|
@@ -5370,13 +6254,12 @@ const _sfc_main = {
|
|
|
5370
6254
|
}
|
|
5371
6255
|
});
|
|
5372
6256
|
var descInputWrap;
|
|
5373
|
-
console.log(data.seamlessFlag, "count<<<<<<");
|
|
5374
6257
|
var descInput = editor.createElement("textarea", {
|
|
5375
6258
|
class: "desc-input",
|
|
5376
6259
|
maxlength: "50",
|
|
5377
6260
|
rows: "2",
|
|
5378
6261
|
cols: "50",
|
|
5379
|
-
placeholder: "
|
|
6262
|
+
placeholder: "请输入图片描述(最多50字)",
|
|
5380
6263
|
contenteditable: "false"
|
|
5381
6264
|
});
|
|
5382
6265
|
descInput.disabled = me2.disabled;
|
|
@@ -5385,7 +6268,7 @@ const _sfc_main = {
|
|
|
5385
6268
|
const img = parent.querySelector(".halo-picture-area");
|
|
5386
6269
|
img.dataset.desc = e.target.value;
|
|
5387
6270
|
if (e.target.value.length > 49) {
|
|
5388
|
-
return me2.setToast("
|
|
6271
|
+
return me2.setToast("限制50个字符");
|
|
5389
6272
|
}
|
|
5390
6273
|
};
|
|
5391
6274
|
descInput.value = data.content || "";
|
|
@@ -5435,7 +6318,7 @@ const _sfc_main = {
|
|
|
5435
6318
|
me2.removeParentByClass(e.target, "halo-img-content");
|
|
5436
6319
|
me2.updateData(true);
|
|
5437
6320
|
};
|
|
5438
|
-
replaceBtn.innerHTML = "
|
|
6321
|
+
replaceBtn.innerHTML = "替换";
|
|
5439
6322
|
return [replaceBtn, delBtn, descInputWrap];
|
|
5440
6323
|
},
|
|
5441
6324
|
removeSeamlessLaster(e) {
|
|
@@ -5459,6 +6342,7 @@ const _sfc_main = {
|
|
|
5459
6342
|
}
|
|
5460
6343
|
}
|
|
5461
6344
|
},
|
|
6345
|
+
// 初始化编辑器数据,数据是 html 格式(displayData)
|
|
5462
6346
|
initData(data = "", essayPicRelVOList) {
|
|
5463
6347
|
this.parseHtml(data, essayPicRelVOList).then((res) => {
|
|
5464
6348
|
this.editorDom.innerHTML = "";
|
|
@@ -5466,6 +6350,13 @@ const _sfc_main = {
|
|
|
5466
6350
|
this.updateData();
|
|
5467
6351
|
});
|
|
5468
6352
|
},
|
|
6353
|
+
// TODO jsonToHtml、htmlToJson 实现这 2 个方法里面的逻辑,数据结构参考方法里面的注释,出参入参都为字符串,注意:mdd-topic 里面的属性数据 和 json 中的topicPosition数据是一一对应的,startIndex、endIndex为mdd-topic的起止位置 从 content 里面进行分割处理
|
|
6354
|
+
// json、html 数据格式互转,暂时只支持文字、短话题
|
|
6355
|
+
jsonToHtml(json) {
|
|
6356
|
+
},
|
|
6357
|
+
htmlToJson(html) {
|
|
6358
|
+
},
|
|
6359
|
+
// 设置富文本组件
|
|
5469
6360
|
initSquire() {
|
|
5470
6361
|
const me2 = this;
|
|
5471
6362
|
const editorDom = me2.editorDom;
|
|
@@ -5553,7 +6444,8 @@ const _sfc_main = {
|
|
|
5553
6444
|
event.preventDefault();
|
|
5554
6445
|
});
|
|
5555
6446
|
me2.editor.addEventListener("keydown", function(event) {
|
|
5556
|
-
|
|
6447
|
+
var _a, _b, _c;
|
|
6448
|
+
if (["Backspace", "Delete"].includes(event.key)) {
|
|
5557
6449
|
try {
|
|
5558
6450
|
const selection2 = getSelection();
|
|
5559
6451
|
if (me2.selectDom && me2.moverClasses.includes(me2.selectDom.className)) {
|
|
@@ -5587,32 +6479,10 @@ const _sfc_main = {
|
|
|
5587
6479
|
} catch (error) {
|
|
5588
6480
|
console.log(error);
|
|
5589
6481
|
}
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
const startContainer = range.startContainer;
|
|
5595
|
-
let isInMddTopic = false;
|
|
5596
|
-
if (startContainer.nodeType === Node.ELEMENT_NODE && startContainer.tagName === "MDD-TOPIC") {
|
|
5597
|
-
isInMddTopic = true;
|
|
5598
|
-
} else if (startContainer.nodeType === Node.TEXT_NODE) {
|
|
5599
|
-
const parent = startContainer.parentNode;
|
|
5600
|
-
if (parent.tagName === "MDD-TOPIC") {
|
|
5601
|
-
isInMddTopic = true;
|
|
5602
|
-
}
|
|
5603
|
-
}
|
|
5604
|
-
if (isInMddTopic) {
|
|
5605
|
-
if (event.key === "Enter") {
|
|
5606
|
-
event.preventDefault();
|
|
5607
|
-
return;
|
|
5608
|
-
}
|
|
5609
|
-
const isPrintableKey = event.key.length === 1;
|
|
5610
|
-
if (isPrintableKey) {
|
|
5611
|
-
event.preventDefault();
|
|
5612
|
-
return;
|
|
5613
|
-
}
|
|
5614
|
-
}
|
|
5615
|
-
if ((event.key === "Backspace" || event.key === "Delete") && isInMddTopic) {
|
|
6482
|
+
const selection = window.getSelection();
|
|
6483
|
+
if (selection.rangeCount > 0) {
|
|
6484
|
+
const range = selection.getRangeAt(0);
|
|
6485
|
+
const startContainer = range.startContainer;
|
|
5616
6486
|
if (startContainer.nodeType === Node.ELEMENT_NODE && startContainer.tagName === "MDD-TOPIC") {
|
|
5617
6487
|
startContainer.remove();
|
|
5618
6488
|
event.preventDefault();
|
|
@@ -5625,6 +6495,228 @@ const _sfc_main = {
|
|
|
5625
6495
|
return;
|
|
5626
6496
|
}
|
|
5627
6497
|
}
|
|
6498
|
+
let currentParagraph = startContainer;
|
|
6499
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6500
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6501
|
+
}
|
|
6502
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
6503
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6504
|
+
}
|
|
6505
|
+
if (currentParagraph && event.key === "Backspace") {
|
|
6506
|
+
const container = range.startContainer;
|
|
6507
|
+
const offset = range.startOffset;
|
|
6508
|
+
let isAtParagraphStart = false;
|
|
6509
|
+
let cursorBeforeContent = null;
|
|
6510
|
+
if (container === currentParagraph && offset === 0) {
|
|
6511
|
+
isAtParagraphStart = true;
|
|
6512
|
+
cursorBeforeContent = currentParagraph.firstChild;
|
|
6513
|
+
} else if (container.nodeType === Node.TEXT_NODE && offset === 0) {
|
|
6514
|
+
let isFirstContent = true;
|
|
6515
|
+
let currentNode = currentParagraph.firstChild;
|
|
6516
|
+
while (currentNode && currentNode !== container) {
|
|
6517
|
+
if (currentNode.nodeType === Node.TEXT_NODE && currentNode.textContent.trim() !== "") {
|
|
6518
|
+
isFirstContent = false;
|
|
6519
|
+
break;
|
|
6520
|
+
} else if (currentNode.nodeType === Node.ELEMENT_NODE) {
|
|
6521
|
+
isFirstContent = false;
|
|
6522
|
+
break;
|
|
6523
|
+
}
|
|
6524
|
+
currentNode = currentNode.nextSibling;
|
|
6525
|
+
}
|
|
6526
|
+
if (isFirstContent) {
|
|
6527
|
+
isAtParagraphStart = true;
|
|
6528
|
+
cursorBeforeContent = container;
|
|
6529
|
+
}
|
|
6530
|
+
} else if (container === currentParagraph && offset > 0) {
|
|
6531
|
+
let hasContentBefore = false;
|
|
6532
|
+
for (let i = 0; i < offset; i++) {
|
|
6533
|
+
const node = currentParagraph.childNodes[i];
|
|
6534
|
+
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== "") {
|
|
6535
|
+
hasContentBefore = true;
|
|
6536
|
+
break;
|
|
6537
|
+
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
6538
|
+
hasContentBefore = true;
|
|
6539
|
+
break;
|
|
6540
|
+
}
|
|
6541
|
+
}
|
|
6542
|
+
if (!hasContentBefore && offset < currentParagraph.childNodes.length) {
|
|
6543
|
+
isAtParagraphStart = true;
|
|
6544
|
+
cursorBeforeContent = currentParagraph.childNodes[offset];
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
if (isAtParagraphStart) {
|
|
6548
|
+
const prevParagraph = currentParagraph.previousElementSibling;
|
|
6549
|
+
if (prevParagraph && prevParagraph.classList.contains("halo-paragraph")) {
|
|
6550
|
+
const prevContent = prevParagraph.innerHTML.trim();
|
|
6551
|
+
if (prevContent === "<br>" || prevContent === "") {
|
|
6552
|
+
prevParagraph.remove();
|
|
6553
|
+
event.preventDefault();
|
|
6554
|
+
me2.updateData(true);
|
|
6555
|
+
return;
|
|
6556
|
+
} else {
|
|
6557
|
+
const mergePoint = prevParagraph.childNodes.length;
|
|
6558
|
+
if (prevParagraph.lastChild && prevParagraph.lastChild.tagName === "BR") {
|
|
6559
|
+
prevParagraph.removeChild(prevParagraph.lastChild);
|
|
6560
|
+
}
|
|
6561
|
+
const nodesToMove = Array.from(currentParagraph.childNodes);
|
|
6562
|
+
nodesToMove.forEach((node) => {
|
|
6563
|
+
prevParagraph.appendChild(node);
|
|
6564
|
+
});
|
|
6565
|
+
currentParagraph.remove();
|
|
6566
|
+
const newRange = document.createRange();
|
|
6567
|
+
if (cursorBeforeContent && prevParagraph.contains(cursorBeforeContent)) {
|
|
6568
|
+
newRange.setStartBefore(cursorBeforeContent);
|
|
6569
|
+
} else {
|
|
6570
|
+
if (mergePoint < prevParagraph.childNodes.length) {
|
|
6571
|
+
newRange.setStartBefore(prevParagraph.childNodes[mergePoint]);
|
|
6572
|
+
} else {
|
|
6573
|
+
newRange.setStart(prevParagraph, prevParagraph.childNodes.length);
|
|
6574
|
+
}
|
|
6575
|
+
}
|
|
6576
|
+
newRange.collapse(true);
|
|
6577
|
+
const selection2 = window.getSelection();
|
|
6578
|
+
selection2.removeAllRanges();
|
|
6579
|
+
selection2.addRange(newRange);
|
|
6580
|
+
event.preventDefault();
|
|
6581
|
+
me2.updateData(true);
|
|
6582
|
+
return;
|
|
6583
|
+
}
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6589
|
+
if (event.key === "Enter") {
|
|
6590
|
+
const selection = window.getSelection();
|
|
6591
|
+
if (selection.rangeCount > 0) {
|
|
6592
|
+
const range = selection.getRangeAt(0);
|
|
6593
|
+
const startContainer = range.startContainer;
|
|
6594
|
+
let currentParagraph = startContainer;
|
|
6595
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6596
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6597
|
+
}
|
|
6598
|
+
while (currentParagraph && !((_b = currentParagraph.classList) == null ? void 0 : _b.contains("halo-paragraph"))) {
|
|
6599
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6600
|
+
}
|
|
6601
|
+
if (!(currentParagraph == null ? void 0 : currentParagraph.querySelector("mdd-topic"))) {
|
|
6602
|
+
return;
|
|
6603
|
+
}
|
|
6604
|
+
if (me2.isBetweenTwoTopics(range)) {
|
|
6605
|
+
event.preventDefault();
|
|
6606
|
+
me2.handleEnterBetweenTopics(range);
|
|
6607
|
+
return;
|
|
6608
|
+
}
|
|
6609
|
+
if (me2.wouldCreateNestedParagraph(range)) {
|
|
6610
|
+
event.preventDefault();
|
|
6611
|
+
me2.handleEnterKeyInParagraphWithTopic(range);
|
|
6612
|
+
return;
|
|
6613
|
+
}
|
|
6614
|
+
if (currentParagraph && currentParagraph.querySelector("mdd-topic")) {
|
|
6615
|
+
event.preventDefault();
|
|
6616
|
+
me2.handleEnterKeyInParagraphWithTopic(range);
|
|
6617
|
+
return;
|
|
6618
|
+
}
|
|
6619
|
+
}
|
|
6620
|
+
}
|
|
6621
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "ArrowLeft") {
|
|
6622
|
+
const selection = window.getSelection();
|
|
6623
|
+
if (selection.rangeCount > 0) {
|
|
6624
|
+
const range = selection.getRangeAt(0);
|
|
6625
|
+
const container = range.startContainer;
|
|
6626
|
+
let currentParagraph = container;
|
|
6627
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
6628
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6629
|
+
}
|
|
6630
|
+
while (currentParagraph && !((_c = currentParagraph.classList) == null ? void 0 : _c.contains("halo-paragraph"))) {
|
|
6631
|
+
currentParagraph = currentParagraph.parentNode;
|
|
6632
|
+
}
|
|
6633
|
+
if (currentParagraph) {
|
|
6634
|
+
const firstTopic = currentParagraph.querySelector("mdd-topic");
|
|
6635
|
+
if (firstTopic) {
|
|
6636
|
+
let hasTextBeforeTopic = false;
|
|
6637
|
+
let currentNode = currentParagraph.firstChild;
|
|
6638
|
+
while (currentNode && currentNode !== firstTopic) {
|
|
6639
|
+
if (currentNode.nodeType === Node.TEXT_NODE && currentNode.textContent.trim() !== "") {
|
|
6640
|
+
hasTextBeforeTopic = true;
|
|
6641
|
+
break;
|
|
6642
|
+
}
|
|
6643
|
+
currentNode = currentNode.nextSibling;
|
|
6644
|
+
}
|
|
6645
|
+
if (hasTextBeforeTopic) {
|
|
6646
|
+
if (container === currentParagraph && range.startOffset === 0) {
|
|
6647
|
+
return;
|
|
6648
|
+
}
|
|
6649
|
+
let shouldMoveToStart = false;
|
|
6650
|
+
const offset2 = range.startOffset;
|
|
6651
|
+
if (container.nodeType === Node.TEXT_NODE && container.parentNode === firstTopic) {
|
|
6652
|
+
shouldMoveToStart = true;
|
|
6653
|
+
} else if (container === firstTopic) {
|
|
6654
|
+
shouldMoveToStart = true;
|
|
6655
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
6656
|
+
let prevSibling = container.previousSibling;
|
|
6657
|
+
while (prevSibling) {
|
|
6658
|
+
if (prevSibling === firstTopic) {
|
|
6659
|
+
shouldMoveToStart = true;
|
|
6660
|
+
break;
|
|
6661
|
+
}
|
|
6662
|
+
prevSibling = prevSibling.previousSibling;
|
|
6663
|
+
}
|
|
6664
|
+
} else if (container === currentParagraph) {
|
|
6665
|
+
const topicRange = document.createRange();
|
|
6666
|
+
topicRange.selectNode(firstTopic);
|
|
6667
|
+
const cursorRange = document.createRange();
|
|
6668
|
+
cursorRange.setStart(container, offset2);
|
|
6669
|
+
cursorRange.collapse(true);
|
|
6670
|
+
if (cursorRange.compareBoundaryPoints(Range.START_TO_END, topicRange) > 0) {
|
|
6671
|
+
shouldMoveToStart = true;
|
|
6672
|
+
}
|
|
6673
|
+
}
|
|
6674
|
+
if (shouldMoveToStart) {
|
|
6675
|
+
event.preventDefault();
|
|
6676
|
+
event.stopPropagation();
|
|
6677
|
+
const newRange = document.createRange();
|
|
6678
|
+
newRange.setStart(currentParagraph, 0);
|
|
6679
|
+
newRange.collapse(true);
|
|
6680
|
+
const selection2 = window.getSelection();
|
|
6681
|
+
selection2.removeAllRanges();
|
|
6682
|
+
selection2.addRange(newRange);
|
|
6683
|
+
return false;
|
|
6684
|
+
}
|
|
6685
|
+
return;
|
|
6686
|
+
}
|
|
6687
|
+
let shouldMoveToTopicStart = false;
|
|
6688
|
+
const offset = range.startOffset;
|
|
6689
|
+
if (container.nodeType === Node.TEXT_NODE && container.parentNode === firstTopic) {
|
|
6690
|
+
shouldMoveToTopicStart = true;
|
|
6691
|
+
} else if (container === firstTopic) {
|
|
6692
|
+
shouldMoveToTopicStart = true;
|
|
6693
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
6694
|
+
let prevSibling = container.previousSibling;
|
|
6695
|
+
while (prevSibling) {
|
|
6696
|
+
if (prevSibling === firstTopic) {
|
|
6697
|
+
shouldMoveToTopicStart = true;
|
|
6698
|
+
break;
|
|
6699
|
+
}
|
|
6700
|
+
prevSibling = prevSibling.previousSibling;
|
|
6701
|
+
}
|
|
6702
|
+
} else if (container === currentParagraph) {
|
|
6703
|
+
const topicRange = document.createRange();
|
|
6704
|
+
topicRange.selectNode(firstTopic);
|
|
6705
|
+
const cursorRange = document.createRange();
|
|
6706
|
+
cursorRange.setStart(container, offset);
|
|
6707
|
+
cursorRange.collapse(true);
|
|
6708
|
+
if (cursorRange.compareBoundaryPoints(Range.START_TO_END, topicRange) > 0) {
|
|
6709
|
+
shouldMoveToTopicStart = true;
|
|
6710
|
+
}
|
|
6711
|
+
}
|
|
6712
|
+
if (shouldMoveToTopicStart) {
|
|
6713
|
+
event.preventDefault();
|
|
6714
|
+
event.stopPropagation();
|
|
6715
|
+
me2.setCursorBeforeElement(firstTopic);
|
|
6716
|
+
return false;
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
6719
|
+
}
|
|
5628
6720
|
}
|
|
5629
6721
|
}
|
|
5630
6722
|
});
|
|
@@ -5687,7 +6779,6 @@ const _sfc_main = {
|
|
|
5687
6779
|
this.insertElement(p);
|
|
5688
6780
|
};
|
|
5689
6781
|
window.Squire.prototype.makeHeader = function(content, config = { makeHeader: {} }) {
|
|
5690
|
-
console.log(content);
|
|
5691
6782
|
if (content) {
|
|
5692
6783
|
const h2 = this.createElement("h2", {
|
|
5693
6784
|
class: "halo-paragraph-title"
|
|
@@ -5713,6 +6804,7 @@ const _sfc_main = {
|
|
|
5713
6804
|
window.Squire.empty(block)
|
|
5714
6805
|
]);
|
|
5715
6806
|
output.appendChild(
|
|
6807
|
+
// 段落才能添加标题
|
|
5716
6808
|
Array.from(block.classList).indexOf("halo-img-content") > -1 ? block : container
|
|
5717
6809
|
);
|
|
5718
6810
|
}
|
|
@@ -5720,7 +6812,6 @@ const _sfc_main = {
|
|
|
5720
6812
|
});
|
|
5721
6813
|
const selection = window.getSelection();
|
|
5722
6814
|
const range = document.createRange();
|
|
5723
|
-
console.log(container);
|
|
5724
6815
|
range.setStart(container, 1);
|
|
5725
6816
|
range.collapse(true);
|
|
5726
6817
|
selection.removeAllRanges();
|
|
@@ -5736,18 +6827,18 @@ const _sfc_main = {
|
|
|
5736
6827
|
});
|
|
5737
6828
|
loading.innerHTML = `
|
|
5738
6829
|
<img class="img-loading-icon" src="/img/upload-image-loading.png"/>
|
|
5739
|
-
<span class="img-loading-tip"
|
|
6830
|
+
<span class="img-loading-tip">上传中...</span>
|
|
5740
6831
|
`;
|
|
5741
6832
|
var fail = this.createElement("div", {
|
|
5742
6833
|
class: "img-fail hide",
|
|
5743
6834
|
contenteditable: "false"
|
|
5744
6835
|
});
|
|
5745
|
-
fail.innerHTML = "
|
|
6836
|
+
fail.innerHTML = "上传失败<br>请下载图片至本地后重新上传";
|
|
5746
6837
|
var again = this.createElement("button", {
|
|
5747
6838
|
class: "img-again hide",
|
|
5748
6839
|
contenteditable: "false"
|
|
5749
6840
|
});
|
|
5750
|
-
again.innerHTML = "
|
|
6841
|
+
again.innerHTML = "重新上传";
|
|
5751
6842
|
const isGif = src && src.indexOf(".gif") > -1;
|
|
5752
6843
|
if (isGif) {
|
|
5753
6844
|
src = src.replace(".gif", ".gif!nowater");
|
|
@@ -5802,7 +6893,7 @@ const _sfc_main = {
|
|
|
5802
6893
|
});
|
|
5803
6894
|
div.innerHTML = `
|
|
5804
6895
|
<div class="video-progress">
|
|
5805
|
-
<div class="label"
|
|
6896
|
+
<div class="label">上传中...</div>
|
|
5806
6897
|
<div class="box">
|
|
5807
6898
|
<div class="inner" style="width:20%"></div>
|
|
5808
6899
|
</div>
|
|
@@ -5825,6 +6916,7 @@ const _sfc_main = {
|
|
|
5825
6916
|
data: JSON.stringify(data),
|
|
5826
6917
|
"data-content": data.content || "",
|
|
5827
6918
|
poster: data.img || ""
|
|
6919
|
+
// 'contenteditable': 'true',
|
|
5828
6920
|
});
|
|
5829
6921
|
var delBtn = me2.genIconDom({
|
|
5830
6922
|
class: "pointer video-delete icon",
|
|
@@ -5834,7 +6926,6 @@ const _sfc_main = {
|
|
|
5834
6926
|
e.stopPropagation();
|
|
5835
6927
|
}
|
|
5836
6928
|
});
|
|
5837
|
-
console.log(delBtn);
|
|
5838
6929
|
const posterBtn = me2.insertVideoBtns(this, video);
|
|
5839
6930
|
var p = this.createElement(
|
|
5840
6931
|
"DIV",
|
|
@@ -5883,6 +6974,7 @@ const _sfc_main = {
|
|
|
5883
6974
|
}
|
|
5884
6975
|
};
|
|
5885
6976
|
},
|
|
6977
|
+
// 撤销重做 会把 所有的监听全都移除,所以需要重新绑定
|
|
5886
6978
|
setListener(dom) {
|
|
5887
6979
|
const me2 = this;
|
|
5888
6980
|
const doms = dom ? [dom] : Array.from(this.editorDom.children);
|
|
@@ -5893,7 +6985,7 @@ const _sfc_main = {
|
|
|
5893
6985
|
p.onclick = function(e) {
|
|
5894
6986
|
var _a;
|
|
5895
6987
|
if (area.nodeName === "VIDEO" && ((_a = me2.selectDom) == null ? void 0 : _a.className) === "halo-video-content") {
|
|
5896
|
-
me2.setToast("
|
|
6988
|
+
me2.setToast("不支持播放");
|
|
5897
6989
|
}
|
|
5898
6990
|
if (e.target.className.includes("desc-input")) {
|
|
5899
6991
|
return;
|
|
@@ -5957,6 +7049,7 @@ const _sfc_main = {
|
|
|
5957
7049
|
};
|
|
5958
7050
|
return del;
|
|
5959
7051
|
},
|
|
7052
|
+
// 转换数据,返回给业务
|
|
5960
7053
|
getEditorData() {
|
|
5961
7054
|
const me2 = this;
|
|
5962
7055
|
const children = Array.from(me2.editorDom.children);
|
|
@@ -6014,9 +7107,11 @@ const _sfc_main = {
|
|
|
6014
7107
|
videoIds
|
|
6015
7108
|
};
|
|
6016
7109
|
},
|
|
7110
|
+
// 是否是摩托范的图片
|
|
6017
7111
|
isHaloImage(url = "") {
|
|
6018
7112
|
return url.indexOf("jddmoto") > -1 || url.indexOf("58moto") > -1 || url.indexOf("emotofine") > -1 || url.indexOf("dronefine") > -1;
|
|
6019
7113
|
},
|
|
7114
|
+
// 获取待上传图片列表
|
|
6020
7115
|
updateUploads() {
|
|
6021
7116
|
const me2 = this;
|
|
6022
7117
|
setTimeout(() => {
|
|
@@ -6063,8 +7158,8 @@ const _sfc_main = {
|
|
|
6063
7158
|
const currentImg = me2.uploadStore[key];
|
|
6064
7159
|
const imageUrl = key.split("|")[1] || "";
|
|
6065
7160
|
if (!currentImg) {
|
|
6066
|
-
console.log("
|
|
6067
|
-
return Promise.reject("
|
|
7161
|
+
console.log("图片不存在", key);
|
|
7162
|
+
return Promise.reject("图片不存在");
|
|
6068
7163
|
}
|
|
6069
7164
|
const parent = currentImg.parentNode || "";
|
|
6070
7165
|
const uploadFailHandler = (currentImg2) => {
|
|
@@ -6108,6 +7203,7 @@ const _sfc_main = {
|
|
|
6108
7203
|
parent && uploadFailHandler(currentImg);
|
|
6109
7204
|
});
|
|
6110
7205
|
},
|
|
7206
|
+
// 更新上传的图片
|
|
6111
7207
|
updateImage(img, currentImg = {}) {
|
|
6112
7208
|
const data = JSON.parse(currentImg.getAttribute("data") || "{}");
|
|
6113
7209
|
data.img = img;
|
|
@@ -6130,6 +7226,7 @@ const _sfc_main = {
|
|
|
6130
7226
|
parent.appendChild(arr[2]);
|
|
6131
7227
|
}
|
|
6132
7228
|
},
|
|
7229
|
+
// 获取ctrl + v 后内容
|
|
6133
7230
|
getSticker(type, handler) {
|
|
6134
7231
|
this.setSticker(type.fragment.children);
|
|
6135
7232
|
},
|
|
@@ -6147,6 +7244,7 @@ const _sfc_main = {
|
|
|
6147
7244
|
});
|
|
6148
7245
|
this.updateData(true);
|
|
6149
7246
|
},
|
|
7247
|
+
// 粘贴
|
|
6150
7248
|
setSticker(data) {
|
|
6151
7249
|
const me2 = this;
|
|
6152
7250
|
data = Array.from(data);
|
|
@@ -6185,6 +7283,7 @@ const _sfc_main = {
|
|
|
6185
7283
|
const me2 = this;
|
|
6186
7284
|
me2.updateData();
|
|
6187
7285
|
},
|
|
7286
|
+
// 监测 添加、撤回、恢复、删除
|
|
6188
7287
|
setBack(e, type) {
|
|
6189
7288
|
const me2 = this;
|
|
6190
7289
|
me2.refreshImg();
|
|
@@ -6217,6 +7316,7 @@ const _sfc_main = {
|
|
|
6217
7316
|
}
|
|
6218
7317
|
});
|
|
6219
7318
|
},
|
|
7319
|
+
// 设置scoll
|
|
6220
7320
|
sticky() {
|
|
6221
7321
|
const me2 = this;
|
|
6222
7322
|
me2.$nextTick(function() {
|
|
@@ -6236,6 +7336,8 @@ const _sfc_main = {
|
|
|
6236
7336
|
document.addEventListener("scroll", onScroll);
|
|
6237
7337
|
});
|
|
6238
7338
|
},
|
|
7339
|
+
// ==========toolbox==========
|
|
7340
|
+
// 撤回、恢复、段落标题
|
|
6239
7341
|
setContent(e, obj) {
|
|
6240
7342
|
const me2 = this;
|
|
6241
7343
|
const id = e.target.id || e.target.dataset.editorId;
|
|
@@ -6277,10 +7379,11 @@ const _sfc_main = {
|
|
|
6277
7379
|
this.fontInfo = this.editor.getFontInfo();
|
|
6278
7380
|
this.updateData(true);
|
|
6279
7381
|
},
|
|
7382
|
+
// 增加link
|
|
6280
7383
|
addLink(type) {
|
|
6281
7384
|
const me2 = this;
|
|
6282
|
-
me2.linkTitleName = type === "link" ? "
|
|
6283
|
-
me2.linkPlaceholder = type === "link" ? "
|
|
7385
|
+
me2.linkTitleName = type === "link" ? "添加链接" : "添加导入链接地址";
|
|
7386
|
+
me2.linkPlaceholder = type === "link" ? "请输入链接地址" : "仅支持输入微信链接";
|
|
6284
7387
|
me2.viewStatus = true;
|
|
6285
7388
|
me2.linkStatus = true;
|
|
6286
7389
|
},
|
|
@@ -6288,29 +7391,31 @@ const _sfc_main = {
|
|
|
6288
7391
|
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.,;?'&%$#=~_-]+))*$/;
|
|
6289
7392
|
return objExp.test(url);
|
|
6290
7393
|
},
|
|
7394
|
+
// 确认增加link
|
|
6291
7395
|
confirmLink() {
|
|
6292
7396
|
const me2 = this;
|
|
6293
7397
|
if (!me2.linkContent) {
|
|
6294
|
-
return ElMessage.error("
|
|
7398
|
+
return ElMessage.error("请输入链接地址!");
|
|
6295
7399
|
}
|
|
6296
|
-
if (me2.linkTitleName === "
|
|
7400
|
+
if (me2.linkTitleName === "添加导入链接地址" || this.visibleCollectArticle) {
|
|
6297
7401
|
this.visibleCollectArticle = false;
|
|
6298
7402
|
return me2.importLinkData();
|
|
6299
7403
|
}
|
|
6300
7404
|
if (!this.validUrl(me2.linkContent)) {
|
|
6301
|
-
return me2.setToast("URL
|
|
7405
|
+
return me2.setToast("URL无效");
|
|
6302
7406
|
}
|
|
6303
7407
|
if (!me2.isHaloImage(me2.linkContent)) {
|
|
6304
|
-
return me2.setToast("
|
|
7408
|
+
return me2.setToast("请输入摩托范内部网址");
|
|
6305
7409
|
}
|
|
6306
7410
|
me2.editor["insertLink"](me2.linkContent);
|
|
6307
7411
|
me2.linkContent = "";
|
|
6308
7412
|
me2.closeDialog();
|
|
6309
7413
|
},
|
|
7414
|
+
// 增加link导入数据
|
|
6310
7415
|
importLinkData() {
|
|
6311
7416
|
const me2 = this;
|
|
6312
7417
|
if (me2.loading) {
|
|
6313
|
-
return ElMessage("
|
|
7418
|
+
return ElMessage("正在获取信息,请稍后...");
|
|
6314
7419
|
}
|
|
6315
7420
|
me2.loading = true;
|
|
6316
7421
|
const params = {
|
|
@@ -6332,38 +7437,444 @@ const _sfc_main = {
|
|
|
6332
7437
|
me2.linkContent = "";
|
|
6333
7438
|
return;
|
|
6334
7439
|
} else {
|
|
6335
|
-
me2.setToast("
|
|
7440
|
+
me2.setToast("导入失败,请重试");
|
|
6336
7441
|
}
|
|
6337
7442
|
}).catch((err) => {
|
|
6338
7443
|
console.log(err.message);
|
|
6339
|
-
me2.setToast("
|
|
7444
|
+
me2.setToast("导入异常,请重试");
|
|
6340
7445
|
}).finally((_) => {
|
|
6341
7446
|
me2.loading = false;
|
|
6342
7447
|
});
|
|
6343
7448
|
},
|
|
7449
|
+
// 打开 图片、视频、一键导入 弹框
|
|
6344
7450
|
openDialog(name) {
|
|
6345
7451
|
const me2 = this;
|
|
6346
|
-
me2.viewName = name === "img" ? "
|
|
6347
|
-
me2.viewButton = name === "img" ? "
|
|
6348
|
-
me2.viewTip = name === "img" ? "" : "
|
|
7452
|
+
me2.viewName = name === "img" ? "添加图片" : "添加视频";
|
|
7453
|
+
me2.viewButton = name === "img" ? "选择图片" : "选择视频";
|
|
7454
|
+
me2.viewTip = name === "img" ? "" : "为了获得更高的推荐和点击量,建议上传720p(1280*720),大小不超过500MB(视频上传需要时间,请耐心等待)";
|
|
6349
7455
|
me2.viewStatus = true;
|
|
6350
7456
|
},
|
|
7457
|
+
// 关闭弹框
|
|
6351
7458
|
closeDialog() {
|
|
6352
7459
|
this.viewStatus = false;
|
|
6353
7460
|
this.linkStatus = false;
|
|
6354
7461
|
this.linkContent = "";
|
|
6355
7462
|
},
|
|
7463
|
+
// ==========toolbox end==========
|
|
7464
|
+
// 弹框提示
|
|
6356
7465
|
setToast(content) {
|
|
6357
7466
|
ElMessage.error(content);
|
|
6358
7467
|
},
|
|
6359
7468
|
setMessageBoxNoCancel(content) {
|
|
6360
7469
|
ElMessageBox.confirm(content, "", {
|
|
6361
|
-
confirmButtonText: "
|
|
6362
|
-
cancelButtonText: "
|
|
7470
|
+
confirmButtonText: "确定",
|
|
7471
|
+
cancelButtonText: "取消",
|
|
6363
7472
|
type: "warning"
|
|
6364
7473
|
}).then(() => {
|
|
6365
7474
|
}).catch(() => {
|
|
6366
7475
|
});
|
|
7476
|
+
},
|
|
7477
|
+
// 检查是否会创建嵌套的halo-paragraph
|
|
7478
|
+
wouldCreateNestedParagraph(range) {
|
|
7479
|
+
let container = range.startContainer;
|
|
7480
|
+
while (container && container !== this.editorDom) {
|
|
7481
|
+
if (container.nodeType === Node.ELEMENT_NODE && container.classList && container.classList.contains("halo-paragraph")) {
|
|
7482
|
+
return true;
|
|
7483
|
+
}
|
|
7484
|
+
container = container.parentNode;
|
|
7485
|
+
}
|
|
7486
|
+
return false;
|
|
7487
|
+
},
|
|
7488
|
+
// 检查光标是否在两个连续的mdd-topic之间
|
|
7489
|
+
isBetweenTwoTopics(range) {
|
|
7490
|
+
const container = range.startContainer;
|
|
7491
|
+
const offset = range.startOffset;
|
|
7492
|
+
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7493
|
+
const prevElement = container.childNodes[offset - 1];
|
|
7494
|
+
const nextElement = container.childNodes[offset];
|
|
7495
|
+
return prevElement && prevElement.tagName === "MDD-TOPIC" && (nextElement && nextElement.tagName === "MDD-TOPIC");
|
|
7496
|
+
}
|
|
7497
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent.trim() === "") {
|
|
7498
|
+
const prevSibling = container.previousSibling;
|
|
7499
|
+
const nextSibling = container.nextSibling;
|
|
7500
|
+
return prevSibling && prevSibling.tagName === "MDD-TOPIC" && (nextSibling && nextSibling.tagName === "MDD-TOPIC");
|
|
7501
|
+
}
|
|
7502
|
+
return false;
|
|
7503
|
+
},
|
|
7504
|
+
// 处理两个话题之间的回车或话题前面的回车
|
|
7505
|
+
handleEnterBetweenTopics(range) {
|
|
7506
|
+
var _a;
|
|
7507
|
+
const me2 = this;
|
|
7508
|
+
let currentParagraph = range.startContainer;
|
|
7509
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
7510
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7511
|
+
}
|
|
7512
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
7513
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7514
|
+
}
|
|
7515
|
+
if (!currentParagraph)
|
|
7516
|
+
return;
|
|
7517
|
+
const newParagraph = document.createElement("p");
|
|
7518
|
+
newParagraph.className = "halo-paragraph";
|
|
7519
|
+
const afterContent = me2.extractContentAfterCursorPrecise(range, currentParagraph);
|
|
7520
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7521
|
+
while (afterContent.firstChild) {
|
|
7522
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7523
|
+
}
|
|
7524
|
+
} else {
|
|
7525
|
+
newParagraph.innerHTML = "<br>";
|
|
7526
|
+
}
|
|
7527
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7528
|
+
const newRange = document.createRange();
|
|
7529
|
+
if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.TEXT_NODE) {
|
|
7530
|
+
newRange.setStart(newParagraph.firstChild, 0);
|
|
7531
|
+
} else if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.ELEMENT_NODE) {
|
|
7532
|
+
newRange.setStart(newParagraph, 0);
|
|
7533
|
+
} else {
|
|
7534
|
+
newRange.setStart(newParagraph, 0);
|
|
7535
|
+
}
|
|
7536
|
+
newRange.collapse(true);
|
|
7537
|
+
const selection = window.getSelection();
|
|
7538
|
+
selection.removeAllRanges();
|
|
7539
|
+
selection.addRange(newRange);
|
|
7540
|
+
me2.updateData(true);
|
|
7541
|
+
},
|
|
7542
|
+
// 更精确地提取光标后的内容(专门用于话题分割)
|
|
7543
|
+
extractContentAfterCursorPrecise(range, paragraph) {
|
|
7544
|
+
const fragment = document.createDocumentFragment();
|
|
7545
|
+
const container = range.startContainer;
|
|
7546
|
+
const offset = range.startOffset;
|
|
7547
|
+
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7548
|
+
const childNodes = Array.from(container.childNodes);
|
|
7549
|
+
for (let i = offset; i < childNodes.length; i++) {
|
|
7550
|
+
fragment.appendChild(childNodes[i]);
|
|
7551
|
+
}
|
|
7552
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
7553
|
+
if (offset < container.textContent.length) {
|
|
7554
|
+
const afterText = container.textContent.slice(offset);
|
|
7555
|
+
container.textContent = container.textContent.slice(0, offset);
|
|
7556
|
+
const textNode = document.createTextNode(afterText);
|
|
7557
|
+
fragment.appendChild(textNode);
|
|
7558
|
+
}
|
|
7559
|
+
let nextSibling = container.nextSibling;
|
|
7560
|
+
while (nextSibling) {
|
|
7561
|
+
const nodeToMove = nextSibling;
|
|
7562
|
+
nextSibling = nextSibling.nextSibling;
|
|
7563
|
+
fragment.appendChild(nodeToMove);
|
|
7564
|
+
}
|
|
7565
|
+
}
|
|
7566
|
+
return fragment;
|
|
7567
|
+
},
|
|
7568
|
+
// 处理包含话题的段落中的回车键
|
|
7569
|
+
handleEnterKeyInParagraphWithTopic(range) {
|
|
7570
|
+
var _a;
|
|
7571
|
+
const me2 = this;
|
|
7572
|
+
let currentParagraph = range.startContainer;
|
|
7573
|
+
while (currentParagraph && currentParagraph.nodeType !== Node.ELEMENT_NODE) {
|
|
7574
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7575
|
+
}
|
|
7576
|
+
while (currentParagraph && !((_a = currentParagraph.classList) == null ? void 0 : _a.contains("halo-paragraph"))) {
|
|
7577
|
+
currentParagraph = currentParagraph.parentNode;
|
|
7578
|
+
}
|
|
7579
|
+
if (!currentParagraph)
|
|
7580
|
+
return;
|
|
7581
|
+
const newParagraph = document.createElement("p");
|
|
7582
|
+
newParagraph.className = "halo-paragraph";
|
|
7583
|
+
const isAtTopicStart = me2.isCursorBeforeFirstTopic(range, currentParagraph);
|
|
7584
|
+
const isAtEnd = me2.isCursorAtEndOfParagraph(range, currentParagraph);
|
|
7585
|
+
if (isAtTopicStart) {
|
|
7586
|
+
const afterContent = me2.extractContentAfterCursor(range, currentParagraph);
|
|
7587
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7588
|
+
while (afterContent.firstChild) {
|
|
7589
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7590
|
+
}
|
|
7591
|
+
} else {
|
|
7592
|
+
newParagraph.innerHTML = "<br>";
|
|
7593
|
+
}
|
|
7594
|
+
if (currentParagraph.innerHTML.trim() === "" || currentParagraph.childNodes.length === 0) {
|
|
7595
|
+
currentParagraph.innerHTML = "<br>";
|
|
7596
|
+
}
|
|
7597
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7598
|
+
} else if (isAtEnd) {
|
|
7599
|
+
newParagraph.innerHTML = "<br>";
|
|
7600
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7601
|
+
} else {
|
|
7602
|
+
const afterContent = me2.extractContentAfterCursor(range, currentParagraph);
|
|
7603
|
+
if (afterContent && afterContent.childNodes.length > 0) {
|
|
7604
|
+
let hasValidContent = false;
|
|
7605
|
+
for (let i = 0; i < afterContent.childNodes.length; i++) {
|
|
7606
|
+
const node = afterContent.childNodes[i];
|
|
7607
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
7608
|
+
if (node.textContent.trim() !== "") {
|
|
7609
|
+
hasValidContent = true;
|
|
7610
|
+
break;
|
|
7611
|
+
}
|
|
7612
|
+
} else {
|
|
7613
|
+
hasValidContent = true;
|
|
7614
|
+
break;
|
|
7615
|
+
}
|
|
7616
|
+
}
|
|
7617
|
+
if (hasValidContent) {
|
|
7618
|
+
while (afterContent.firstChild) {
|
|
7619
|
+
newParagraph.appendChild(afterContent.firstChild);
|
|
7620
|
+
}
|
|
7621
|
+
} else {
|
|
7622
|
+
newParagraph.innerHTML = "<br>";
|
|
7623
|
+
}
|
|
7624
|
+
} else {
|
|
7625
|
+
newParagraph.innerHTML = "<br>";
|
|
7626
|
+
}
|
|
7627
|
+
currentParagraph.parentNode.insertBefore(newParagraph, currentParagraph.nextSibling);
|
|
7628
|
+
}
|
|
7629
|
+
const newRange = document.createRange();
|
|
7630
|
+
if (newParagraph.firstChild && newParagraph.firstChild.nodeType === Node.TEXT_NODE) {
|
|
7631
|
+
newRange.setStart(newParagraph.firstChild, 0);
|
|
7632
|
+
} else if (newParagraph.firstChild) {
|
|
7633
|
+
newRange.setStart(newParagraph, 0);
|
|
7634
|
+
} else {
|
|
7635
|
+
newRange.setStart(newParagraph, 0);
|
|
7636
|
+
}
|
|
7637
|
+
newRange.collapse(true);
|
|
7638
|
+
const selection = window.getSelection();
|
|
7639
|
+
selection.removeAllRanges();
|
|
7640
|
+
selection.addRange(newRange);
|
|
7641
|
+
me2.updateData(true);
|
|
7642
|
+
},
|
|
7643
|
+
// 检查光标是否在第一个话题前面
|
|
7644
|
+
isCursorBeforeFirstTopic(range, paragraph) {
|
|
7645
|
+
const container = range.startContainer;
|
|
7646
|
+
const offset = range.startOffset;
|
|
7647
|
+
const firstTopic = paragraph.querySelector("mdd-topic");
|
|
7648
|
+
if (!firstTopic) {
|
|
7649
|
+
return false;
|
|
7650
|
+
}
|
|
7651
|
+
if (container === paragraph && offset === 0) {
|
|
7652
|
+
return true;
|
|
7653
|
+
}
|
|
7654
|
+
if (container === paragraph && offset > 0 && offset <= paragraph.childNodes.length) {
|
|
7655
|
+
if (offset < paragraph.childNodes.length) {
|
|
7656
|
+
const nodeAtOffset = paragraph.childNodes[offset];
|
|
7657
|
+
if (nodeAtOffset === firstTopic) {
|
|
7658
|
+
return true;
|
|
7659
|
+
}
|
|
7660
|
+
}
|
|
7661
|
+
let nextNonEmptyNode = null;
|
|
7662
|
+
for (let i = offset; i < paragraph.childNodes.length; i++) {
|
|
7663
|
+
const node = paragraph.childNodes[i];
|
|
7664
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "MDD-TOPIC") {
|
|
7665
|
+
nextNonEmptyNode = node;
|
|
7666
|
+
break;
|
|
7667
|
+
} else if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== "") {
|
|
7668
|
+
break;
|
|
7669
|
+
}
|
|
7670
|
+
}
|
|
7671
|
+
if (nextNonEmptyNode === firstTopic) {
|
|
7672
|
+
return true;
|
|
7673
|
+
}
|
|
7674
|
+
}
|
|
7675
|
+
try {
|
|
7676
|
+
const topicRange = document.createRange();
|
|
7677
|
+
topicRange.setStartBefore(firstTopic);
|
|
7678
|
+
const comparison = topicRange.comparePoint(container, offset);
|
|
7679
|
+
if (comparison < 0) {
|
|
7680
|
+
return true;
|
|
7681
|
+
}
|
|
7682
|
+
} catch (e) {
|
|
7683
|
+
if (container.nodeType === Node.TEXT_NODE) {
|
|
7684
|
+
const tempRange = document.createRange();
|
|
7685
|
+
tempRange.setStart(container, offset);
|
|
7686
|
+
tempRange.collapse(true);
|
|
7687
|
+
const topicRange = document.createRange();
|
|
7688
|
+
topicRange.setStartBefore(firstTopic);
|
|
7689
|
+
if (tempRange.compareBoundaryPoints(Range.START_TO_START, topicRange) < 0) {
|
|
7690
|
+
return true;
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
if (container === paragraph) {
|
|
7694
|
+
const testRange = document.createRange();
|
|
7695
|
+
testRange.setStart(paragraph, 0);
|
|
7696
|
+
testRange.setEnd(paragraph, offset);
|
|
7697
|
+
const containsTopic = testRange.intersectsNode(firstTopic);
|
|
7698
|
+
if (!containsTopic) {
|
|
7699
|
+
return true;
|
|
7700
|
+
}
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
return false;
|
|
7704
|
+
},
|
|
7705
|
+
// 获取不包含mdd-topic内部文本的段落文本
|
|
7706
|
+
getParagraphTextExcludingTopics(paragraph, range) {
|
|
7707
|
+
let textContent = "";
|
|
7708
|
+
let cursorPosition = 0;
|
|
7709
|
+
let foundCursor = false;
|
|
7710
|
+
const walker = document.createTreeWalker(
|
|
7711
|
+
paragraph,
|
|
7712
|
+
NodeFilter.SHOW_ALL,
|
|
7713
|
+
{
|
|
7714
|
+
acceptNode: function(node2) {
|
|
7715
|
+
if (node2.nodeType === Node.ELEMENT_NODE && node2.tagName === "MDD-TOPIC") {
|
|
7716
|
+
return NodeFilter.FILTER_REJECT;
|
|
7717
|
+
}
|
|
7718
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
7719
|
+
}
|
|
7720
|
+
},
|
|
7721
|
+
false
|
|
7722
|
+
);
|
|
7723
|
+
let node;
|
|
7724
|
+
while (node = walker.nextNode()) {
|
|
7725
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
7726
|
+
const nodeText = node.textContent;
|
|
7727
|
+
if (!foundCursor && node === range.startContainer) {
|
|
7728
|
+
cursorPosition = textContent.length + range.startOffset;
|
|
7729
|
+
foundCursor = true;
|
|
7730
|
+
}
|
|
7731
|
+
textContent += nodeText;
|
|
7732
|
+
}
|
|
7733
|
+
}
|
|
7734
|
+
return { textContent, cursorPosition };
|
|
7735
|
+
},
|
|
7736
|
+
// 检查光标是否在段落开头
|
|
7737
|
+
isCursorAtStartOfParagraph(range, paragraph) {
|
|
7738
|
+
const { cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
7739
|
+
return cursorPosition === 0;
|
|
7740
|
+
},
|
|
7741
|
+
// 检查光标是否在段落末尾
|
|
7742
|
+
isCursorAtEndOfParagraph(range, paragraph) {
|
|
7743
|
+
const walker = document.createTreeWalker(
|
|
7744
|
+
paragraph,
|
|
7745
|
+
NodeFilter.SHOW_TEXT,
|
|
7746
|
+
{
|
|
7747
|
+
acceptNode: function(node2) {
|
|
7748
|
+
let parent = node2.parentNode;
|
|
7749
|
+
while (parent && parent !== paragraph) {
|
|
7750
|
+
if (parent.tagName === "MDD-TOPIC") {
|
|
7751
|
+
return NodeFilter.FILTER_REJECT;
|
|
7752
|
+
}
|
|
7753
|
+
parent = parent.parentNode;
|
|
7754
|
+
}
|
|
7755
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
7756
|
+
}
|
|
7757
|
+
},
|
|
7758
|
+
false
|
|
7759
|
+
);
|
|
7760
|
+
let totalLength = 0;
|
|
7761
|
+
let node;
|
|
7762
|
+
while (node = walker.nextNode()) {
|
|
7763
|
+
totalLength += node.textContent.length;
|
|
7764
|
+
}
|
|
7765
|
+
const { cursorPosition } = this.getParagraphTextExcludingTopics(paragraph, range);
|
|
7766
|
+
return cursorPosition >= totalLength;
|
|
7767
|
+
},
|
|
7768
|
+
// 获取当前段落
|
|
7769
|
+
getCurrentParagraph(range) {
|
|
7770
|
+
let container = range.startContainer;
|
|
7771
|
+
while (container && container !== this.editorDom) {
|
|
7772
|
+
if (container.nodeType === Node.ELEMENT_NODE && container.classList && container.classList.contains("halo-paragraph")) {
|
|
7773
|
+
return container;
|
|
7774
|
+
}
|
|
7775
|
+
container = container.parentNode;
|
|
7776
|
+
}
|
|
7777
|
+
return null;
|
|
7778
|
+
},
|
|
7779
|
+
// 提取光标后的内容
|
|
7780
|
+
extractContentAfterCursor(range, paragraph) {
|
|
7781
|
+
const fragment = document.createDocumentFragment();
|
|
7782
|
+
const container = range.startContainer;
|
|
7783
|
+
const offset = range.startOffset;
|
|
7784
|
+
let topicSpaceNode = null;
|
|
7785
|
+
if (container.nodeType === Node.TEXT_NODE && container.textContent === " " && container.previousSibling && container.previousSibling.tagName === "MDD-TOPIC") {
|
|
7786
|
+
topicSpaceNode = container;
|
|
7787
|
+
}
|
|
7788
|
+
const extractRange = document.createRange();
|
|
7789
|
+
let startNode = null;
|
|
7790
|
+
let hasContentToExtract = false;
|
|
7791
|
+
if (topicSpaceNode) {
|
|
7792
|
+
if (topicSpaceNode.nextSibling) {
|
|
7793
|
+
startNode = topicSpaceNode.nextSibling;
|
|
7794
|
+
hasContentToExtract = true;
|
|
7795
|
+
}
|
|
7796
|
+
} else if (container.nodeType === Node.TEXT_NODE) {
|
|
7797
|
+
if (container.textContent === "" && offset === 0) {
|
|
7798
|
+
if (container.nextSibling) {
|
|
7799
|
+
startNode = container.nextSibling;
|
|
7800
|
+
hasContentToExtract = true;
|
|
7801
|
+
}
|
|
7802
|
+
} else if (offset < container.textContent.length) {
|
|
7803
|
+
const afterText = container.textContent.slice(offset);
|
|
7804
|
+
container.textContent = container.textContent.slice(0, offset);
|
|
7805
|
+
if (afterText.trim()) {
|
|
7806
|
+
const newTextNode = document.createTextNode(afterText);
|
|
7807
|
+
container.parentNode.insertBefore(newTextNode, container.nextSibling);
|
|
7808
|
+
startNode = newTextNode;
|
|
7809
|
+
hasContentToExtract = true;
|
|
7810
|
+
} else if (container.nextSibling) {
|
|
7811
|
+
startNode = container.nextSibling;
|
|
7812
|
+
hasContentToExtract = true;
|
|
7813
|
+
}
|
|
7814
|
+
} else {
|
|
7815
|
+
if (container.nextSibling) {
|
|
7816
|
+
startNode = container.nextSibling;
|
|
7817
|
+
hasContentToExtract = true;
|
|
7818
|
+
}
|
|
7819
|
+
}
|
|
7820
|
+
} else if (container.nodeType === Node.ELEMENT_NODE) {
|
|
7821
|
+
if (offset < container.childNodes.length) {
|
|
7822
|
+
startNode = container.childNodes[offset];
|
|
7823
|
+
hasContentToExtract = true;
|
|
7824
|
+
} else if (offset === 0 && container === paragraph) {
|
|
7825
|
+
if (paragraph.firstChild) {
|
|
7826
|
+
startNode = paragraph.firstChild;
|
|
7827
|
+
hasContentToExtract = true;
|
|
7828
|
+
}
|
|
7829
|
+
}
|
|
7830
|
+
}
|
|
7831
|
+
if (!hasContentToExtract || !startNode) {
|
|
7832
|
+
return fragment;
|
|
7833
|
+
}
|
|
7834
|
+
if (!paragraph.contains(startNode)) {
|
|
7835
|
+
return fragment;
|
|
7836
|
+
}
|
|
7837
|
+
try {
|
|
7838
|
+
extractRange.setStartBefore(startNode);
|
|
7839
|
+
let lastNode = paragraph.lastChild;
|
|
7840
|
+
while (lastNode && lastNode.nodeType === Node.TEXT_NODE && lastNode.textContent === "" && // 只跳过完全空的文本节点
|
|
7841
|
+
lastNode !== startNode) {
|
|
7842
|
+
lastNode = lastNode.previousSibling;
|
|
7843
|
+
}
|
|
7844
|
+
if (lastNode) {
|
|
7845
|
+
extractRange.setEndAfter(lastNode);
|
|
7846
|
+
} else {
|
|
7847
|
+
extractRange.setEnd(paragraph, paragraph.childNodes.length);
|
|
7848
|
+
}
|
|
7849
|
+
const extractedContent = extractRange.extractContents();
|
|
7850
|
+
fragment.appendChild(extractedContent);
|
|
7851
|
+
} catch (e) {
|
|
7852
|
+
let currentNode = startNode;
|
|
7853
|
+
while (currentNode && currentNode.parentNode === paragraph) {
|
|
7854
|
+
const nextNode = currentNode.nextSibling;
|
|
7855
|
+
fragment.appendChild(currentNode);
|
|
7856
|
+
currentNode = nextNode;
|
|
7857
|
+
}
|
|
7858
|
+
}
|
|
7859
|
+
return fragment;
|
|
7860
|
+
},
|
|
7861
|
+
// 统一的光标设置方法 - 设置光标到元素后面
|
|
7862
|
+
setCursorAfterElement(element) {
|
|
7863
|
+
const newRange = document.createRange();
|
|
7864
|
+
newRange.setStartAfter(element);
|
|
7865
|
+
newRange.collapse(true);
|
|
7866
|
+
const selection = window.getSelection();
|
|
7867
|
+
selection.removeAllRanges();
|
|
7868
|
+
selection.addRange(newRange);
|
|
7869
|
+
},
|
|
7870
|
+
// 统一的光标设置方法 - 设置光标到元素前面
|
|
7871
|
+
setCursorBeforeElement(element) {
|
|
7872
|
+
const newRange = document.createRange();
|
|
7873
|
+
newRange.setStartBefore(element);
|
|
7874
|
+
newRange.collapse(true);
|
|
7875
|
+
const selection = window.getSelection();
|
|
7876
|
+
selection.removeAllRanges();
|
|
7877
|
+
selection.addRange(newRange);
|
|
6367
7878
|
}
|
|
6368
7879
|
},
|
|
6369
7880
|
beforeRouteLeave(to, from, next) {
|
|
@@ -6386,11 +7897,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6386
7897
|
const _component_ImgUpload = resolveComponent("ImgUpload");
|
|
6387
7898
|
const _component_VideoUpload = resolveComponent("VideoUpload");
|
|
6388
7899
|
const _component_CollectArticle = resolveComponent("CollectArticle");
|
|
7900
|
+
const _component_TopicManager = resolveComponent("TopicManager");
|
|
6389
7901
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
6390
7902
|
withDirectives(createElementVNode("div", {
|
|
6391
7903
|
style: normalizeStyle({ textAlign: $options.align }),
|
|
6392
7904
|
class: "placeholder"
|
|
6393
|
-
},
|
|
7905
|
+
}, toDisplayString($props.placeholder || "请输入正文"), 5), [
|
|
6394
7906
|
[vShow, !$options.isInputing && !$data.titleCount && !$data.hasArticleCard]
|
|
6395
7907
|
]),
|
|
6396
7908
|
$data.overLine ? (openBlock(), createElementBlock("div", {
|
|
@@ -6415,26 +7927,26 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6415
7927
|
createVNode(_component_el_form, { model: $data.linkForm }, {
|
|
6416
7928
|
default: withCtx(() => [
|
|
6417
7929
|
createVNode(_component_el_form_item, {
|
|
6418
|
-
label: "
|
|
7930
|
+
label: "添加链接",
|
|
6419
7931
|
class: "link-title"
|
|
6420
7932
|
}, {
|
|
6421
7933
|
default: withCtx(() => [
|
|
6422
7934
|
createVNode(_component_el_input, {
|
|
6423
7935
|
modelValue: $data.linkForm.linkAddress,
|
|
6424
7936
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.linkForm.linkAddress = $event),
|
|
6425
|
-
placeholder: "
|
|
7937
|
+
placeholder: "请输入链接地址"
|
|
6426
7938
|
}, null, 8, ["modelValue"])
|
|
6427
7939
|
]),
|
|
6428
7940
|
_: 1
|
|
6429
7941
|
}),
|
|
6430
|
-
createVNode(_component_el_form_item, { label: "
|
|
7942
|
+
createVNode(_component_el_form_item, { label: "链接文案" }, {
|
|
6431
7943
|
default: withCtx(() => [
|
|
6432
7944
|
createVNode(_component_el_input, {
|
|
6433
7945
|
modelValue: $data.linkForm.linkWriting,
|
|
6434
7946
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.linkForm.linkWriting = $event),
|
|
6435
7947
|
type: "textarea",
|
|
6436
7948
|
autosize: "",
|
|
6437
|
-
placeholder: "
|
|
7949
|
+
placeholder: "请输入链接文案"
|
|
6438
7950
|
}, null, 8, ["modelValue"])
|
|
6439
7951
|
]),
|
|
6440
7952
|
_: 1
|
|
@@ -6447,18 +7959,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6447
7959
|
createVNode(_component_el_button, {
|
|
6448
7960
|
onClick: _cache[3] || (_cache[3] = ($event) => $data.viewLinkDialog = false)
|
|
6449
7961
|
}, {
|
|
6450
|
-
default: withCtx(() => [
|
|
6451
|
-
createTextVNode("
|
|
6452
|
-
]),
|
|
7962
|
+
default: withCtx(() => _cache[14] || (_cache[14] = [
|
|
7963
|
+
createTextVNode("取 消")
|
|
7964
|
+
])),
|
|
6453
7965
|
_: 1
|
|
6454
7966
|
}),
|
|
6455
7967
|
createVNode(_component_el_button, {
|
|
6456
7968
|
type: "primary",
|
|
6457
7969
|
onClick: $options.insertLink
|
|
6458
7970
|
}, {
|
|
6459
|
-
default: withCtx(() => [
|
|
6460
|
-
createTextVNode("
|
|
6461
|
-
]),
|
|
7971
|
+
default: withCtx(() => _cache[15] || (_cache[15] = [
|
|
7972
|
+
createTextVNode("确 定")
|
|
7973
|
+
])),
|
|
6462
7974
|
_: 1
|
|
6463
7975
|
}, 8, ["onClick"])
|
|
6464
7976
|
])
|
|
@@ -6516,7 +8028,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6516
8028
|
class: "replace-poster hide",
|
|
6517
8029
|
accept: "image/*",
|
|
6518
8030
|
onChange: _cache[13] || (_cache[13] = (...args) => $options.replacePoster && $options.replacePoster(...args))
|
|
6519
|
-
}, null, 32)
|
|
8031
|
+
}, null, 32),
|
|
8032
|
+
createVNode(_component_TopicManager, {
|
|
8033
|
+
ref: "topicManager",
|
|
8034
|
+
"editor-dom": $data.editorDom,
|
|
8035
|
+
request: $props.request,
|
|
8036
|
+
onTopicInserted: $options.onTopicInserted,
|
|
8037
|
+
onUpdateTopicPosition: $options.updateTopicPosition
|
|
8038
|
+
}, null, 8, ["editor-dom", "request", "onTopicInserted", "onUpdateTopicPosition"])
|
|
6520
8039
|
]);
|
|
6521
8040
|
}
|
|
6522
8041
|
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|