vue-editify 0.1.22 → 0.1.23

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.
Files changed (64) hide show
  1. package/examples/App.vue +8 -2
  2. package/lib/components/button/button.vue.d.ts +3 -3
  3. package/lib/components/button/props.d.ts +1 -1
  4. package/lib/components/checkbox/checkbox.vue.d.ts +3 -3
  5. package/lib/components/checkbox/props.d.ts +1 -1
  6. package/lib/components/colors/colors.vue.d.ts +3 -3
  7. package/lib/components/colors/props.d.ts +1 -1
  8. package/lib/components/insertImage/insertImage.vue.d.ts +6 -6
  9. package/lib/components/insertImage/props.d.ts +2 -2
  10. package/lib/components/insertLink/insertLink.vue.d.ts +3 -3
  11. package/lib/components/insertLink/props.d.ts +2 -2
  12. package/lib/components/insertTable/insertTable.vue.d.ts +3 -3
  13. package/lib/components/insertTable/props.d.ts +2 -2
  14. package/lib/components/insertVideo/insertVideo.vue.d.ts +6 -6
  15. package/lib/components/insertVideo/props.d.ts +2 -2
  16. package/lib/components/menu/menu.vue.d.ts +3 -3
  17. package/lib/components/menu/props.d.ts +1 -1
  18. package/lib/components/toolbar/props.d.ts +1 -1
  19. package/lib/components/toolbar/toolbar.vue.d.ts +3 -3
  20. package/lib/core/rule.d.ts +1 -1
  21. package/lib/core/tool.d.ts +19 -9
  22. package/lib/editify/editify.vue.d.ts +12 -3
  23. package/lib/editify/props.d.ts +6 -2
  24. package/lib/editify.es.js +576 -178
  25. package/lib/editify.umd.js +1 -1
  26. package/lib/index.d.ts +7 -4
  27. package/lib/plugins/attachment/index.d.ts +17 -0
  28. package/lib/plugins/attachment/insertAttachment/insertAttachment.vue.d.ts +83 -0
  29. package/lib/plugins/attachment/insertAttachment/props.d.ts +38 -0
  30. package/lib/style.css +1 -1
  31. package/package.json +1 -1
  32. package/src/components/button/button.vue +4 -1
  33. package/src/components/button/props.ts +1 -1
  34. package/src/components/checkbox/props.ts +1 -1
  35. package/src/components/colors/colors.vue +1 -1
  36. package/src/components/colors/props.ts +1 -1
  37. package/src/components/insertImage/insertImage.vue +12 -10
  38. package/src/components/insertImage/props.ts +2 -2
  39. package/src/components/insertLink/insertLink.vue +1 -1
  40. package/src/components/insertLink/props.ts +2 -2
  41. package/src/components/insertTable/props.ts +2 -2
  42. package/src/components/insertVideo/insertVideo.vue +12 -10
  43. package/src/components/insertVideo/props.ts +2 -2
  44. package/src/components/menu/menu.vue +28 -13
  45. package/src/components/menu/props.ts +1 -1
  46. package/src/components/toolbar/props.ts +1 -1
  47. package/src/components/toolbar/toolbar.vue +3 -4
  48. package/src/core/function.ts +5 -5
  49. package/src/core/rule.ts +1 -1
  50. package/src/core/tool.ts +24 -11
  51. package/src/editify/editify.less +27 -0
  52. package/src/editify/editify.vue +50 -6
  53. package/src/editify/props.ts +9 -2
  54. package/src/icon/iconfont.css +4 -0
  55. package/src/icon/iconfont.ttf +0 -0
  56. package/src/icon/iconfont.woff +0 -0
  57. package/src/index.ts +13 -8
  58. package/src/locale/en_US.ts +9 -1
  59. package/src/locale/zh_CN.ts +9 -1
  60. package/src/plugins/attachment/images/attachment.png +0 -0
  61. package/src/plugins/attachment/index.ts +121 -0
  62. package/src/plugins/attachment/insertAttachment/insertAttachment.less +135 -0
  63. package/src/plugins/attachment/insertAttachment/insertAttachment.vue +189 -0
  64. package/src/plugins/attachment/insertAttachment/props.ts +48 -0
package/lib/editify.es.js CHANGED
@@ -18679,7 +18679,7 @@ const getMenuConfig = function(editTrans, editLocale) {
18679
18679
  //右侧边框是否显示
18680
18680
  rightBorder: false,
18681
18681
  //图片支持上传的类型,不区分大小写
18682
- accept: ["jpg", "png", "jpeg", "webp", "jfif", "ico", "gif", "svg", "psd"],
18682
+ allowedFileType: ["jpg", "png", "jpeg", "webp", "jfif", "ico", "gif", "svg", "psd"],
18683
18683
  //是否多选图片
18684
18684
  multiple: false,
18685
18685
  //单张图片的最大值,单位kb
@@ -18700,7 +18700,7 @@ const getMenuConfig = function(editTrans, editLocale) {
18700
18700
  //右侧边框是否显示
18701
18701
  rightBorder: false,
18702
18702
  //视频支持上传的类型,不区分大小写
18703
- accept: ["mp4", "avi", "mpg", "wmv", "mov", "rm", "swf", "flv"],
18703
+ allowedFileType: ["mp4", "avi", "mpg", "wmv", "mov", "rm", "swf", "flv"],
18704
18704
  //是否多选视频
18705
18705
  multiple: false,
18706
18706
  //单个视频的的最大值,单位kb
@@ -18814,13 +18814,13 @@ const elementIsInTask = (element2) => {
18814
18814
  }
18815
18815
  return false;
18816
18816
  };
18817
- const isList = function(element2, ordered = false) {
18817
+ const isList = (element2, ordered = false) => {
18818
18818
  if (element2.isEmpty()) {
18819
18819
  return false;
18820
18820
  }
18821
18821
  return element2.parsedom == "div" && element2.hasMarks() && element2.marks["data-editify-list"] == (ordered ? "ol" : "ul");
18822
18822
  };
18823
- const isTask = function(element2) {
18823
+ const isTask = (element2) => {
18824
18824
  if (element2.isEmpty()) {
18825
18825
  return false;
18826
18826
  }
@@ -19066,12 +19066,12 @@ const getFlatElementsByRange = (editor, dataRangeCaches) => {
19066
19066
  }
19067
19067
  return elements;
19068
19068
  };
19069
- const elementToParagraph = function(element2) {
19069
+ const elementToParagraph = (element2) => {
19070
19070
  element2.marks = null;
19071
19071
  element2.styles = null;
19072
19072
  element2.parsedom = AlexElement.BLOCK_NODE;
19073
19073
  };
19074
- const elementToList = function(element2, ordered = false) {
19074
+ const elementToList = (element2, ordered = false) => {
19075
19075
  if (isList(element2, ordered)) {
19076
19076
  return;
19077
19077
  }
@@ -19082,7 +19082,7 @@ const elementToList = function(element2, ordered = false) {
19082
19082
  }
19083
19083
  element2.marks["data-editify-list"] = ordered ? "ol" : "ul";
19084
19084
  };
19085
- const elementToTask = function(element2) {
19085
+ const elementToTask = (element2) => {
19086
19086
  if (isTask(element2)) {
19087
19087
  return;
19088
19088
  }
@@ -19933,8 +19933,8 @@ const TriangleProps = {
19933
19933
  default: null
19934
19934
  }
19935
19935
  };
19936
- const _hoisted_1$c = ["data-editify-placement"];
19937
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
19936
+ const _hoisted_1$d = ["data-editify-placement"];
19937
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
19938
19938
  ...{
19939
19939
  name: "Triangle"
19940
19940
  },
@@ -19998,7 +19998,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
19998
19998
  class: "editify-triangle-el",
19999
19999
  style: normalizeStyle(elStyle.value)
20000
20000
  }, null, 4)
20001
- ], 12, _hoisted_1$c);
20001
+ ], 12, _hoisted_1$d);
20002
20002
  };
20003
20003
  }
20004
20004
  });
@@ -20009,7 +20009,7 @@ const _export_sfc = (sfc, props) => {
20009
20009
  }
20010
20010
  return target;
20011
20011
  };
20012
- const Triangle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-e1abc967"]]);
20012
+ const Triangle = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-e1abc967"]]);
20013
20013
  const LayerProps = {
20014
20014
  //是否显示
20015
20015
  modelValue: {
@@ -20073,8 +20073,8 @@ const LayerProps = {
20073
20073
  default: false
20074
20074
  }
20075
20075
  };
20076
- const _hoisted_1$b = ["data-editify-placement"];
20077
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
20076
+ const _hoisted_1$c = ["data-editify-placement"];
20077
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
20078
20078
  ...{
20079
20079
  name: "Layer"
20080
20080
  },
@@ -20618,14 +20618,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
20618
20618
  }, [
20619
20619
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
20620
20620
  ], 6)
20621
- ], 12, _hoisted_1$b)) : createCommentVNode("", true)
20621
+ ], 12, _hoisted_1$c)) : createCommentVNode("", true)
20622
20622
  ]),
20623
20623
  _: 3
20624
20624
  }, 8, ["name"]);
20625
20625
  };
20626
20626
  }
20627
20627
  });
