vue-editify 0.1.26 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -549,6 +549,7 @@ declare const _default: import('vue').DefineComponent<{
549
549
  blur: (...args: any[]) => void;
550
550
  focus: (...args: any[]) => void;
551
551
  keydown: (...args: any[]) => void;
552
+ keyup: (...args: any[]) => void;
552
553
  insertparagraph: (...args: any[]) => void;
553
554
  rangeupdate: (...args: any[]) => void;
554
555
  updateview: (...args: any[]) => void;
@@ -667,6 +668,7 @@ declare const _default: import('vue').DefineComponent<{
667
668
  onBlur?: ((...args: any[]) => any) | undefined;
668
669
  onChange?: ((...args: any[]) => any) | undefined;
669
670
  onKeydown?: ((...args: any[]) => any) | undefined;
671
+ onKeyup?: ((...args: any[]) => any) | undefined;
670
672
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
671
673
  onInsertparagraph?: ((...args: any[]) => any) | undefined;
672
674
  onRangeupdate?: ((...args: any[]) => any) | undefined;
package/lib/editify.es.js CHANGED
@@ -2987,35 +2987,40 @@ const handleChineseInput = function(e) {
2987
2987
  }, 0);
2988
2988
  }
2989
2989
  };
2990
- const handleKeydown = function(e) {
2990
+ const handleKeyboard = function(e) {
2991
2991
  if (this.disabled) {
2992
2992
  return;
2993
2993
  }
2994
2994
  if (this.__isInputChinese) {
2995
2995
  return;
2996
2996
  }
2997
- if (isUndo(e)) {
2998
- e.preventDefault();
2999
- const historyRecord = this.history.get(-1);
3000
- if (historyRecord) {
3001
- this.history.current = historyRecord.current;
3002
- this.stack = historyRecord.stack;
3003
- this.range = historyRecord.range;
3004
- this.formatElementStack();
3005
- this.domRender(true);
3006
- this.rangeRender();
3007
- }
3008
- } else if (isRedo(e)) {
3009
- e.preventDefault();
3010
- const historyRecord = this.history.get(1);
3011
- if (historyRecord) {
3012
- this.history.current = historyRecord.current;
3013
- this.stack = historyRecord.stack;
3014
- this.range = historyRecord.range;
3015
- this.formatElementStack();
3016
- this.domRender(true);
3017
- this.rangeRender();
2997
+ if (e.type == "keydown") {
2998
+ if (isUndo(e)) {
2999
+ e.preventDefault();
3000
+ const historyRecord = this.history.get(-1);
3001
+ if (historyRecord) {
3002
+ this.history.current = historyRecord.current;
3003
+ this.stack = historyRecord.stack;
3004
+ this.range = historyRecord.range;
3005
+ this.formatElementStack();
3006
+ this.domRender(true);
3007
+ this.rangeRender();
3008
+ }
3009
+ } else if (isRedo(e)) {
3010
+ e.preventDefault();
3011
+ const historyRecord = this.history.get(1);
3012
+ if (historyRecord) {
3013
+ this.history.current = historyRecord.current;
3014
+ this.stack = historyRecord.stack;
3015
+ this.range = historyRecord.range;
3016
+ this.formatElementStack();
3017
+ this.domRender(true);
3018
+ this.rangeRender();
3019
+ }
3018
3020
  }
3021
+ this.emit("keydown", this.value, e);
3022
+ } else if (e.type == "keyup") {
3023
+ this.emit("keyup", this.value, e);
3019
3024
  }
3020
3025
  };
3021
3026
  const handleCopy = async function(e) {
@@ -3100,17 +3105,17 @@ const handleDragDrop = async function(e) {
3100
3105
  }
3101
3106
  }
3102
3107
  };
3103
- const handleFocus = function() {
3108
+ const handleFocus = function(e) {
3104
3109
  if (this.disabled) {
3105
3110
  return;
3106
3111
  }
3107
- this.emit("focus", this.value);
3112
+ this.emit("focus", this.value, e);
3108
3113
  };
3109
- const handleBlur = function() {
3114
+ const handleBlur = function(e) {
3110
3115
  if (this.disabled) {
3111
3116
  return;
3112
3117
  }
3113
- this.emit("blur", this.value);
3118
+ this.emit("blur", this.value, e);
3114
3119
  };
3115
3120
  class AlexEditor {
3116
3121
  constructor(node, opts) {
@@ -3160,7 +3165,7 @@ class AlexEditor {
3160
3165
  event$1.on(document, `selectionchange.alex_editor_${this.__guid}`, handleSelectionChange.bind(this));
3161
3166
  event$1.on(this.$el, "beforeinput.alex_editor", handleBeforeInput.bind(this));
3162
3167
  event$1.on(this.$el, "compositionstart.alex_editor compositionupdate.alex_editor compositionend.alex_editor", handleChineseInput.bind(this));
3163
- event$1.on(this.$el, "keydown.alex_editor", handleKeydown.bind(this));
3168
+ event$1.on(this.$el, "keydown.alex_editor keyup.alex_editor", handleKeyboard.bind(this));
3164
3169
  event$1.on(this.$el, "cut.alex_editor", handleCut.bind(this));
3165
3170
  event$1.on(this.$el, "paste.alex_editor", handlePaste.bind(this));
3166
3171
  event$1.on(this.$el, "copy.alex_editor", handleCopy.bind(this));
@@ -4491,6 +4496,8 @@ class AlexEditor {
4491
4496
  event$1.off(this.$el, "beforeinput.alex_editor compositionstart.alex_editor compositionupdate.alex_editor compositionend.alex_editor keydown.alex_editor cut.alex_editor paste.alex_editor copy.alex_editor dragstart.alex_editor drop.alex_editor focus.alex_editor blur.alex_editor");
4492
4497
  }
4493
4498
  }
4499
+ const version$2 = "1.3.32";
4500
+ console.log(`%c alex-editor %c v${version$2} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;");
4494
4501
  const number = {
4495
4502
  /**
4496
4503
  * 数字格式化
@@ -23268,7 +23275,7 @@ const _hoisted_4$2 = [
23268
23275
  ];
23269
23276
  const _hoisted_5$1 = { class: "editify-table-footer" };
23270
23277
  const _hoisted_6$1 = { key: 0 };
23271
- const _hoisted_7 = { key: 1 };
23278
+ const _hoisted_7$1 = { key: 1 };
23272
23279
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23273
23280
  ...{
23274
23281
  name: "InsertTable"
@@ -23344,7 +23351,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23344
23351
  }), 256))
23345
23352
  ]),
23346
23353
  createElementVNode("div", _hoisted_5$1, [
23347
- 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))
23354
+ specification.value ? (openBlock(), createElementBlock("span", _hoisted_6$1, toDisplayString(specification.value.x) + " x " + toDisplayString(specification.value.y), 1)) : (openBlock(), createElementBlock("span", _hoisted_7$1, toDisplayString(unref($editTrans)("insertTable")), 1))
23348
23355
  ])
23349
23356
  ]);
23350
23357
  };
@@ -24941,9 +24948,10 @@ const en_US = {
24941
24948
  insertAttachment: "Insert attachment",
24942
24949
  uploadAttachment: "Upload",
24943
24950
  remoteAttachment: "Remote",
24951
+ attachmentNamePlaceholder: "Please enter the attachment name",
24944
24952
  attachmentUrlPlaceholder: "Please enter the attachment address",
24945
- downloadAttachment: "Click to download attachment",
24946
- attachmentDownloadName: "attachment"
24953
+ attachmentDownloadTitle: "Click to download attachment",
24954
+ attachmentDefaultName: "attachment"
24947
24955
  };
24948
24956
  const zh_CN = {
24949
24957
  textWrapUp: "向上换行",
@@ -25034,9 +25042,10 @@ const zh_CN = {
25034
25042
  insertAttachment: "插入附件",
25035
25043
  uploadAttachment: "上传附件",
25036
25044
  remoteAttachment: "远程地址",
25037
- attachmentUrlPlaceholder: "请输入远程地址",
25038
- downloadAttachment: "点击下载附件",
25039
- attachmentDownloadName: "附件"
25045
+ attachmentNamePlaceholder: "请输入附件名称",
25046
+ attachmentUrlPlaceholder: "请输入附件地址",
25047
+ attachmentDownloadTitle: "点击下载附件",
25048
+ attachmentDefaultName: "附件"
25040
25049
  };
25041
25050
  const trans = (locale) => {
25042
25051
  return (key) => {
@@ -25053,7 +25062,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25053
25062
  },
25054
25063
  __name: "editify",
25055
25064
  props: EditifyProps,
25056
- emits: ["update:modelValue", "focus", "blur", "change", "keydown", "insertparagraph", "rangeupdate", "updateview"],
25065
+ emits: ["update:modelValue", "focus", "blur", "change", "keydown", "keyup", "insertparagraph", "rangeupdate", "updateview"],
25057
25066
  setup(__props, { expose: __expose, emit: __emit }) {
25058
25067
  const instance = getCurrentInstance();
25059
25068
  const props = __props;
@@ -25283,6 +25292,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25283
25292
  editor.value.on("change", handleEditorChange);
25284
25293
  editor.value.on("focus", handleEditorFocus);
25285
25294
  editor.value.on("blur", handleEditorBlur);
25295
+ editor.value.on("keydown", handleEditorKeydown);
25296
+ editor.value.on("keyup", handleEditorKeyup);
25286
25297
  editor.value.on("insertParagraph", handleInsertParagraph);
25287
25298
  editor.value.on("rangeUpdate", handleRangeUpdate);
25288
25299
  editor.value.on("deleteInStart", handleDeleteInStart);
@@ -25475,7 +25486,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25475
25486
  }
25476
25487
  return ele;
25477
25488
  };
25478
- const handleEditorKeydown = (e) => {
25489
+ const handleEditorKeydown = (val, e) => {
25479
25490
  if (props.disabled) {
25480
25491
  return;
25481
25492
  }
@@ -25486,7 +25497,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25486
25497
  editor.value.domRender();
25487
25498
  editor.value.rangeRender();
25488
25499
  }
25489
- emits("keydown", e);
25500
+ emits("keydown", val, e);
25501
+ };
25502
+ const handleEditorKeyup = (val, e) => {
25503
+ if (props.disabled) {
25504
+ return;
25505
+ }
25506
+ emits("keyup", val, e);
25490
25507
  };
25491
25508
  const handleEditorClick = (e) => {
25492
25509
  if (props.disabled || isSourceView.value) {
@@ -25551,7 +25568,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25551
25568
  };
25552
25569
  const handleInsertParagraph = (element2, previousElement) => {
25553
25570
  if (!element2.isEqual(previousElement)) {
25554
- if (previousElement.isOnlyHasBreak() && element2.isOnlyHasBreak()) {
25571
+ if (previousElement.isBlock() && element2.isBlock() && previousElement.isOnlyHasBreak() && element2.isOnlyHasBreak()) {
25555
25572
  if (previousElement.parsedom != AlexElement.BLOCK_NODE) {
25556
25573
  elementToParagraph(previousElement);
25557
25574
  editor.value.range.anchor.moveToStart(previousElement);
@@ -25757,7 +25774,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25757
25774
  ref_key: "contentRef",
25758
25775
  ref: contentRef,
25759
25776
  class: normalizeClass(["editify-content", { "editify-placeholder": showPlaceholder.value, "editify-disabled": _ctx.disabled }]),
25760
- onKeydown: handleEditorKeydown,
25761
25777
  onClick: handleEditorClick,
25762
25778
  onCompositionstart: _cache[0] || (_cache[0] = ($event) => isInputChinese.value = true),
25763
25779
  onCompositionend: _cache[1] || (_cache[1] = ($event) => isInputChinese.value = false),
@@ -25792,7 +25808,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25792
25808
  };
25793
25809
  }
25794
25810
  });
25795
- const Editify = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-8737320e"]]);
25811
+ const Editify = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3b2e5bbc"]]);
25796
25812
  const InsertAttachmentProps = {
25797
25813
  //主题色
25798
25814
  color: {
@@ -25842,11 +25858,13 @@ const _hoisted_3 = {
25842
25858
  class: "editify-attachment-remote"
25843
25859
  };
25844
25860
  const _hoisted_4 = ["placeholder"];
25845
- const _hoisted_5 = {
25861
+ const _hoisted_5 = ["placeholder"];
25862
+ const _hoisted_6 = {
25846
25863
  key: 1,
25847
25864
  class: "editify-attachment-upload"
25848
25865
  };
25849
- const _hoisted_6 = ["multiple", "accept"];
25866
+ const _hoisted_7 = ["placeholder"];
25867
+ const _hoisted_8 = ["multiple", "accept"];
25850
25868
  const _sfc_main = /* @__PURE__ */ defineComponent({
25851
25869
  ...{
25852
25870
  name: "InsertAttachment"
@@ -25859,7 +25877,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25859
25877
  const emits = __emit;
25860
25878
  const $editTrans = inject("$editTrans");
25861
25879
  const current = ref("upload");
25862
- const remoteUrl = ref("");
25880
+ const attachmentName = ref("");
25881
+ const attachmentUrl = ref("");
25882
+ const fileInputRef = ref(null);
25863
25883
  const activeStyle = computed(() => {
25864
25884
  return (name) => {
25865
25885
  if (current.value == name) {
@@ -25870,47 +25890,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25870
25890
  return {};
25871
25891
  };
25872
25892
  });
25873
- const acceptValue = computed(() => {
25874
- if (props.accept === "rar") {
25875
- return "application/x-rar-compressed";
25876
- }
25877
- if (props.accept === "zip") {
25878
- return "application/x-zip-compressed";
25879
- }
25880
- if (props.accept === "txt") {
25881
- return "text/plain";
25882
- }
25883
- if (props.accept === "image") {
25884
- return "image/*";
25885
- }
25886
- if (props.accept === "video") {
25887
- return "video/*";
25888
- }
25889
- if (props.accept === "audio") {
25890
- return "aduio/*";
25891
- }
25892
- if (props.accept === "html") {
25893
- return "text/html";
25894
- }
25895
- if (props.accept === "doc") {
25896
- return "application/msword";
25897
- }
25898
- if (props.accept === "xml") {
25899
- return "text/xml";
25900
- }
25901
- if (props.accept === "js") {
25902
- return "text/javascript";
25903
- }
25904
- if (props.accept === "json") {
25905
- return "application/json";
25906
- }
25907
- if (props.accept === "ppt") {
25908
- return "application/vnd.ms-powerpoint";
25909
- }
25910
- if (props.accept === "pdf") {
25911
- return "application/pdf";
25912
- }
25913
- });
25914
25893
  const getSuffix = (file2) => {
25915
25894
  const index = file2.name.lastIndexOf(".");
25916
25895
  if (index <= 0) {
@@ -25927,11 +25906,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25927
25906
  e.currentTarget.style.borderColor = "";
25928
25907
  };
25929
25908
  const insertRemoteAttachment = () => {
25930
- emits("insert", remoteUrl.value);
25909
+ emits("insert", attachmentName.value, attachmentUrl.value);
25931
25910
  };
25932
- const selectFile = async (e) => {
25933
- const inputEle = e.currentTarget;
25934
- const files = inputEle.files;
25911
+ const triggerFileInput = () => {
25912
+ fileInputRef.value.click();
25913
+ };
25914
+ const selectFile = async () => {
25915
+ const files = fileInputRef.value.files;
25935
25916
  if (!files || !files.length) {
25936
25917
  return;
25937
25918
  }
@@ -25973,10 +25954,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
25973
25954
  }
25974
25955
  }
25975
25956
  attachments.forEach((url) => {
25976
- emits("insert", url);
25957
+ emits("insert", attachmentName.value, url);
25977
25958
  });
25978
25959
  }
25979
- inputEle.value = "";
25960
+ fileInputRef.value.value = "";
25980
25961
  };
25981
25962
  watch(
25982
25963
  () => current.value,
@@ -26004,14 +25985,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26004
25985
  ]),
26005
25986
  current.value == "remote" ? (openBlock(), createElementBlock("div", _hoisted_3, [
26006
25987
  withDirectives(createElementVNode("input", {
26007
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => remoteUrl.value = $event),
26008
- placeholder: unref($editTrans)("attachmentUrlPlaceholder"),
25988
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => attachmentName.value = $event),
25989
+ placeholder: unref($editTrans)("attachmentNamePlaceholder"),
26009
25990
  onBlur: handleInputBlur,
26010
- onFocus: handleInputFocus
25991
+ onFocus: handleInputFocus,
25992
+ type: "text"
26011
25993
  }, null, 40, _hoisted_4), [
26012
25994
  [
26013
25995
  vModelText,
26014
- remoteUrl.value,
25996
+ attachmentName.value,
25997
+ void 0,
25998
+ { trim: true }
25999
+ ]
26000
+ ]),
26001
+ withDirectives(createElementVNode("input", {
26002
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => attachmentUrl.value = $event),
26003
+ placeholder: unref($editTrans)("attachmentUrlPlaceholder"),
26004
+ onBlur: handleInputBlur,
26005
+ onFocus: handleInputFocus,
26006
+ type: "url"
26007
+ }, null, 40, _hoisted_5), [
26008
+ [
26009
+ vModelText,
26010
+ attachmentUrl.value,
26015
26011
  void 0,
26016
26012
  { trim: true }
26017
26013
  ]
@@ -26022,20 +26018,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26022
26018
  }, [
26023
26019
  createElementVNode("span", { onClick: insertRemoteAttachment }, toDisplayString(unref($editTrans)("insert")), 1)
26024
26020
  ], 4)
26025
- ])) : (openBlock(), createElementBlock("div", _hoisted_5, [
26026
- createVNode(Icon, { value: "upload" }),
26027
- createElementVNode("input", {
26028
- multiple: _ctx.multiple,
26029
- accept: acceptValue.value,
26030
- onChange: selectFile,
26031
- type: "file"
26032
- }, null, 40, _hoisted_6)
26021
+ ])) : (openBlock(), createElementBlock("div", _hoisted_6, [
26022
+ withDirectives(createElementVNode("input", {
26023
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => attachmentName.value = $event),
26024
+ placeholder: unref($editTrans)("attachmentNamePlaceholder"),
26025
+ onBlur: handleInputBlur,
26026
+ onFocus: handleInputFocus,
26027
+ type: "text"
26028
+ }, null, 40, _hoisted_7), [
26029
+ [
26030
+ vModelText,
26031
+ attachmentName.value,
26032
+ void 0,
26033
+ { trim: true }
26034
+ ]
26035
+ ]),
26036
+ createElementVNode("div", {
26037
+ class: "editify-attachment-btn",
26038
+ onClick: triggerFileInput
26039
+ }, [
26040
+ createVNode(Icon, { value: "upload" }),
26041
+ createElementVNode("input", {
26042
+ ref_key: "fileInputRef",
26043
+ ref: fileInputRef,
26044
+ multiple: _ctx.multiple,
26045
+ accept: _ctx.accept,
26046
+ onChange: selectFile,
26047
+ type: "file"
26048
+ }, null, 40, _hoisted_8)
26049
+ ])
26033
26050
  ]))
26034
26051
  ]);
26035
26052
  };
26036
26053
  }
26037
26054
  });
26038
- const InsertAttachment = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a2a6e2f3"]]);
26055
+ const InsertAttachment = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f995f4bd"]]);
26039
26056
  const attachment = (options) => {
26040
26057
  if (!common.isObject(options)) {
26041
26058
  options = {};
@@ -26053,6 +26070,7 @@ const attachment = (options) => {
26053
26070
  title: options.title || editTrans("insertAttachment"),
26054
26071
  leftBorder: options.leftBorder,
26055
26072
  rightBorder: options.rightBorder,
26073
+ hideScroll: true,
26056
26074
  disabled: editifyInstance.exposed.editor.value ? hasPreInRange(editifyInstance.exposed.editor.value, editifyInstance.exposed.dataRangeCaches.value) : false,
26057
26075
  default: () => h(Icon, { value: "attachment" }),
26058
26076
  layer: (_name, btnInstance) => h(InsertAttachment, {
@@ -26067,24 +26085,26 @@ const attachment = (options) => {
26067
26085
  onChange: () => {
26068
26086
  btnInstance.$refs.layerRef.setPosition();
26069
26087
  },
26070
- onInsert: (url) => {
26071
- const marks = {
26072
- "data-attachment": url,
26073
- "data-attachment-name": editTrans("attachmentDownloadName"),
26074
- contenteditable: "false"
26075
- };
26076
- const attachmentElement = new AlexElement("closed", "span", marks, null, null);
26077
- const editor = editifyInstance.exposed.editor.value;
26078
- editor.insertElement(attachmentElement);
26079
- const beforeText = AlexElement.getSpaceElement();
26080
- const afterText = AlexElement.getSpaceElement();
26081
- editor.addElementAfter(afterText, attachmentElement);
26082
- editor.addElementBefore(beforeText, attachmentElement);
26083
- editor.range.anchor.moveToStart(afterText);
26084
- editor.range.focus.moveToStart(afterText);
26085
- editor.formatElementStack();
26086
- editor.domRender();
26087
- editor.rangeRender();
26088
+ onInsert: (name, url) => {
26089
+ if (url) {
26090
+ const marks = {
26091
+ "data-attachment": url,
26092
+ "data-attachment-name": name || editTrans("attachmentDefaultName"),
26093
+ contenteditable: "false"
26094
+ };
26095
+ const attachmentElement = new AlexElement("closed", "span", marks, null, null);
26096
+ const editor = editifyInstance.exposed.editor.value;
26097
+ editor.insertElement(attachmentElement);
26098
+ const beforeText = AlexElement.getSpaceElement();
26099
+ const afterText = AlexElement.getSpaceElement();
26100
+ editor.addElementAfter(afterText, attachmentElement);
26101
+ editor.addElementBefore(beforeText, attachmentElement);
26102
+ editor.range.anchor.moveToStart(afterText);
26103
+ editor.range.focus.moveToStart(afterText);
26104
+ editor.formatElementStack();
26105
+ editor.domRender();
26106
+ editor.rangeRender();
26107
+ }
26088
26108
  btnInstance.show = false;
26089
26109
  }
26090
26110
  })
@@ -26097,11 +26117,16 @@ const attachment = (options) => {
26097
26117
  AlexElement.flatElements(editor.stack).forEach((el) => {
26098
26118
  if (el.parsedom == "span" && el.hasMarks() && el.marks["data-attachment"]) {
26099
26119
  event.off(el.elm, "click");
26100
- event.on(el.elm, "click", () => {
26120
+ event.on(el.elm, "click", async () => {
26101
26121
  const url = el.marks["data-attachment"];
26122
+ const res = await fetch(url, {
26123
+ method: "GET"
26124
+ });
26125
+ const blob = await res.blob();
26102
26126
  const a = document.createElement("a");
26103
- a.setAttribute("href", url);
26104
- a.setAttribute("download", editTrans("attachmentDownloadName"));
26127
+ a.setAttribute("target", "_blank");
26128
+ a.setAttribute("href", URL.createObjectURL(blob));
26129
+ a.setAttribute("download", el.marks["data-attachment-name"]);
26105
26130
  a.click();
26106
26131
  });
26107
26132
  }
@@ -26122,7 +26147,7 @@ const attachment = (options) => {
26122
26147
  //自定义渲染规范
26123
26148
  renderRule: (el) => {
26124
26149
  if (el.type == "closed" && el.hasMarks() && el.marks["data-attachment"]) {
26125
- el.marks["title"] = editTrans("downloadAttachment");
26150
+ el.marks["title"] = editTrans("attachmentDownloadTitle");
26126
26151
  const editor = editifyInstance.exposed.editor.value;
26127
26152
  const previousElement = editor.getPreviousElement(el);
26128
26153
  const newTextElement = editor.getNextElement(el);
@@ -26143,7 +26168,8 @@ const attachment = (options) => {
26143
26168
  const install = (app) => {
26144
26169
  app.component(Editify.name, Editify);
26145
26170
  };
26146
- const version = "0.1.26";
26171
+ const version = "0.1.27";
26172
+ console.log(`%c vue-editify %c v${version} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;");
26147
26173
  export {
26148
26174
  AlexElement,
26149
26175
  Editify,