20628
- const Layer = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-09578d83"]]);
20628
+ const Layer = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-09578d83"]]);
20629
20629
  const TooltipProps = {
20630
20630
  //提示内容
20631
20631
  content: {
@@ -20643,8 +20643,8 @@ const TooltipProps = {
20643
20643
  default: false
20644
20644
  }
20645
20645
  };
20646
- const _hoisted_1$a = { class: "editify-tooltip-content" };
20647
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
20646
+ const _hoisted_1$b = { class: "editify-tooltip-content" };
20647
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
20648
20648
  ...{
20649
20649
  name: "Tooltip"
20650
20650
  },
@@ -20693,7 +20693,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
20693
20693
  "z-index": 10
20694
20694
  }, {
20695
20695
  default: withCtx(() => [
20696
- createElementVNode("div", _hoisted_1$a, toDisplayString(_ctx.content), 1)
20696
+ createElementVNode("div", _hoisted_1$b, toDisplayString(_ctx.content), 1)
20697
20697
  ]),
20698
20698
  _: 1
20699
20699
  }, 8, ["modelValue", "node"])
@@ -20701,7 +20701,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
20701
20701
  };
20702
20702
  }
20703
20703
  });
20704
- const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-7b5e30d1"]]);
20704
+ const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-7b5e30d1"]]);
20705
20705
  const IconProps = {
20706
20706
  //图标值
20707
20707
  value: {
@@ -20709,7 +20709,7 @@ const IconProps = {
20709
20709
  default: ""
20710
20710
  }
20711
20711
  };
20712
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
20712
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
20713
20713
  ...{
20714
20714
  name: "Icon"
20715
20715
  },
@@ -20723,7 +20723,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
20723
20723
  };
20724
20724
  }
20725
20725
  });
20726
- const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-6e00035b"]]);
20726
+ const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-6e00035b"]]);
20727
20727
  const ButtonProps = {
20728
20728
  //按钮类型
20729
20729
  type: {
@@ -20789,22 +20789,22 @@ const ButtonProps = {
20789
20789
  default: false
20790
20790
  }
20791
20791
  };
20792
- const _hoisted_1$9 = { class: "editify-button" };
20793
- const _hoisted_2$8 = {
20792
+ const _hoisted_1$a = { class: "editify-button" };
20793
+ const _hoisted_2$9 = {
20794
20794
  key: 0,
20795
20795
  class: "editify-button-slot"
20796
20796
  };
20797
- const _hoisted_3$8 = { key: 1 };
20798
- const _hoisted_4$6 = {
20797
+ const _hoisted_3$9 = { key: 1 };
20798
+ const _hoisted_4$7 = {
20799
20799
  key: 1,
20800
20800
  class: "editify-button-options"
20801
20801
  };
20802
- const _hoisted_5$5 = ["onClick"];
20803
- const _hoisted_6$5 = {
20802
+ const _hoisted_5$6 = ["onClick"];
20803
+ const _hoisted_6$6 = {
20804
20804
  key: 1,
20805
20805
  class: "editify-button-option-flex"
20806
20806
  };
20807
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
20807
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
20808
20808
  ...{
20809
20809
  name: "Button"
20810
20810
  },
@@ -20907,7 +20907,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
20907
20907
  return val ? val.label : "";
20908
20908
  });
20909
20909
  const parseColor = computed(() => {
20910
- return color.hex2rgb(props.color);
20910
+ if (props.color) {
20911
+ return color.hex2rgb(props.color);
20912
+ }
20913
+ return [];
20911
20914
  });
20912
20915
  const btnStyle = computed(() => {
20913
20916
  if (props.disabled) {
@@ -20951,7 +20954,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
20951
20954
  status
20952
20955
  });
20953
20956
  return (_ctx, _cache) => {
20954
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
20957
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
20955
20958
  createElementVNode("div", {
20956
20959
  class: normalizeClass(["editify-button-wrap", { "editify-right-border": _ctx.rightBorder, "editify-left-border": _ctx.leftBorder }])
20957
20960
  }, [
@@ -20971,9 +20974,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
20971
20974
  onMouseup: _cache[3] || (_cache[3] = ($event) => status.value = "hover"),
20972
20975
  onClick: handleClick
20973
20976
  }, [
20974
- _ctx.type == "default" || _ctx.type == "select" ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
20977
+ _ctx.type == "default" || _ctx.type == "select" ? (openBlock(), createElementBlock("div", _hoisted_2$9, [
20975
20978
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
20976
- ])) : _ctx.type == "display" ? (openBlock(), createElementBlock("div", _hoisted_3$8, toDisplayString(displayLabel.value), 1)) : createCommentVNode("", true),
20979
+ ])) : _ctx.type == "display" ? (openBlock(), createElementBlock("div", _hoisted_3$9, toDisplayString(displayLabel.value), 1)) : createCommentVNode("", true),
20977
20980
  _ctx.type == "select" || _ctx.type == "display" ? (openBlock(), createBlock(Icon, {
20978
20981
  key: 2,
20979
20982
  value: "caret-down",
@@ -21006,7 +21009,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
21006
21009
  _ctx.$slots.layer ? renderSlot(_ctx.$slots, "layer", {
21007
21010
  key: 0,
21008
21011
  options: cmpOptions.value
21009
- }, void 0, true) : (openBlock(), createElementBlock("div", _hoisted_4$6, [
21012
+ }, void 0, true) : (openBlock(), createElementBlock("div", _hoisted_4$7, [
21010
21013
  (openBlock(true), createElementBlock(Fragment, null, renderList(cmpOptions.value, (item) => {
21011
21014
  return openBlock(), createElementBlock("div", {
21012
21015
  onClick: ($event) => select(item),
@@ -21016,14 +21019,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
21016
21019
  _ctx.$slots.option ? renderSlot(_ctx.$slots, "option", {
21017
21020
  key: 0,
21018
21021
  item
21019
- }, void 0, true) : (openBlock(), createElementBlock("div", _hoisted_6$5, [
21022
+ }, void 0, true) : (openBlock(), createElementBlock("div", _hoisted_6$6, [
21020
21023
  item.icon ? (openBlock(), createBlock(Icon, {
21021
21024
  key: 0,
21022
21025
  value: item.icon
21023
21026
  }, null, 8, ["value"])) : createCommentVNode("", true),
21024
21027
  createElementVNode("span", null, toDisplayString(item.label), 1)
21025
21028
  ]))
21026
- ], 14, _hoisted_5$5);
21029
+ ], 14, _hoisted_5$6);
21027
21030
  }), 256))
21028
21031
  ]))
21029
21032
  ], 4)
@@ -21035,7 +21038,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
21035
21038
  };
21036
21039
  }
21037
21040
  });
21038
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-3656b737"]]);
21041
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-14398008"]]);
21039
21042
  const CheckboxProps = {
21040
21043
  //是否禁用
21041
21044
  disabled: {
@@ -21079,10 +21082,10 @@ const CheckboxProps = {
21079
21082
  }
21080
21083
  }
21081
21084
  };
21082
- const _hoisted_1$8 = ["data-editify-placement", "textContent"];
21083
- const _hoisted_2$7 = ["value", "disabled", "checked"];
21084
- const _hoisted_3$7 = ["data-editify-placement", "textContent"];
21085
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
21085
+ const _hoisted_1$9 = ["data-editify-placement", "textContent"];
21086
+ const _hoisted_2$8 = ["value", "disabled", "checked"];
21087
+ const _hoisted_3$8 = ["data-editify-placement", "textContent"];
21088
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
21086
21089
  ...{
21087
21090
  name: "Checkbox"
21088
21091
  },
@@ -21137,14 +21140,14 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
21137
21140
  class: "editify-checkbox-label",
21138
21141
  "data-editify-placement": _ctx.placement,
21139
21142
  textContent: toDisplayString(_ctx.label)
21140
- }, null, 8, _hoisted_1$8)) : createCommentVNode("", true),
21143
+ }, null, 8, _hoisted_1$9)) : createCommentVNode("", true),
21141
21144
  createElementVNode("input", {
21142
21145
  onChange: change,
21143
21146
  value: _ctx.value,
21144
21147
  disabled: _ctx.disabled,
21145
21148
  checked: check.value,
21146
21149
  type: "checkbox"
21147
- }, null, 40, _hoisted_2$7),
21150
+ }, null, 40, _hoisted_2$8),
21148
21151
  createElementVNode("span", {
21149
21152
  class: normalizeClass(["editify-checkbox-item", { "editify-reverse": !_ctx.color, "editify-round": _ctx.round, "editify-checked": check.value && !_ctx.disabled }]),
21150
21153
  style: normalizeStyle(itemStyle.value)
@@ -21159,12 +21162,12 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
21159
21162
  class: "editify-checkbox-label",
21160
21163
  "data-editify-placement": _ctx.placement,
21161
21164
  textContent: toDisplayString(_ctx.label)
21162
- }, null, 8, _hoisted_3$7)) : createCommentVNode("", true)
21165
+ }, null, 8, _hoisted_3$8)) : createCommentVNode("", true)
21163
21166
  ], 2);
21164
21167
  };
21165
21168
  }
21166
21169
  });
21167
- const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-d99c609b"]]);
21170
+ const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-d99c609b"]]);
21168
21171
  const ColorsProps = {
21169
21172
  //颜色数组
21170
21173
  data: {
@@ -21189,10 +21192,10 @@ const ColorsProps = {
21189
21192
  default: false
21190
21193
  }
21191
21194
  };
21192
- const _hoisted_1$7 = { class: "editify-colors" };
21193
- const _hoisted_2$6 = { class: "editify-colors-list" };
21194
- const _hoisted_3$6 = ["onClick"];
21195
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21195
+ const _hoisted_1$8 = { class: "editify-colors" };
21196
+ const _hoisted_2$7 = { class: "editify-colors-list" };
21197
+ const _hoisted_3$7 = ["onClick"];
21198
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
21196
21199
  ...{
21197
21200
  name: "Colors"
21198
21201
  },
@@ -21206,7 +21209,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21206
21209
  emits("change", item.value);
21207
21210
  };
21208
21211
  return (_ctx, _cache) => {
21209
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
21212
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
21210
21213
  createElementVNode("div", {
21211
21214
  class: "editify-colors-header",
21212
21215
  onClick: _cache[0] || (_cache[0] = ($event) => selectColor({ value: "" }))
@@ -21214,11 +21217,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21214
21217
  createVNode(Icon, { value: "remove" }),
21215
21218
  createElementVNode("span", null, toDisplayString(unref($editTrans)("defaultColor")), 1)
21216
21219
  ]),
21217
- createElementVNode("div", _hoisted_2$6, [
21220
+ createElementVNode("div", _hoisted_2$7, [
21218
21221
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data, (item) => {
21219
21222
  return openBlock(), createElementBlock("div", {
21220
21223
  class: normalizeClass(["editify-color", { "editify-active": _ctx.value == item.value }]),
21221
- style: normalizeStyle({ borderColor: _ctx.value == item.value ? _ctx.color : "" })
21224
+ style: normalizeStyle({ borderColor: _ctx.value == item.value ? _ctx.color || "" : "" })
21222
21225
  }, [
21223
21226
  createVNode(Tooltip, {
21224
21227
  block: "",
@@ -21230,7 +21233,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21230
21233
  onClick: ($event) => selectColor(item),
21231
21234
  class: "editify-color-el",
21232
21235
  style: normalizeStyle({ background: item.value })
21233
- }, null, 12, _hoisted_3$6)
21236
+ }, null, 12, _hoisted_3$7)
21234
21237
  ]),
21235
21238
  _: 2
21236
21239
  }, 1032, ["content", "disabled"])
@@ -21241,7 +21244,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21241
21244
  };
21242
21245
  }
21243
21246
  });
21244
- const Colors = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-514d2263"]]);
21247
+ const Colors = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-dec8d117"]]);
21245
21248
  const ToolbarProps = {
21246
21249
  //是否显示
21247
21250
  modelValue: {
@@ -21272,16 +21275,16 @@ const ToolbarProps = {
21272
21275
  default: ""
21273
21276
  }
21274
21277
  };
21275
- const _hoisted_1$6 = {
21278
+ const _hoisted_1$7 = {
21276
21279
  key: 0,
21277
21280
  class: "editify-toolbar-link"
21278
21281
  };
21279
- const _hoisted_2$5 = { class: "editify-toolbar-link-label" };
21280
- const _hoisted_3$5 = ["placeholder"];
21281
- const _hoisted_4$5 = { class: "editify-toolbar-link-footer" };
21282
- const _hoisted_5$4 = { class: "editify-toolbar-link-operations" };
21283
- const _hoisted_6$4 = ["href"];
21284
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
21282
+ const _hoisted_2$6 = { class: "editify-toolbar-link-label" };
21283
+ const _hoisted_3$6 = ["placeholder"];
21284
+ const _hoisted_4$6 = { class: "editify-toolbar-link-footer" };
21285
+ const _hoisted_5$5 = { class: "editify-toolbar-link-operations" };
21286
+ const _hoisted_6$5 = ["href"];
21287
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
21285
21288
  ...{
21286
21289
  name: "Toolbar"
21287
21290
  },
@@ -21291,7 +21294,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
21291
21294
  setup(__props, { emit: __emit }) {
21292
21295
  const props = __props;
21293
21296
  const emits = __emit;
21294
- const editify = inject("editify");
21295
21297
  const editor = inject("editor");
21296
21298
  const dataRangeCaches = inject("dataRangeCaches");
21297
21299
  const $editTrans = inject("$editTrans");
@@ -21955,7 +21957,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
21955
21957
  } else if (props.type == "text") {
21956
21958
  const extraDisabled = (name) => {
21957
21959
  if (typeof props.config.extraDisabled == "function") {
21958
- return props.config.extraDisabled.apply(editify.proxy, [name]) || false;
21960
+ return props.config.extraDisabled(name) || false;
21959
21961
  }
21960
21962
  return false;
21961
21963
  };
@@ -22068,8 +22070,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
22068
22070
  ref: toolbarRef,
22069
22071
  style: normalizeStyle(_ctx.config.style)
22070
22072
  }, [
22071
- _ctx.type == "link" ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
22072
- createElementVNode("div", _hoisted_2$5, toDisplayString(unref($editTrans)("linkAddress")), 1),
22073
+ _ctx.type == "link" ? (openBlock(), createElementBlock("div", _hoisted_1$7, [
22074
+ createElementVNode("div", _hoisted_2$6, toDisplayString(unref($editTrans)("linkAddress")), 1),
22073
22075
  withDirectives(createElementVNode("input", {
22074
22076
  onChange: modifyLink,
22075
22077
  onFocus: handleInputFocus,
@@ -22077,7 +22079,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
22077
22079
  placeholder: unref($editTrans)("linkUrlEnterPlaceholder"),
22078
22080
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => linkConfig.value.url = $event),
22079
22081
  type: "url"
22080
- }, null, 40, _hoisted_3$5), [
22082
+ }, null, 40, _hoisted_3$6), [
22081
22083
  [
22082
22084
  vModelText,
22083
22085
  linkConfig.value.url,
@@ -22085,7 +22087,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
22085
22087
  { trim: true }
22086
22088
  ]
22087
22089
  ]),
22088
- createElementVNode("div", _hoisted_4$5, [
22090
+ createElementVNode("div", _hoisted_4$6, [
22089
22091
  createVNode(Checkbox, {
22090
22092
  onChange: modifyLink,
22091
22093
  modelValue: linkConfig.value.newOpen,
@@ -22094,13 +22096,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
22094
22096
  color: _ctx.color,
22095
22097
  size: 10
22096
22098
  }, null, 8, ["modelValue", "label", "color"]),
22097
- createElementVNode("div", _hoisted_5$4, [
22099
+ createElementVNode("div", _hoisted_5$5, [
22098
22100
  createElementVNode("span", { onClick: removeLink }, toDisplayString(unref($editTrans)("removeLink")), 1),
22099
22101
  createElementVNode("a", {
22100
22102
  href: linkConfig.value.url,
22101
22103
  target: "_blank",
22102
- style: normalizeStyle({ color: _ctx.color })
22103
- }, toDisplayString(unref($editTrans)("viewLink")), 13, _hoisted_6$4)
22104
+ style: normalizeStyle({ color: _ctx.color || "" })
22105
+ }, toDisplayString(unref($editTrans)("viewLink")), 13, _hoisted_6$5)
22104
22106
  ])
22105
22107
  ])
22106
22108
  ])) : _ctx.type == "image" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
@@ -22771,7 +22773,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
22771
22773
  };
22772
22774
  }
22773
22775
  });
22774
- const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-44b03ca9"]]);
22776
+ const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-357be052"]]);
22775
22777
  const InsertLinkProps = {
22776
22778
  //主题色
22777
22779
  color: {
@@ -22784,13 +22786,13 @@ const InsertLinkProps = {
22784
22786
  default: ""
22785
22787
  }
22786
22788
  };
22787
- const _hoisted_1$5 = { class: "editify-link" };
22788
- const _hoisted_2$4 = { class: "editify-link-label" };
22789
- const _hoisted_3$4 = ["placeholder"];
22790
- const _hoisted_4$4 = ["placeholder"];
22791
- const _hoisted_5$3 = { class: "editify-link-footer" };
22792
- const _hoisted_6$3 = { class: "editify-link-operations" };
22793
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
22789
+ const _hoisted_1$6 = { class: "editify-link" };
22790
+ const _hoisted_2$5 = { class: "editify-link-label" };
22791
+ const _hoisted_3$5 = ["placeholder"];
22792
+ const _hoisted_4$5 = ["placeholder"];
22793
+ const _hoisted_5$4 = { class: "editify-link-footer" };
22794
+ const _hoisted_6$4 = { class: "editify-link-operations" };
22795
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
22794
22796
  ...{
22795
22797
  name: "InsertLink"
22796
22798
  },
@@ -22825,15 +22827,15 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
22825
22827
  emits("insert", linkText.value, linkUrl.value, newOpen.value);
22826
22828
  };
22827
22829
  return (_ctx, _cache) => {
22828
- return openBlock(), createElementBlock("div", _hoisted_1$5, [
22829
- createElementVNode("div", _hoisted_2$4, toDisplayString(unref($editTrans)("linkAddress")), 1),
22830
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
22831
+ createElementVNode("div", _hoisted_2$5, toDisplayString(unref($editTrans)("linkAddress")), 1),
22830
22832
  withDirectives(createElementVNode("input", {
22831
22833
  onFocus: handleInputFocus,
22832
22834
  onBlur: handleInputBlur,
22833
22835
  placeholder: unref($editTrans)("linkTextEnterPlaceholder"),
22834
22836
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => linkText.value = $event),
22835
22837
  type: "text"
22836
- }, null, 40, _hoisted_3$4), [
22838
+ }, null, 40, _hoisted_3$5), [
22837
22839
  [
22838
22840
  vModelText,
22839
22841
  linkText.value,
@@ -22847,7 +22849,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
22847
22849
  placeholder: unref($editTrans)("linkUrlEnterPlaceholder"),
22848
22850
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => linkUrl.value = $event),
22849
22851
  type: "url"
22850
- }, null, 40, _hoisted_4$4), [
22852
+ }, null, 40, _hoisted_4$5), [
22851
22853
  [
22852
22854
  vModelText,
22853
22855
  linkUrl.value,
@@ -22855,7 +22857,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
22855
22857
  { trim: true }
22856
22858
  ]
22857
22859
  ]),
22858
- createElementVNode("div", _hoisted_5$3, [
22860
+ createElementVNode("div", _hoisted_5$4, [
22859
22861
  createVNode(Checkbox, {
22860
22862
  modelValue: newOpen.value,
22861
22863
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => newOpen.value = $event),
@@ -22863,9 +22865,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
22863
22865
  color: _ctx.color,
22864
22866
  size: 10
22865
22867
  }, null, 8, ["modelValue", "label", "color"]),
22866
- createElementVNode("div", _hoisted_6$3, [
22868
+ createElementVNode("div", _hoisted_6$4, [
22867
22869
  createElementVNode("span", {
22868
- style: normalizeStyle({ color: _ctx.color }),
22870
+ style: normalizeStyle({ color: _ctx.color || "" }),
22869
22871
  onClick: insertLink2
22870
22872
  }, toDisplayString(unref($editTrans)("insertLink")), 5)
22871
22873
  ])
@@ -22874,7 +22876,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
22874
22876
  };
22875
22877
  }
22876
22878
  });
22877
- const InsertLink = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-f5a2ce93"]]);
22879
+ const InsertLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-9f80e392"]]);
22878
22880
  const InsertImageProps = {
22879
22881
  //主题色
22880
22882
  color: {
@@ -22882,7 +22884,7 @@ const InsertImageProps = {
22882
22884
  default: ""
22883
22885
  },
22884
22886
  //支持的图片类型数组
22885
- accept: {
22887
+ allowedFileType: {
22886
22888
  type: Array,
22887
22889
  default: null
22888
22890
  },
@@ -22912,19 +22914,19 @@ const InsertImageProps = {
22912
22914
  default: null
22913
22915
  }
22914
22916
  };
22915
- const _hoisted_1$4 = { class: "editify-image" };
22916
- const _hoisted_2$3 = { class: "editify-image-header" };
22917
- const _hoisted_3$3 = {
22917
+ const _hoisted_1$5 = { class: "editify-image" };
22918
+ const _hoisted_2$4 = { class: "editify-image-header" };
22919
+ const _hoisted_3$4 = {
22918
22920
  key: 0,
22919
22921
  class: "editify-image-remote"
22920
22922
  };
22921
- const _hoisted_4$3 = ["placeholder"];
22922
- const _hoisted_5$2 = {
22923
+ const _hoisted_4$4 = ["placeholder"];
22924
+ const _hoisted_5$3 = {
22923
22925
  key: 1,
22924
22926
  class: "editify-image-upload"
22925
22927
  };
22926
- const _hoisted_6$2 = ["multiple"];
22927
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
22928
+ const _hoisted_6$3 = ["multiple"];
22929
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
22928
22930
  ...{
22929
22931
  name: "InsertImage"
22930
22932
  },
@@ -22935,7 +22937,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
22935
22937
  const props = __props;
22936
22938
  const emits = __emit;
22937
22939
  const $editTrans = inject("$editTrans");
22938
- const editify = inject("editify");
22939
22940
  const current = ref("upload");
22940
22941
  const remoteUrl = ref("");
22941
22942
  const activeStyle = computed(() => {
@@ -22976,24 +22977,24 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
22976
22977
  for (let i = 0; i < files.length; i++) {
22977
22978
  const file2 = files[i];
22978
22979
  const suffix = getSuffix(file2);
22979
- const isMatch = props.accept.some((item) => {
22980
+ const isMatch = props.allowedFileType && Array.isArray(props.allowedFileType) && props.allowedFileType.length ? props.allowedFileType.some((item) => {
22980
22981
  return item.toLocaleLowerCase() == suffix.toLocaleLowerCase();
22981
- });
22982
+ }) : true;
22982
22983
  if (!isMatch) {
22983
22984
  if (typeof props.handleError == "function") {
22984
- props.handleError.apply(editify.proxy, ["suffixError", file2]);
22985
+ props.handleError("suffixError", file2);
22985
22986
  }
22986
22987
  continue;
22987
22988
  }
22988
22989
  if (props.maxSize && file2.size / 1024 > props.maxSize) {
22989
22990
  if (typeof props.handleError == "function") {
22990
- props.handleError.apply(editify.proxy, ["maxSizeError", file2]);
22991
+ props.handleError("maxSizeError", file2);
22991
22992
  }
22992
22993
  continue;
22993
22994
  }
22994
22995
  if (props.minSize && file2.size / 1024 < props.minSize) {
22995
22996
  if (typeof props.handleError == "function") {
22996
- props.handleError.apply(editify.proxy, ["minSizeError", file2]);
22997
+ props.handleError("minSizeError", file2);
22997
22998
  }
22998
22999
  continue;
22999
23000
  }
@@ -23002,7 +23003,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
23002
23003
  if (filterFiles.length) {
23003
23004
  let images = [];
23004
23005
  if (typeof props.customUpload == "function") {
23005
- images = await props.customUpload.apply(editify.proxy, [filterFiles]) || [];
23006
+ images = await props.customUpload(filterFiles) || [];
23006
23007
  } else {
23007
23008
  for (let i = 0; i < filterFiles.length; i++) {
23008
23009
  const url = await file.dataFileToBase64(filterFiles[i]);
@@ -23022,8 +23023,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
23022
23023
  }
23023
23024
  );
23024
23025
  return (_ctx, _cache) => {
23025
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
23026
- createElementVNode("div", _hoisted_2$3, [
23026
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
23027
+ createElementVNode("div", _hoisted_2$4, [
23027
23028
  createElementVNode("div", {
23028
23029
  onClick: _cache[0] || (_cache[0] = ($event) => current.value = "upload"),
23029
23030
  class: normalizeClass(["editify-image-header-item", { "editify-active": current.value == "upload" }]),
@@ -23039,13 +23040,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
23039
23040
  style: normalizeStyle({ backgroundColor: _ctx.color || "" })
23040
23041
  }, null, 6)
23041
23042
  ]),
23042
- current.value == "remote" ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
23043
+ current.value == "remote" ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
23043
23044
  withDirectives(createElementVNode("input", {
23044
23045
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => remoteUrl.value = $event),
23045
23046
  placeholder: unref($editTrans)("imageUrlPlaceholder"),
23046
23047
  onBlur: handleInputBlur,
23047
23048
  onFocus: handleInputFocus
23048
- }, null, 40, _hoisted_4$3), [
23049
+ }, null, 40, _hoisted_4$4), [
23049
23050
  [
23050
23051
  vModelText,
23051
23052
  remoteUrl.value,
@@ -23055,24 +23056,24 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
23055
23056
  ]),
23056
23057
  createElementVNode("div", {
23057
23058
  class: "editify-image-remote-footer",
23058
- style: normalizeStyle({ color: _ctx.color })
23059
+ style: normalizeStyle({ color: _ctx.color || "" })
23059
23060
  }, [
23060
23061
  createElementVNode("span", { onClick: insertRemoteImage }, toDisplayString(unref($editTrans)("insert")), 1)
23061
23062
  ], 4)
23062
- ])) : (openBlock(), createElementBlock("div", _hoisted_5$2, [
23063
+ ])) : (openBlock(), createElementBlock("div", _hoisted_5$3, [
23063
23064
  createVNode(Icon, { value: "upload" }),
23064
23065
  createElementVNode("input", {
23065
23066
  multiple: _ctx.multiple,
23066
23067
  accept: "image/*",
23067
23068
  onChange: selectFile,
23068
23069
  type: "file"
23069
- }, null, 40, _hoisted_6$2)
23070
+ }, null, 40, _hoisted_6$3)
23070
23071
  ]))
23071
23072
  ]);
23072
23073
  };
23073
23074
  }
23074
23075
  });
23075
- const InsertImage = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-735f42e9"]]);
23076
+ const InsertImage = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-17d0a9c4"]]);
23076
23077
  const InsertVideoProps = {
23077
23078
  //主题色
23078
23079
  color: {
@@ -23080,7 +23081,7 @@ const InsertVideoProps = {
23080
23081
  default: ""
23081
23082
  },
23082
23083
  //支持的视频类型数组
23083
- accept: {
23084
+ allowedFileType: {
23084
23085
  type: Array,
23085
23086
  default: null
23086
23087
  },
@@ -23110,19 +23111,19 @@ const InsertVideoProps = {
23110
23111
  default: null
23111
23112
  }
23112
23113
  };
23113
- const _hoisted_1$3 = { class: "editify-video" };
23114
- const _hoisted_2$2 = { class: "editify-video-header" };
23115
- const _hoisted_3$2 = {
23114
+ const _hoisted_1$4 = { class: "editify-video" };
23115
+ const _hoisted_2$3 = { class: "editify-video-header" };
23116
+ const _hoisted_3$3 = {
23116
23117
  key: 0,
23117
23118
  class: "editify-video-remote"
23118
23119
  };
23119
- const _hoisted_4$2 = ["placeholder"];
23120
- const _hoisted_5$1 = {
23120
+ const _hoisted_4$3 = ["placeholder"];
23121
+ const _hoisted_5$2 = {
23121
23122
  key: 1,
23122
23123
  class: "editify-video-upload"
23123
23124
  };
23124
- const _hoisted_6$1 = ["multiple"];
23125
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23125
+ const _hoisted_6$2 = ["multiple"];
23126
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
23126
23127
  ...{
23127
23128
  name: "InsertVideo"
23128
23129
  },
@@ -23133,7 +23134,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23133
23134
  const props = __props;
23134
23135
  const emits = __emit;
23135
23136
  const $editTrans = inject("$editTrans");
23136
- const editify = inject("editify");
23137
23137
  const current = ref("upload");
23138
23138
  const remoteUrl = ref("");
23139
23139
  const activeStyle = computed(() => {
@@ -23174,24 +23174,24 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23174
23174
  for (let i = 0; i < files.length; i++) {
23175
23175
  const file2 = files[i];
23176
23176
  const suffix = getSuffix(file2);
23177
- const isMatch = props.accept.some((item) => {
23177
+ const isMatch = props.allowedFileType && Array.isArray(props.allowedFileType) && props.allowedFileType.length ? props.allowedFileType.some((item) => {
23178
23178
  return item.toLocaleLowerCase() == suffix.toLocaleLowerCase();
23179
- });
23179
+ }) : true;
23180
23180
  if (!isMatch) {
23181
23181
  if (typeof props.handleError == "function") {
23182
- props.handleError.apply(editify.proxy, ["suffixError", file2]);
23182
+ props.handleError("suffixError", file2);
23183
23183
  }
23184
23184
  continue;
23185
23185
  }
23186
23186
  if (props.maxSize && file2.size / 1024 > props.maxSize) {
23187
23187
  if (typeof props.handleError == "function") {
23188
- props.handleError.apply(editify.proxy, ["maxSizeError", file2]);
23188
+ props.handleError("maxSizeError", file2);
23189
23189
  }
23190
23190
  continue;
23191
23191
  }
23192
23192
  if (props.minSize && file2.size / 1024 < props.minSize) {
23193
23193
  if (typeof props.handleError == "function") {
23194
- props.handleError.apply(editify.proxy, ["minSizeError", file2]);
23194
+ props.handleError("minSizeError", file2);
23195
23195
  }
23196
23196
  continue;
23197
23197
  }
@@ -23200,7 +23200,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23200
23200
  if (filterFiles.length) {
23201
23201
  let videos = [];
23202
23202
  if (typeof props.customUpload == "function") {
23203
- videos = await props.customUpload.apply(editify.proxy, [filterFiles]) || [];
23203
+ videos = await props.customUpload(filterFiles) || [];
23204
23204
  } else {
23205
23205
  for (let i = 0; i < filterFiles.length; i++) {
23206
23206
  const url = await file.dataFileToBase64(filterFiles[i]);
@@ -23220,8 +23220,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23220
23220
  }
23221
23221
  );
23222
23222
  return (_ctx, _cache) => {
23223
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
23224
- createElementVNode("div", _hoisted_2$2, [
23223
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
23224
+ createElementVNode("div", _hoisted_2$3, [
23225
23225
  createElementVNode("div", {
23226
23226
  onClick: _cache[0] || (_cache[0] = ($event) => current.value = "upload"),
23227
23227
  class: normalizeClass(["editify-video-header-item", { "editify-active": current.value == "upload" }]),
@@ -23237,13 +23237,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23237
23237
  style: normalizeStyle({ backgroundColor: _ctx.color || "" })
23238
23238
  }, null, 6)
23239
23239
  ]),
23240
- current.value == "remote" ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
23240
+ current.value == "remote" ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
23241
23241
  withDirectives(createElementVNode("input", {
23242
23242
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => remoteUrl.value = $event),
23243
23243
  placeholder: unref($editTrans)("videoUrlPlaceholder"),
23244
23244
  onBlur: handleInputBlur,
23245
23245
  onFocus: handleInputFocus
23246
- }, null, 40, _hoisted_4$2), [
23246
+ }, null, 40, _hoisted_4$3), [
23247
23247
  [
23248
23248
  vModelText,
23249
23249
  remoteUrl.value,
@@ -23253,24 +23253,24 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23253
23253
  ]),
23254
23254
  createElementVNode("div", {
23255
23255
  class: "editify-video-remote-footer",
23256
- style: normalizeStyle({ color: _ctx.color })
23256
+ style: normalizeStyle({ color: _ctx.color || "" })
23257
23257
  }, [
23258
23258
  createElementVNode("span", { onClick: insertRemoteVideo }, toDisplayString(unref($editTrans)("insert")), 1)
23259
23259
  ], 4)
23260
- ])) : (openBlock(), createElementBlock("div", _hoisted_5$1, [
23260
+ ])) : (openBlock(), createElementBlock("div", _hoisted_5$2, [
23261
23261
  createVNode(Icon, { value: "upload" }),
23262
23262
  createElementVNode("input", {
23263
23263
  multiple: _ctx.multiple,
23264
23264
  accept: "video/*",
23265
23265
  onChange: selectFile,
23266
23266
  type: "file"
23267
- }, null, 40, _hoisted_6$1)
23267
+ }, null, 40, _hoisted_6$2)
23268
23268
  ]))
23269
23269
  ]);
23270
23270
  };
23271
23271
  }
23272
23272
  });
23273
- const InsertVideo = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-4d375427"]]);
23273
+ const InsertVideo = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a54e06d0"]]);
23274
23274
  const InsertTableProps = {
23275
23275
  //主题色
23276
23276
  color: {
@@ -23289,16 +23289,16 @@ const InsertTableProps = {
23289
23289
  }
23290
23290
  };
23291
23291
  const _withScopeId = (n) => (pushScopeId("data-v-9a40c4f5"), n = n(), popScopeId(), n);
23292
- const _hoisted_1$2 = { class: "editify-table" };
23293
- const _hoisted_2$1 = ["onMouseenter", "onClick"];
23294
- const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, null, -1));
23295
- const _hoisted_4$1 = [
23296
- _hoisted_3$1
23292
+ const _hoisted_1$3 = { class: "editify-table" };
23293
+ const _hoisted_2$2 = ["onMouseenter", "onClick"];
23294
+ const _hoisted_3$2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, null, -1));
23295
+ const _hoisted_4$2 = [
23296
+ _hoisted_3$2
23297
23297
  ];
23298
- const _hoisted_5 = { class: "editify-table-footer" };
23299
- const _hoisted_6 = { key: 0 };
23298
+ const _hoisted_5$1 = { class: "editify-table-footer" };
23299
+ const _hoisted_6$1 = { key: 0 };
23300
23300
  const _hoisted_7 = { key: 1 };
23301
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23301
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23302
23302
  ...{
23303
23303
  name: "InsertTable"
23304
23304
  },
@@ -23358,7 +23358,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23358
23358
  emits("insert", data2.x, data2.y);
23359
23359
  };
23360
23360
  return (_ctx, _cache) => {
23361
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
23361
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
23362
23362
  createElementVNode("table", null, [
23363
23363
  (openBlock(true), createElementBlock(Fragment, null, renderList(tableGrids.value, (row) => {
23364
23364
  return openBlock(), createElementBlock("tr", null, [
@@ -23367,19 +23367,19 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23367
23367
  class: normalizeClass({ "editify-inside": column.inside }),
23368
23368
  onMouseenter: ($event) => changeTableSize(column),
23369
23369
  onClick: ($event) => createTable(column)
23370
- }, _hoisted_4$1, 42, _hoisted_2$1);
23370
+ }, _hoisted_4$2, 42, _hoisted_2$2);
23371
23371
  }), 256))
23372
23372
  ]);
23373
23373
  }), 256))
23374
23374
  ]),
23375
- createElementVNode("div", _hoisted_5, [
23376
- specification.value ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(specification.value.x) + " x " + toDisplayString(specification.value.y), 1)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(unref($editTrans)("insertTable")), 1))
23375
+ createElementVNode("div", _hoisted_5$1, [
23376
+ specification.value ? (openBlock(), createElementBlock("span", _hoisted_6$1, toDisplayString(specification.value.x) + " x " + toDisplayString(specification.value.y), 1)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(unref($editTrans)("insertTable")), 1))
23377
23377
  ])
23378
23378
  ]);
23379
23379
  };
23380
23380
  }
23381
23381
  });
23382
- const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-9a40c4f5"]]);
23382
+ const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-9a40c4f5"]]);
23383
23383
  const MenuProps = {
23384
23384
  //菜单栏配置
23385
23385
  config: {
@@ -23392,8 +23392,8 @@ const MenuProps = {
23392
23392
  default: ""
23393
23393
  }
23394
23394
  };
23395
- const _hoisted_1$1 = ["data-editify-mode"];
23396
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23395
+ const _hoisted_1$2 = ["data-editify-mode"];
23396
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23397
23397
  ...{
23398
23398
  name: "Menu"
23399
23399
  },
@@ -23627,7 +23627,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23627
23627
  rightBorder: props.config.image.rightBorder,
23628
23628
  active: false,
23629
23629
  disabled: false,
23630
- accept: props.config.image.accept,
23630
+ allowedFileType: props.config.image.allowedFileType,
23631
23631
  multiple: props.config.image.multiple,
23632
23632
  maxSize: props.config.image.maxSize,
23633
23633
  minSize: props.config.image.minSize,
@@ -23640,7 +23640,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23640
23640
  rightBorder: props.config.video.rightBorder,
23641
23641
  active: false,
23642
23642
  disabled: false,
23643
- accept: props.config.video.accept,
23643
+ allowedFileType: props.config.video.allowedFileType,
23644
23644
  multiple: props.config.video.multiple,
23645
23645
  maxSize: props.config.video.maxSize,
23646
23646
  minSize: props.config.video.minSize,
@@ -23933,7 +23933,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23933
23933
  const value_isRangeInTask = isRangeInTask(editor.value, dataRangeCaches.value);
23934
23934
  const extraDisabled = (name) => {
23935
23935
  if (typeof props.config.extraDisabled == "function") {
23936
- return props.config.extraDisabled.apply(editify.proxy, [name]) || false;
23936
+ return props.config.extraDisabled(name) || false;
23937
23937
  }
23938
23938
  return false;
23939
23939
  };
@@ -24495,7 +24495,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
24495
24495
  }),
24496
24496
  layer: () => h(InsertImage, {
24497
24497
  color: props.color,
24498
- accept: imageConfig.value.accept,
24498
+ allowedFileType: imageConfig.value.allowedFileType,
24499
24499
  multiple: imageConfig.value.multiple,
24500
24500
  maxSize: imageConfig.value.maxSize,
24501
24501
  minSize: imageConfig.value.minSize,
@@ -24536,7 +24536,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
24536
24536
  }),
24537
24537
  layer: () => h(InsertVideo, {
24538
24538
  color: props.color,
24539
- accept: videoConfig.value.accept,
24539
+ allowedFileType: videoConfig.value.allowedFileType,
24540
24540
  multiple: videoConfig.value.multiple,
24541
24541
  maxSize: videoConfig.value.maxSize,
24542
24542
  minSize: videoConfig.value.minSize,
@@ -24665,29 +24665,44 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
24665
24665
  color: props.color,
24666
24666
  onLayerShow: () => {
24667
24667
  if (typeof configuration.onLayerShow == "function") {
24668
- configuration.onLayerShow.apply(editify.proxy, [itemProps.name, itemInstance.proxy.$refs.btnRef]);
24668
+ configuration.onLayerShow(itemProps.name, itemInstance.proxy.$refs.btnRef);
24669
24669
  }
24670
24670
  },
24671
24671
  onLayerShown: () => {
24672
24672
  if (typeof configuration.onLayerShown == "function") {
24673
- configuration.onLayerShown.apply(editify.proxy, [itemProps.name, itemInstance.proxy.$refs.btnRef]);
24673
+ configuration.onLayerShown(itemProps.name, itemInstance.proxy.$refs.btnRef);
24674
24674
  }
24675
24675
  },
24676
24676
  onLayerHidden: () => {
24677
24677
  if (typeof configuration.onLayerHidden == "function") {
24678
- configuration.onLayerHidden.apply(editify.proxy, [itemProps.name, itemInstance.proxy.$refs.btnRef]);
24678
+ configuration.onLayerHidden(itemProps.name, itemInstance.proxy.$refs.btnRef);
24679
24679
  }
24680
24680
  },
24681
24681
  onOperate: (name, val) => {
24682
24682
  if (typeof configuration.onOperate == "function") {
24683
- configuration.onOperate.apply(editify.proxy, [name, val, itemInstance.proxy.$refs.btnRef]);
24683
+ configuration.onOperate(name, val, itemInstance.proxy.$refs.btnRef);
24684
24684
  }
24685
24685
  }
24686
24686
  },
24687
24687
  {
24688
- default: configuration.default || null,
24689
- layer: configuration.layer || null,
24690
- option: configuration.option || null
24688
+ default: () => {
24689
+ if (configuration.default) {
24690
+ return configuration.default(itemProps.name, itemInstance.proxy.$refs.btnRef);
24691
+ }
24692
+ return null;
24693
+ },
24694
+ layer: () => {
24695
+ if (configuration.layer) {
24696
+ return configuration.layer(itemProps.name, itemInstance.proxy.$refs.btnRef);
24697
+ }
24698
+ return null;
24699
+ },
24700
+ option: () => {
24701
+ if (configuration.option) {
24702
+ return configuration.option(itemProps.name, itemInstance.proxy.$refs.btnRef);
24703
+ }
24704
+ return null;
24705
+ }
24691
24706
  }
24692
24707
  );
24693
24708
  }
@@ -24717,11 +24732,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
24717
24732
  disabled: menuDisabled.value(item)
24718
24733
  }, null, 8, ["name", "disabled"]);
24719
24734
  }), 256))
24720
- ], 14, _hoisted_1$1);
24735
+ ], 14, _hoisted_1$2);
24721
24736
  };
24722
24737
  }
24723
24738
  });
24724
- const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-67392864"]]);
24739
+ const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-3a513730"]]);
24725
24740
  const EditifyProps = {
24726
24741
  //国际化语言类型
24727
24742
  locale: {
@@ -24857,6 +24872,13 @@ const EditifyProps = {
24857
24872
  tab: {
24858
24873
  type: Boolean,
24859
24874
  default: true
24875
+ },
24876
+ //插件数组
24877
+ plugins: {
24878
+ type: Array,
24879
+ default: function() {
24880
+ return [];
24881
+ }
24860
24882
  }
24861
24883
  };
24862
24884
  const en_US = {
@@ -24943,7 +24965,14 @@ const en_US = {
24943
24965
  alignJustify: "Align justify",
24944
24966
  defaultLineHeight: "Default",
24945
24967
  auto: "auto",
24946
- fullScreen: "Full screen"
24968
+ fullScreen: "Full screen",
24969
+ //插件语言配置
24970
+ insertAttachment: "Insert attachment",
24971
+ uploadAttachment: "Upload",
24972
+ remoteAttachment: "Remote",
24973
+ attachmentUrlPlaceholder: "Please enter the attachment address",
24974
+ downloadAttachment: "Click to download attachment",
24975
+ attachmentDownloadName: "attachment"
24947
24976
  };
24948
24977
  const zh_CN = {
24949
24978
  textWrapUp: "向上换行",
@@ -25029,18 +25058,25 @@ const zh_CN = {
25029
25058
  alignJustify: "两端对齐",
25030
25059
  defaultLineHeight: "默认行高",
25031
25060
  auto: "自适应",
25032
- fullScreen: "全屏"
25061
+ fullScreen: "全屏",
25062
+ //插件语言配置
25063
+ insertAttachment: "插入附件",
25064
+ uploadAttachment: "上传附件",
25065
+ remoteAttachment: "远程地址",
25066
+ attachmentUrlPlaceholder: "请输入远程地址",
25067
+ downloadAttachment: "点击下载附件",
25068
+ attachmentDownloadName: "附件"
25033
25069
  };
25034
25070
  const trans = (locale) => {
25035
25071
  return (key) => {
25036
25072
  return { zh_CN, en_US }[locale][key];
25037
25073
  };
25038
25074
  };
25039
- const _hoisted_1 = ["data-editify-uid"];
25040
- const _hoisted_2 = ["data-editify-placeholder"];
25041
- const _hoisted_3 = ["value"];
25042
- const _hoisted_4 = { class: "editify-footer-words" };
25043
- const _sfc_main = /* @__PURE__ */ defineComponent({
25075
+ const _hoisted_1$1 = ["data-editify-uid"];
25076
+ const _hoisted_2$1 = ["data-editify-placeholder"];
25077
+ const _hoisted_3$1 = ["value"];
25078
+ const _hoisted_4$1 = { class: "editify-footer-words" };
25079
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25044
25080
  ...{
25045
25081
  name: "editify"
25046
25082
  },
@@ -25112,8 +25148,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25112
25148
  const toolbarConfig = computed(() => {
25113
25149
  return mergeObject(getToolbarConfig($editTrans, props.locale), props.toolbar || {});
25114
25150
  });
25151
+ const pluginResultList = computed(() => {
25152
+ const pluginResultList2 = [];
25153
+ props.plugins.forEach((plugin) => {
25154
+ let pluginResult = plugin(instance, props.color, $editTrans);
25155
+ pluginResultList2.push(pluginResult);
25156
+ });
25157
+ return pluginResultList2;
25158
+ });
25115
25159
  const menuConfig = computed(() => {
25116
- return mergeObject(getMenuConfig($editTrans, props.locale), props.menu || {});
25160
+ let menu = {};
25161
+ pluginResultList.value.forEach((pluginResult) => {
25162
+ menu = mergeObject(menu, pluginResult.menu || {});
25163
+ });
25164
+ menu = mergeObject(menu, props.menu || {});
25165
+ return mergeObject(getMenuConfig($editTrans, props.locale), menu);
25117
25166
  });
25118
25167
  const internalModify = (val) => {
25119
25168
  isModelChange.value = true;
@@ -25215,6 +25264,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25215
25264
  });
25216
25265
  };
25217
25266
  const createEditor = () => {
25267
+ let pluginRules = [];
25268
+ pluginResultList.value.forEach((pluginResult) => {
25269
+ if (pluginResult.renderRule) {
25270
+ pluginRules.push(pluginResult.renderRule);
25271
+ }
25272
+ });
25218
25273
  editor.value = new AlexEditor(contentRef.value, {
25219
25274
  value: value.value,
25220
25275
  disabled: props.disabled,
@@ -25238,6 +25293,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25238
25293
  (el) => {
25239
25294
  specialInblockHandle(editor.value, el);
25240
25295
  },
25296
+ ...pluginRules,
25241
25297
  ...props.renderRules
25242
25298
  ],
25243
25299
  allowCopy: props.allowCopy,
@@ -25378,8 +25434,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25378
25434
  }
25379
25435
  };
25380
25436
  const handleCustomHtmlPaste = async (elements) => {
25381
- const keepStyles = Object.assign(pasteKeepData.styles, props.pasteKeepStyles || {});
25382
- const keepMarks = Object.assign(pasteKeepData.marks, props.pasteKeepMarks || {});
25437
+ let keepStyles = pasteKeepData.styles;
25438
+ let keepMarks = pasteKeepData.marks;
25439
+ pluginResultList.value.forEach((pluginResult) => {
25440
+ keepStyles = Object.assign(keepStyles, pluginResult.pasteKeepStyles || {});
25441
+ keepMarks = Object.assign(keepMarks, pluginResult.pasteKeepMarks || {});
25442
+ });
25443
+ keepStyles = Object.assign(keepStyles, props.pasteKeepStyles || {});
25444
+ keepMarks = Object.assign(keepMarks, props.pasteKeepMarks || {});
25383
25445
  AlexElement.flatElements(elements).forEach((el) => {
25384
25446
  let marks = {};
25385
25447
  let styles = {};
@@ -25401,7 +25463,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25401
25463
  }
25402
25464
  });
25403
25465
  if (typeof props.customHtmlPaste == "function") {
25404
- await props.customHtmlPaste.apply(this, [elements]);
25466
+ await props.customHtmlPaste(elements);
25405
25467
  } else {
25406
25468
  for (let i = 0; i < elements.length; i++) {
25407
25469
  editor.value.insertElement(elements[i], false);
@@ -25432,8 +25494,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25432
25494
  ele.marks = marks;
25433
25495
  }
25434
25496
  }
25497
+ pluginResultList.value.forEach((pluginResult) => {
25498
+ if (pluginResult.customParseNode) {
25499
+ ele = pluginResult.customParseNode(ele);
25500
+ }
25501
+ });
25435
25502
  if (typeof props.customParseNode == "function") {
25436
- ele = props.customParseNode.apply(instance.proxy, [ele]);
25503
+ ele = props.customParseNode(ele);
25437
25504
  }
25438
25505
  return ele;
25439
25506
  };
@@ -25565,6 +25632,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25565
25632
  };
25566
25633
  const handleAfterRender = () => {
25567
25634
  setVideoHeight();
25635
+ pluginResultList.value.forEach((pluginResult) => {
25636
+ if (pluginResult.updateView) {
25637
+ pluginResult.updateView();
25638
+ }
25639
+ });
25568
25640
  emits("updateview");
25569
25641
  };
25570
25642
  const collapseToEnd = () => {
@@ -25719,13 +25791,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25719
25791
  onCompositionstart: _cache[0] || (_cache[0] = ($event) => isInputChinese.value = true),
25720
25792
  onCompositionend: _cache[1] || (_cache[1] = ($event) => isInputChinese.value = false),
25721
25793
  "data-editify-placeholder": _ctx.placeholder
25722
- }, null, 42, _hoisted_2),
25794
+ }, null, 42, _hoisted_2$1),
25723
25795
  isSourceView.value ? (openBlock(), createElementBlock("textarea", {
25724
25796
  key: 0,
25725
25797
  value: value.value,
25726
25798
  readonly: "",
25727
25799
  class: "editify-sourceview"
25728
- }, null, 8, _hoisted_3)) : createCommentVNode("", true),
25800
+ }, null, 8, _hoisted_3$1)) : createCommentVNode("", true),
25729
25801
  createVNode(Toolbar, {
25730
25802
  ref_key: "toolbarRef",
25731
25803
  ref: toolbarRef,
@@ -25736,27 +25808,353 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25736
25808
  config: toolbarConfig.value,
25737
25809
  color: _ctx.color
25738
25810
  }, null, 8, ["modelValue", "node", "type", "config", "color"])
25739
- ], 10, _hoisted_1),
25811
+ ], 10, _hoisted_1$1),
25740
25812
  _ctx.showWordLength ? (openBlock(), createElementBlock("div", {
25741
25813
  key: 1,
25742
25814
  class: normalizeClass(["editify-footer", { "editify-fullscreen": isFullScreen.value && !isSourceView.value }]),
25743
25815
  ref_key: "footerRef",
25744
25816
  ref: footerRef
25745
25817
  }, [
25746
- createElementVNode("div", _hoisted_4, toDisplayString(unref($editTrans)("totalWordCount")) + toDisplayString(textValue.value.length), 1)
25818
+ createElementVNode("div", _hoisted_4$1, toDisplayString(unref($editTrans)("totalWordCount")) + toDisplayString(textValue.value.length), 1)
25747
25819
  ], 2)) : createCommentVNode("", true)
25748
25820
  ], 2);
25749
25821
  };
25750
25822
  }
25751
25823
  });
25752
- const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f87ab8c"]]);
25753
- const version = "0.1.22";
25824
+ const Editify = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-8737320e"]]);
25825
+ const InsertAttachmentProps = {
25826
+ //主题色
25827
+ color: {
25828
+ type: String,
25829
+ default: ""
25830
+ },
25831
+ //可选择的文件类型
25832
+ accept: {
25833
+ type: String,
25834
+ default: null
25835
+ },
25836
+ //支持的类型数组
25837
+ allowedFileType: {
25838
+ type: Array,
25839
+ default: null
25840
+ },
25841
+ //是否支持多选
25842
+ multiple: {
25843
+ type: Boolean,
25844
+ default: false
25845
+ },
25846
+ //单个文件最大值
25847
+ maxSize: {
25848
+ type: Number,
25849
+ default: null
25850
+ },
25851
+ //单个文件最小值
25852
+ minSize: {
25853
+ type: Number,
25854
+ default: null
25855
+ },
25856
+ //是否自定义上传附件
25857
+ customUpload: {
25858
+ type: Function,
25859
+ default: null
25860
+ },
25861
+ //处理上传附件异常
25862
+ handleError: {
25863
+ type: Function,
25864
+ default: null
25865
+ }
25866
+ };
25867
+ const _hoisted_1 = { class: "editify-attachment" };
25868
+ const _hoisted_2 = { class: "editify-attachment-header" };
25869
+ const _hoisted_3 = {
25870
+ key: 0,
25871
+ class: "editify-attachment-remote"
25872
+ };
25873
+ const _hoisted_4 = ["placeholder"];
25874
+ const _hoisted_5 = {
25875
+ key: 1,
25876
+ class: "editify-attachment-upload"
25877
+ };
25878
+ const _hoisted_6 = ["multiple", "accept"];
25879
+ const _sfc_main = /* @__PURE__ */ defineComponent({
25880
+ ...{
25881
+ name: "InsertAttachment"
25882
+ },
25883
+ __name: "insertAttachment",
25884
+ props: InsertAttachmentProps,
25885
+ emits: ["change", "insert"],
25886
+ setup(__props, { emit: __emit }) {
25887
+ const props = __props;
25888
+ const emits = __emit;
25889
+ const $editTrans = inject("$editTrans");
25890
+ const current = ref("upload");
25891
+ const remoteUrl = ref("");
25892
+ const activeStyle = computed(() => {
25893
+ return (name) => {
25894
+ if (current.value == name) {
25895
+ return {
25896
+ color: props.color
25897
+ };
25898
+ }
25899
+ return {};
25900
+ };
25901
+ });
25902
+ const acceptValue = computed(() => {
25903
+ if (props.accept === "rar") {
25904
+ return "application/x-rar-compressed";
25905
+ }
25906
+ if (props.accept === "zip") {
25907
+ return "application/x-zip-compressed";
25908
+ }
25909
+ if (props.accept === "txt") {
25910
+ return "text/plain";
25911
+ }
25912
+ if (props.accept === "image") {
25913
+ return "image/*";
25914
+ }
25915
+ if (props.accept === "video") {
25916
+ return "video/*";
25917
+ }
25918
+ if (props.accept === "audio") {
25919
+ return "aduio/*";
25920
+ }
25921
+ if (props.accept === "html") {
25922
+ return "text/html";
25923
+ }
25924
+ if (props.accept === "doc") {
25925
+ return "application/msword";
25926
+ }
25927
+ if (props.accept === "xml") {
25928
+ return "text/xml";
25929
+ }
25930
+ if (props.accept === "js") {
25931
+ return "text/javascript";
25932
+ }
25933
+ if (props.accept === "json") {
25934
+ return "application/json";
25935
+ }
25936
+ if (props.accept === "ppt") {
25937
+ return "application/vnd.ms-powerpoint";
25938
+ }
25939
+ if (props.accept === "pdf") {
25940
+ return "application/pdf";
25941
+ }
25942
+ });
25943
+ const getSuffix = (file2) => {
25944
+ const index = file2.name.lastIndexOf(".");
25945
+ if (index <= 0) {
25946
+ return "";
25947
+ }
25948
+ return file2.name.substring(index + 1);
25949
+ };
25950
+ const handleInputFocus = (e) => {
25951
+ if (props.color) {
25952
+ e.currentTarget.style.borderColor = props.color;
25953
+ }
25954
+ };
25955
+ const handleInputBlur = (e) => {
25956
+ e.currentTarget.style.borderColor = "";
25957
+ };
25958
+ const insertRemoteAttachment = () => {
25959
+ emits("insert", remoteUrl.value);
25960
+ };
25961
+ const selectFile = async (e) => {
25962
+ const inputEle = e.currentTarget;
25963
+ const files = inputEle.files;
25964
+ if (!files || !files.length) {
25965
+ return;
25966
+ }
25967
+ let filterFiles = [];
25968
+ for (let i = 0; i < files.length; i++) {
25969
+ const file2 = files[i];
25970
+ const suffix = getSuffix(file2);
25971
+ const isMatch = props.allowedFileType && Array.isArray(props.allowedFileType) && props.allowedFileType.length ? props.allowedFileType.some((item) => {
25972
+ return item.toLocaleLowerCase() == suffix.toLocaleLowerCase();
25973
+ }) : true;
25974
+ if (!isMatch) {
25975
+ if (typeof props.handleError == "function") {
25976
+ props.handleError("suffixError", file2);
25977
+ }
25978
+ continue;
25979
+ }
25980
+ if (props.maxSize && file2.size / 1024 > props.maxSize) {
25981
+ if (typeof props.handleError == "function") {
25982
+ props.handleError("maxSizeError", file2);
25983
+ }
25984
+ continue;
25985
+ }
25986
+ if (props.minSize && file2.size / 1024 < props.minSize) {
25987
+ if (typeof props.handleError == "function") {
25988
+ props.handleError("minSizeError", file2);
25989
+ }
25990
+ continue;
25991
+ }
25992
+ filterFiles.push(file2);
25993
+ }
25994
+ if (filterFiles.length) {
25995
+ let attachments = [];
25996
+ if (typeof props.customUpload == "function") {
25997
+ attachments = await props.customUpload(filterFiles) || [];
25998
+ } else {
25999
+ for (let i = 0; i < filterFiles.length; i++) {
26000
+ const url = await file.dataFileToBase64(filterFiles[i]);
26001
+ attachments.push(url);
26002
+ }
26003
+ }
26004
+ attachments.forEach((url) => {
26005
+ emits("insert", url);
26006
+ });
26007
+ }
26008
+ inputEle.value = "";
26009
+ };
26010
+ watch(
26011
+ () => current.value,
26012
+ () => {
26013
+ emits("change");
26014
+ }
26015
+ );
26016
+ return (_ctx, _cache) => {
26017
+ return openBlock(), createElementBlock("div", _hoisted_1, [
26018
+ createElementVNode("div", _hoisted_2, [
26019
+ createElementVNode("div", {
26020
+ onClick: _cache[0] || (_cache[0] = ($event) => current.value = "upload"),
26021
+ class: normalizeClass(["editify-attachment-header-item", { "editify-active": current.value == "upload" }]),
26022
+ style: normalizeStyle(activeStyle.value("upload"))
26023
+ }, toDisplayString(unref($editTrans)("uploadAttachment")), 7),
26024
+ createElementVNode("div", {
26025
+ onClick: _cache[1] || (_cache[1] = ($event) => current.value = "remote"),
26026
+ class: normalizeClass(["editify-attachment-header-item", { "editify-active": current.value == "remote" }]),
26027
+ style: normalizeStyle(activeStyle.value("remote"))
26028
+ }, toDisplayString(unref($editTrans)("remoteAttachment")), 7),
26029
+ createElementVNode("div", {
26030
+ class: normalizeClass(["editify-attachment-header-slider", "editify-" + current.value]),
26031
+ style: normalizeStyle({ backgroundColor: _ctx.color || "" })
26032
+ }, null, 6)
26033
+ ]),
26034
+ current.value == "remote" ? (openBlock(), createElementBlock("div", _hoisted_3, [
26035
+ withDirectives(createElementVNode("input", {
26036
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => remoteUrl.value = $event),
26037
+ placeholder: unref($editTrans)("attachmentUrlPlaceholder"),
26038
+ onBlur: handleInputBlur,
26039
+ onFocus: handleInputFocus
26040
+ }, null, 40, _hoisted_4), [
26041
+ [
26042
+ vModelText,
26043
+ remoteUrl.value,
26044
+ void 0,
26045
+ { trim: true }
26046
+ ]
26047
+ ]),
26048
+ createElementVNode("div", {
26049
+ class: "editify-attachment-remote-footer",
26050
+ style: normalizeStyle({ color: _ctx.color || "" })
26051
+ }, [
26052
+ createElementVNode("span", { onClick: insertRemoteAttachment }, toDisplayString(unref($editTrans)("insert")), 1)
26053
+ ], 4)
26054
+ ])) : (openBlock(), createElementBlock("div", _hoisted_5, [
26055
+ createVNode(Icon, { value: "upload" }),
26056
+ createElementVNode("input", {
26057
+ multiple: _ctx.multiple,
26058
+ accept: acceptValue.value,
26059
+ onChange: selectFile,
26060
+ type: "file"
26061
+ }, null, 40, _hoisted_6)
26062
+ ]))
26063
+ ]);
26064
+ };
26065
+ }
26066
+ });
26067
+ const InsertAttachment = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a2a6e2f3"]]);
26068
+ const attachment = (options) => {
26069
+ if (!common.isObject(options)) {
26070
+ options = {};
26071
+ }
26072
+ const plugin = (editifyInstance, color2, editTrans) => {
26073
+ return {
26074
+ //附件菜单项配置
26075
+ menu: {
26076
+ sequence: {
26077
+ attachment: options.sequence || 100
26078
+ },
26079
+ extends: {
26080
+ attachment: {
26081
+ type: "select",
26082
+ title: options.title || editTrans("insertAttachment"),
26083
+ leftBorder: options.leftBorder,
26084
+ rightBorder: options.rightBorder,
26085
+ default: () => h(Icon, { value: "attachment" }),
26086
+ layer: (_name, btnInstance) => h(InsertAttachment, {
26087
+ color: color2,
26088
+ accept: options.accept,
26089
+ allowedFileType: options.allowedFileType || [],
26090
+ multiple: !!options.multiple,
26091
+ maxSize: options.maxSize,
26092
+ minSize: options.minSize,
26093
+ customUpload: options.customUpload,
26094
+ handleError: options.handleError,
26095
+ onChange: () => {
26096
+ btnInstance.$refs.layerRef.setPosition();
26097
+ },
26098
+ onInsert: (url) => {
26099
+ const attachmentElement = new AlexElement("closed", "span", { "data-attachment": url, contenteditable: "false" }, null, null);
26100
+ const editor = editifyInstance.exposed.editor.value;
26101
+ editor.insertElement(attachmentElement);
26102
+ editor.range.anchor.moveToEnd(attachmentElement);
26103
+ editor.range.focus.moveToEnd(attachmentElement);
26104
+ editor.formatElementStack();
26105
+ editor.domRender();
26106
+ editor.rangeRender();
26107
+ btnInstance.show = false;
26108
+ }
26109
+ })
26110
+ }
26111
+ }
26112
+ },
26113
+ //找到附件元素点击下载
26114
+ updateView: () => {
26115
+ const editor = editifyInstance.exposed.editor.value;
26116
+ AlexElement.flatElements(editor.stack).forEach((el) => {
26117
+ if (el.parsedom == "span" && el.hasMarks() && el.marks["data-attachment"]) {
26118
+ event.off(el.elm, "click");
26119
+ event.on(el.elm, "click", () => {
26120
+ const url = el.marks["data-attachment"];
26121
+ const a = document.createElement("a");
26122
+ a.setAttribute("href", url);
26123
+ a.setAttribute("download", editTrans("attachmentDownloadName"));
26124
+ a.click();
26125
+ });
26126
+ }
26127
+ });
26128
+ },
26129
+ //span含有data-attachment的元素设为自闭合元素
26130
+ customParseNode: (el) => {
26131
+ if (el.hasMarks() && el.marks["data-attachment"] && el.parsedom == "span") {
26132
+ el.type = "closed";
26133
+ }
26134
+ return el;
26135
+ },
26136
+ //span元素粘贴保留data-attachment
26137
+ pasteKeepMarks: {
26138
+ "data-attachment": ["span"]
26139
+ },
26140
+ //设置元素的title属性标记
26141
+ renderRule: (el) => {
26142
+ if (el.type == "closed" && el.hasMarks() && el.marks["data-attachment"]) {
26143
+ el.marks["title"] = editTrans("downloadAttachment");
26144
+ }
26145
+ }
26146
+ };
26147
+ };
26148
+ return plugin;
26149
+ };
25754
26150
  const install = (app) => {
25755
26151
  app.component(Editify.name, Editify);
25756
26152
  };
26153
+ const version = "0.1.23";
25757
26154
  export {
25758
26155
  AlexElement,
25759
26156
  Editify,
26157
+ attachment,
25760
26158
  install as default,
25761
26159
  elementIsInList,
25762
26160
  elementIsInTask,