vue-editify 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
package/examples/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createApp } from 'vue'
2
- import App from './App.vue'
3
- import Editify from '../src'
4
- createApp(App).use(Editify, { locale: 'zh_CN' }).mount('#app')
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+ import Editify from '../src'
4
+ createApp(App).use(Editify, { locale: 'zh_CN' }).mount('#app')
package/lib/editify.es.js CHANGED
@@ -2263,14 +2263,14 @@ const inlineParse = [
2263
2263
  ];
2264
2264
  const handleNotStackBlock = function(element2) {
2265
2265
  if (element2.hasChildren()) {
2266
- const children = element2.children.filter((el) => {
2267
- return !el.isEmpty();
2268
- });
2269
- const blocks = children.filter((el) => {
2270
- return el.isBlock();
2266
+ const blocks = element2.children.filter((el) => {
2267
+ return !el.isEmpty() && el.isBlock();
2271
2268
  });
2272
2269
  blocks.forEach((el) => {
2273
2270
  el.type = element2.type == "inline" ? "inline" : "inblock";
2271
+ if (el.type == "inblock") {
2272
+ el.behavior = "block";
2273
+ }
2274
2274
  });
2275
2275
  }
2276
2276
  };
@@ -2279,30 +2279,23 @@ const handleInblockWithOther = function(element2) {
2279
2279
  const children = element2.children.filter((el) => {
2280
2280
  return !el.isEmpty();
2281
2281
  });
2282
- let allIsBlock = children.every((el) => {
2282
+ const inblocks = children.filter((el) => {
2283
2283
  return el.isInblock();
2284
2284
  });
2285
- if (!allIsBlock) {
2286
- children.forEach((el) => {
2287
- if (el.isInblock()) {
2288
- el.type = "inline";
2289
- }
2285
+ if (inblocks.length && inblocks.length != children.length) {
2286
+ inblocks.forEach((el) => {
2287
+ el.type = "inline";
2290
2288
  });
2291
2289
  }
2292
2290
  }
2293
2291
  };
2294
2292
  const handleInlineChildrenNotInblock = function(element2) {
2295
2293
  if (element2.isInline() && element2.hasChildren()) {
2296
- const children = element2.children.filter((el) => {
2297
- return !el.isEmpty();
2298
- });
2299
- const inblocks = children.filter((el) => {
2300
- return el.isInblock();
2294
+ const inblocks = element2.children.filter((el) => {
2295
+ return !el.isEmpty() && el.isInblock();
2301
2296
  });
2302
2297
  inblocks.forEach((el) => {
2303
- if (el.isInblock()) {
2304
- el.type = "inline";
2305
- }
2298
+ el.type = "inline";
2306
2299
  });
2307
2300
  }
2308
2301
  };
@@ -2311,23 +2304,20 @@ const breakFormat = function(element2) {
2311
2304
  const children = element2.children.filter((el) => {
2312
2305
  return !el.isEmpty();
2313
2306
  });
2314
- const allIsBreak = children.every((el) => {
2307
+ const breaks = children.filter((el) => {
2315
2308
  return el.isBreak();
2316
2309
  });
2317
- if (allIsBreak && children.length) {
2318
- const breakEl = children[0];
2310
+ if (breaks.length && breaks.length == children.length) {
2319
2311
  if (this.range && element2.isContains(this.range.anchor.element)) {
2320
- this.range.anchor.moveToStart(breakEl);
2312
+ this.range.anchor.moveToStart(breaks[0]);
2321
2313
  }
2322
2314
  if (this.range && element2.isContains(this.range.focus.element)) {
2323
- this.range.focus.moveToStart(breakEl);
2315
+ this.range.focus.moveToStart(breaks[0]);
2324
2316
  }
2325
- element2.children = [breakEl];
2326
- } else {
2327
- element2.children.forEach((el) => {
2328
- if (el.isBreak()) {
2329
- el.toEmpty();
2330
- }
2317
+ element2.children = [breaks[0]];
2318
+ } else if (breaks.length) {
2319
+ breaks.forEach((el) => {
2320
+ el.toEmpty();
2331
2321
  });
2332
2322
  }
2333
2323
  }
@@ -2487,11 +2477,15 @@ const mergeWithParentElement = function(element2) {
2487
2477
  item.parent = parent;
2488
2478
  });
2489
2479
  }
2480
+ mergeElement(parent);
2490
2481
  }
2491
2482
  };
2492
- if (element2.hasChildren() && element2.children.length == 1 && canMerge(element2, element2.children[0])) {
2493
- merge(element2, element2.children[0]);
2494
- }
2483
+ const mergeElement = (ele) => {
2484
+ if (ele.hasChildren() && ele.children.length == 1 && canMerge(ele, ele.children[0])) {
2485
+ merge(ele, ele.children[0]);
2486
+ }
2487
+ };
2488
+ mergeElement(element2);
2495
2489
  };
2496
2490
  const { Mac } = platform.os();
2497
2491
  const isUndo = function(e) {
@@ -2576,7 +2570,7 @@ const setRangeInVisible = function() {
2576
2570
  const childRect = target.getBoundingClientRect();
2577
2571
  const parentRect = root.getBoundingClientRect();
2578
2572
  if (root.clientHeight < scrollHeight) {
2579
- if (childRect.bottom < parentRect.top) {
2573
+ if (childRect.top < parentRect.top) {
2580
2574
  await element$1.setScrollTop({
2581
2575
  el: root,
2582
2576
  number: 0
@@ -2587,7 +2581,7 @@ const setRangeInVisible = function() {
2587
2581
  el: root,
2588
2582
  number: tempChildRect.top - tempParentRect.top
2589
2583
  });
2590
- } else if (childRect.top > parentRect.bottom) {
2584
+ } else if (childRect.bottom > parentRect.bottom) {
2591
2585
  await element$1.setScrollTop({
2592
2586
  el: root,
2593
2587
  number: 0
@@ -2601,7 +2595,7 @@ const setRangeInVisible = function() {
2601
2595
  }
2602
2596
  }
2603
2597
  if (root.clientWidth < scrollWidth) {
2604
- if (childRect.right < parentRect.left) {
2598
+ if (childRect.left < parentRect.left) {
2605
2599
  await element$1.setScrollLeft({
2606
2600
  el: root,
2607
2601
  number: 0
@@ -2612,7 +2606,7 @@ const setRangeInVisible = function() {
2612
2606
  el: root,
2613
2607
  number: tempChildRect.left - tempParentRect.left + 20
2614
2608
  });
2615
- } else if (childRect.left > parentRect.right) {
2609
+ } else if (childRect.right > parentRect.right) {
2616
2610
  await element$1.setScrollLeft({
2617
2611
  el: root,
2618
2612
  number: 0
@@ -2644,8 +2638,10 @@ const handleStackEmpty = function() {
2644
2638
  const breakEle = new AlexElement("closed", "br", null, null, null);
2645
2639
  this.addElementTo(breakEle, ele);
2646
2640
  this.stack = [ele];
2647
- this.range.anchor.moveToStart(breakEle);
2648
- this.range.focus.moveToStart(breakEle);
2641
+ if (this.range) {
2642
+ this.range.anchor.moveToStart(breakEle);
2643
+ this.range.focus.moveToStart(breakEle);
2644
+ }
2649
2645
  }
2650
2646
  };
2651
2647
  const handleSelectionChange = function() {
@@ -2883,6 +2879,67 @@ class AlexEditor {
2883
2879
  const focus = new AlexPoint(firstElement, 0);
2884
2880
  this.range = new AlexRange(anchor, focus);
2885
2881
  }
2882
+ /**
2883
+ * 根据光标执行复制操作
2884
+ * isCut表示是否在执行剪切操作,默认为false,这个参数仅在内部使用
2885
+ */
2886
+ async copy(isCut = false) {
2887
+ if (!this.useClipboard) {
2888
+ return;
2889
+ }
2890
+ if (!this.range) {
2891
+ return;
2892
+ }
2893
+ if (!this.allowCopy) {
2894
+ return;
2895
+ }
2896
+ let result = this.getElementsByRange().list;
2897
+ if (result.length == 0) {
2898
+ return;
2899
+ }
2900
+ let html = "";
2901
+ let text = "";
2902
+ result.forEach((item) => {
2903
+ const newEl = item.element.clone();
2904
+ if (item.offset) {
2905
+ newEl.textContent = newEl.textContent.substring(item.offset[0], item.offset[1]);
2906
+ }
2907
+ newEl.__render();
2908
+ html += newEl.elm.outerHTML;
2909
+ text += newEl.elm.innerText;
2910
+ });
2911
+ const clipboardItem = new window.ClipboardItem({
2912
+ "text/html": new Blob([html], { type: "text/html" }),
2913
+ "text/plain": new Blob([text], { type: "text/plain" })
2914
+ });
2915
+ await navigator.clipboard.write([clipboardItem]);
2916
+ if (!isCut) {
2917
+ this.emit("copy", text, html);
2918
+ }
2919
+ return { text, html };
2920
+ }
2921
+ /**
2922
+ * 根据光标进行剪切操作
2923
+ */
2924
+ async cut() {
2925
+ if (!this.useClipboard) {
2926
+ return;
2927
+ }
2928
+ if (!this.range) {
2929
+ return;
2930
+ }
2931
+ if (!this.allowCut) {
2932
+ return;
2933
+ }
2934
+ const result = await this.copy(true);
2935
+ if (result) {
2936
+ if (!this.disabled) {
2937
+ this.delete();
2938
+ }
2939
+ this.emit("cut", result.text, result.html);
2940
+ }
2941
+ return result;
2942
+ }
2886
2943
  /**
2887
2944
  * 根据光标进行粘贴操作
2888
2945
  */
@@ -2933,7 +2990,6 @@ class AlexEditor {
2933
2990
  await this.customHtmlPaste.apply(this, [elements, data2]);
2934
2991
  } else {
2935
2992
  for (let i2 = 0; i2 < elements.length; i2++) {
2936
- this.formatElement(elements[i2]);
2937
2993
  this.insertElement(elements[i2], false);
2938
2994
  }
2939
2995
  this.emit("pasteHtml", elements, data2);
@@ -2992,67 +3048,6 @@ class AlexEditor {
2992
3048
  }
2993
3049
  }
2994
3050
  }
2995
- /**
2996
- * 根据光标进行剪切操作
2997
- */
2998
- async cut() {
2999
- if (!this.useClipboard) {
3000
- return;
3001
- }
3002
- if (!this.range) {
3003
- return;
3004
- }
3005
- if (!this.allowCut) {
3006
- return;
3007
- }
3008
- const result = await this.copy(true);
3009
- if (result) {
3010
- if (!this.disabled) {
3011
- this.delete();
3012
- }
3013
- this.emit("cut", result.text, result.html);
3014
- }
3015
- return result;
3016
- }
3017
- /**
3018
- * 根据光标执行复制操作
3019
- * isCut表示是否在执行剪切操作,默认为false,这个参数仅在内部使用
3020
- */
3021
- async copy(isCut = false) {
3022
- if (!this.useClipboard) {
3023
- return;
3024
- }
3025
- if (!this.range) {
3026
- return;
3027
- }
3028
- if (!this.allowCopy) {
3029
- return;
3030
- }
3031
- let result = this.getElementsByRange().list;
3032
- if (result.length == 0) {
3033
- return;
3034
- }
3035
- let html = "";
3036
- let text = "";
3037
- result.forEach((item) => {
3038
- const newEl = item.element.clone();
3039
- if (item.offset) {
3040
- newEl.textContent = newEl.textContent.substring(item.offset[0], item.offset[1]);
3041
- }
3042
- newEl.__render();
3043
- html += newEl.elm.outerHTML;
3044
- text += newEl.elm.innerText;
3045
- });
3046
- const clipboardItem = new window.ClipboardItem({
3047
- "text/html": new Blob([html], { type: "text/html" }),
3048
- "text/plain": new Blob([text], { type: "text/plain" })
3049
- });
3050
- await navigator.clipboard.write([clipboardItem]);
3051
- if (!isCut) {
3052
- this.emit("copy", text, html);
3053
- }
3054
- return { text, html };
3055
- }
3056
3051
  /**
3057
3052
  * 根据光标进行删除操作
3058
3053
  */
@@ -3606,83 +3601,58 @@ class AlexEditor {
3606
3601
  }
3607
3602
  }
3608
3603
  /**
3609
- * 格式化某个元素
3604
+ * 格式化stack
3610
3605
  */
3611
- formatElement(element2) {
3612
- let renderRules = this.renderRules.filter((fn) => {
3613
- return typeof fn == "function";
3614
- });
3615
- [handleNotStackBlock, handleInblockWithOther, handleInlineChildrenNotInblock, breakFormat, mergeWithBrotherElement, mergeWithParentElement, ...renderRules].forEach((fn) => {
3616
- fn.apply(this, [element2]);
3617
- });
3618
- if (element2.hasChildren()) {
3619
- let length = element2.children.length;
3620
- for (let i = 0; i < length; i++) {
3621
- const childElement = element2.children[i];
3622
- if (childElement.isEmpty()) {
3623
- if (this.range && childElement.isContains(this.range.anchor.element)) {
3606
+ formatElementStack() {
3607
+ const format = (elements, fn, isStack = false) => {
3608
+ let index = 0;
3609
+ while (index < elements.length) {
3610
+ if (elements[index].isEmpty()) {
3611
+ if (this.range && elements[index].isContains(this.range.anchor.element)) {
3624
3612
  setRecentlyPoint.apply(this, [this.range.anchor]);
3625
3613
  }
3626
- if (this.range && childElement.isContains(this.range.focus.element)) {
3614
+ if (this.range && elements[index].isContains(this.range.focus.element)) {
3627
3615
  setRecentlyPoint.apply(this, [this.range.focus]);
3628
3616
  }
3629
- element2.children.splice(i, 1);
3630
- i -= 1;
3631
- length -= 1;
3617
+ elements.splice(index, 1);
3632
3618
  continue;
3633
3619
  }
3634
- this.formatElement(childElement);
3635
- if (childElement.isEmpty()) {
3636
- if (this.range && childElement.isContains(this.range.anchor.element)) {
3620
+ fn.apply(this, [elements[index]]);
3621
+ if (elements[index].isEmpty()) {
3622
+ if (this.range && elements[index].isContains(this.range.anchor.element)) {
3637
3623
  setRecentlyPoint.apply(this, [this.range.anchor]);
3638
3624
  }
3639
- if (this.range && childElement.isContains(this.range.focus.element)) {
3625
+ if (this.range && elements[index].isContains(this.range.focus.element)) {
3640
3626
  setRecentlyPoint.apply(this, [this.range.focus]);
3641
3627
  }
3642
- element2.children.splice(i, 1);
3643
- i -= 1;
3644
- length -= 1;
3628
+ elements.splice(index, 1);
3645
3629
  continue;
3646
3630
  }
3647
- }
3648
- }
3649
- }
3650
- /**
3651
- * 格式化stack
3652
- */
3653
- formatElementStack() {
3654
- let length = this.stack.length;
3655
- for (let i = 0; i < length; i++) {
3656
- const element2 = this.stack[i];
3657
- if (element2.isEmpty()) {
3658
- if (this.range && element2.isContains(this.range.anchor.element)) {
3659
- setRecentlyPoint.apply(this, [this.range.anchor]);
3631
+ if (!elements[index].isBlock() && isStack) {
3632
+ elements[index].convertToBlock();
3660
3633
  }
3661
- if (this.range && element2.isContains(this.range.focus.element)) {
3662
- setRecentlyPoint.apply(this, [this.range.focus]);
3634
+ if (elements[index].hasChildren()) {
3635
+ format(elements[index].children, fn);
3663
3636
  }
3664
- this.stack.splice(i, 1);
3665
- i -= 1;
3666
- length -= 1;
3667
- continue;
3668
- }
3669
- if (!element2.isBlock()) {
3670
- element2.convertToBlock();
3671
- }
3672
- this.formatElement(element2);
3673
- if (element2.isEmpty()) {
3674
- if (this.range && element2.isContains(this.range.anchor.element)) {
3675
- setRecentlyPoint.apply(this, [this.range.anchor]);
3676
- }
3677
- if (this.range && element2.isContains(this.range.focus.element)) {
3678
- setRecentlyPoint.apply(this, [this.range.focus]);
3637
+ if (elements[index].isEmpty()) {
3638
+ if (this.range && elements[index].isContains(this.range.anchor.element)) {
3639
+ setRecentlyPoint.apply(this, [this.range.anchor]);
3640
+ }
3641
+ if (this.range && elements[index].isContains(this.range.focus.element)) {
3642
+ setRecentlyPoint.apply(this, [this.range.focus]);
3643
+ }
3644
+ elements.splice(index, 1);
3645
+ continue;
3679
3646
  }
3680
- this.stack.splice(i, 1);
3681
- i -= 1;
3682
- length -= 1;
3683
- continue;
3647
+ index++;
3684
3648
  }
3685
- }
3649
+ };
3650
+ let renderRules = this.renderRules.filter((fn) => {
3651
+ return typeof fn == "function";
3652
+ });
3653
+ [handleNotStackBlock, handleInblockWithOther, handleInlineChildrenNotInblock, breakFormat, mergeWithBrotherElement, mergeWithParentElement, ...renderRules].forEach((fn) => {
3654
+ format(this.stack, fn, true);
3655
+ });
3686
3656
  handleStackEmpty.apply(this);
3687
3657
  }
3688
3658
  /**
@@ -14475,6 +14445,11 @@ const editorProps = {
14475
14445
  default: function() {
14476
14446
  return [];
14477
14447
  }
14448
+ },
14449
+ //自适应高度
14450
+ autoheight: {
14451
+ type: Boolean,
14452
+ default: false
14478
14453
  }
14479
14454
  };
14480
14455
  const mergeObject = function(o1, o2) {
@@ -16374,7 +16349,7 @@ const specialInblockHandle = function(editor, element2) {
16374
16349
  });
16375
16350
  }
16376
16351
  };
16377
- const Triangle_vue_vue_type_style_index_0_scoped_c7bb62b7_lang = "";
16352
+ const Triangle_vue_vue_type_style_index_0_scoped_70b6f344_lang = "";
16378
16353
  const _export_sfc = (sfc, props) => {
16379
16354
  const target = sfc.__vccOpts || sfc;
16380
16355
  for (const [key, val] of props) {
@@ -16464,8 +16439,8 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
16464
16439
  }, null, 4)
16465
16440
  ], 12, _hoisted_1$c);
16466
16441
  }
16467
- const Triangle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d], ["__scopeId", "data-v-c7bb62b7"]]);
16468
- const Layer_vue_vue_type_style_index_0_scoped_2e7e0eb0_lang = "";
16442
+ const Triangle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d], ["__scopeId", "data-v-70b6f344"]]);
16443
+ const Layer_vue_vue_type_style_index_0_scoped_b5a839e3_lang = "";
16469
16444
  const _sfc_main$c = {
16470
16445
  name: "Layer",
16471
16446
  emits: ["update:modelValue", "show", "shown", "hidden"],
@@ -16719,13 +16694,13 @@ const _sfc_main$c = {
16719
16694
  if (this.placement == "top" || this.placement == "top-start" || this.placement == "top-end") {
16720
16695
  if (firstRect.top >= 0 && firstRect.top >= parentRect.top && firstRect.top >= this.$el.offsetHeight) {
16721
16696
  this.realPlacement = this.placement;
16722
- } else if (documentHeight - firstRect.bottom >= 0 && documentHeight - firstRect.bottom >= parentRect.bottom && documentHeight - firstRect.bottom >= this.$el.offsetHeight) {
16697
+ } else if (documentHeight - lastRect.bottom >= 0 && documentHeight - lastRect.bottom >= parentRect.bottom && documentHeight - lastRect.bottom >= this.$el.offsetHeight) {
16723
16698
  this.realPlacement = this.placement == "top" ? "bottom" : this.placement == "top-start" ? "bottom-start" : "bottom-end";
16724
16699
  }
16725
16700
  } else if (this.placement == "bottom" || this.placement == "bottom-start" || this.placement == "bottom-end") {
16726
16701
  if (documentHeight - lastRect.bottom >= 0 && documentHeight - lastRect.bottom >= parentRect.bottom && documentHeight - lastRect.bottom >= this.$el.offsetHeight) {
16727
16702
  this.realPlacement = this.placement;
16728
- } else if (lastRect.top >= 0 && lastRect.top >= parentRect.top && lastRect.top >= this.$el.offsetHeight) {
16703
+ } else if (firstRect.top >= 0 && firstRect.top >= parentRect.top && firstRect.top >= this.$el.offsetHeight) {
16729
16704
  this.realPlacement = this.placement == "bottom" ? "top" : this.placement == "bottom-start" ? "top-start" : "top-end";
16730
16705
  }
16731
16706
  }
@@ -17094,8 +17069,8 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
17094
17069
  _: 3
17095
17070
  }, 8, ["name", "onEnter", "onAfterEnter", "onAfterLeave"]);
17096
17071
  }
17097
- const Layer = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-2e7e0eb0"]]);
17098
- const Tooltip_vue_vue_type_style_index_0_scoped_3b8ba3fe_lang = "";
17072
+ const Layer = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-b5a839e3"]]);
17073
+ const Tooltip_vue_vue_type_style_index_0_scoped_5293a020_lang = "";
17099
17074
  const _sfc_main$b = {
17100
17075
  name: "Tooltip",
17101
17076
  props: {
@@ -17174,8 +17149,8 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
17174
17149
  }, 8, ["modelValue", "node"])
17175
17150
  ], 34);
17176
17151
  }
17177
- const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-3b8ba3fe"]]);
17178
- const Icon_vue_vue_type_style_index_0_scoped_c5a1759c_lang = "";
17152
+ const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-5293a020"]]);
17153
+ const Icon_vue_vue_type_style_index_0_scoped_5ed6cd4d_lang = "";
17179
17154
  const _sfc_main$a = {
17180
17155
  name: "Icon",
17181
17156
  props: {
@@ -17191,8 +17166,8 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
17191
17166
  class: normalizeClass(["editify-icon", "editify-icon-" + $props.value])
17192
17167
  }, null, 2);
17193
17168
  }
17194
- const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a], ["__scopeId", "data-v-c5a1759c"]]);
17195
- const Button_vue_vue_type_style_index_0_scoped_762c27cb_lang = "";
17169
+ const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a], ["__scopeId", "data-v-5ed6cd4d"]]);
17170
+ const Button_vue_vue_type_style_index_0_scoped_5928b86d_lang = "";
17196
17171
  const _sfc_main$9 = {
17197
17172
  name: "Button",
17198
17173
  emits: ["operate", "layerShow", "layerShown", "layerHidden"],
@@ -17556,8 +17531,8 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
17556
17531
  ], 2)
17557
17532
  ]);
17558
17533
  }
17559
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-762c27cb"]]);
17560
- const Checkbox_vue_vue_type_style_index_0_scoped_c7ef2a61_lang = "";
17534
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-5928b86d"]]);
17535
+ const Checkbox_vue_vue_type_style_index_0_scoped_a5c85ca2_lang = "";
17561
17536
  const _sfc_main$8 = {
17562
17537
  name: "Checkbox",
17563
17538
  emits: ["update:modelValue", "change"],
@@ -17686,8 +17661,8 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
17686
17661
  }, null, 8, _hoisted_3$7)) : createCommentVNode("", true)
17687
17662
  ], 2);
17688
17663
  }
17689
- const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-c7ef2a61"]]);
17690
- const Colors_vue_vue_type_style_index_0_scoped_38cf6d98_lang = "";
17664
+ const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-a5c85ca2"]]);
17665
+ const Colors_vue_vue_type_style_index_0_scoped_0827adbe_lang = "";
17691
17666
  const _sfc_main$7 = {
17692
17667
  name: "Colors",
17693
17668
  emits: ["change"],
@@ -17769,8 +17744,8 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
17769
17744
  ])
17770
17745
  ]);
17771
17746
  }
17772
- const Colors = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-38cf6d98"]]);
17773
- const Toolbar_vue_vue_type_style_index_0_scoped_f7f61935_lang = "";
17747
+ const Colors = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-0827adbe"]]);
17748
+ const Toolbar_vue_vue_type_style_index_0_scoped_95d8d583_lang = "";
17774
17749
  const _sfc_main$6 = {
17775
17750
  name: "Toolbar",
17776
17751
  emits: ["update:modelValue"],
@@ -19351,8 +19326,8 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
19351
19326
  _: 1
19352
19327
  }, 8, ["modelValue", "node", "onShow", "useRange"]);
19353
19328
  }
19354
- const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-f7f61935"]]);
19355
- const InsertLink_vue_vue_type_style_index_0_scoped_f572cc8f_lang = "";
19329
+ const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-95d8d583"]]);
19330
+ const InsertLink_vue_vue_type_style_index_0_scoped_a9191be1_lang = "";
19356
19331
  const _sfc_main$5 = {
19357
19332
  name: "InsertLink",
19358
19333
  emits: ["insert"],
@@ -19462,8 +19437,8 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
19462
19437
  ])
19463
19438
  ]);
19464
19439
  }
19465
- const InsertLink = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-f572cc8f"]]);
19466
- const InsertImage_vue_vue_type_style_index_0_scoped_c50cf629_lang = "";
19440
+ const InsertLink = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-a9191be1"]]);
19441
+ const InsertImage_vue_vue_type_style_index_0_scoped_0f2f6ae4_lang = "";
19467
19442
  const _sfc_main$4 = {
19468
19443
  name: "InsertImage",
19469
19444
  emits: ["change", "insert"],
@@ -19673,8 +19648,8 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
19673
19648
  ]))
19674
19649
  ]);
19675
19650
  }
19676
- const InsertImage = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-c50cf629"]]);
19677
- const InsertVideo_vue_vue_type_style_index_0_scoped_ede2dc10_lang = "";
19651
+ const InsertImage = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-0f2f6ae4"]]);
19652
+ const InsertVideo_vue_vue_type_style_index_0_scoped_a99ffa99_lang = "";
19678
19653
  const _sfc_main$3 = {
19679
19654
  name: "InsertVideo",
19680
19655
  emits: ["change", "insert"],
@@ -19884,8 +19859,8 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
19884
19859
  ]))
19885
19860
  ]);
19886
19861
  }
19887
- const InsertVideo = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-ede2dc10"]]);
19888
- const InsertTable_vue_vue_type_style_index_0_scoped_4ea2b077_lang = "";
19862
+ const InsertVideo = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-a99ffa99"]]);
19863
+ const InsertTable_vue_vue_type_style_index_0_scoped_227e119e_lang = "";
19889
19864
  const _sfc_main$2 = {
19890
19865
  name: "InsertTable",
19891
19866
  emits: ["insert"],
@@ -19968,7 +19943,7 @@ const _sfc_main$2 = {
19968
19943
  }
19969
19944
  }
19970
19945
  };
19971
- const _withScopeId = (n) => (pushScopeId("data-v-4ea2b077"), n = n(), popScopeId(), n);
19946
+ const _withScopeId = (n) => (pushScopeId("data-v-227e119e"), n = n(), popScopeId(), n);
19972
19947
  const _hoisted_1$2 = { class: "editify-table" };
19973
19948
  const _hoisted_2$1 = ["onMouseenter", "onClick"];
19974
19949
  const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, null, -1));
@@ -19998,8 +19973,8 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
19998
19973
  ])
19999
19974
  ]);
20000
19975
  }
20001
- const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-4ea2b077"]]);
20002
- const Menu_vue_vue_type_style_index_0_scoped_e320272f_lang = "";
19976
+ const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-227e119e"]]);
19977
+ const Menu_vue_vue_type_style_index_0_scoped_25262a69_lang = "";
20003
19978
  const _sfc_main$1 = {
20004
19979
  name: "Menu",
20005
19980
  props: {
@@ -21360,8 +21335,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
21360
21335
  }), 256))
21361
21336
  ], 14, _hoisted_1$1);
21362
21337
  }
21363
- const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-e320272f"]]);
21364
- const Editify_vue_vue_type_style_index_0_scoped_40da9f9a_lang = "";
21338
+ const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-25262a69"]]);
21339
+ const Editify_vue_vue_type_style_index_0_scoped_7535307a_lang = "";
21365
21340
  const _sfc_main = {
21366
21341
  name: "editify",
21367
21342
  props: { ...editorProps },
@@ -21378,6 +21353,8 @@ const _sfc_main = {
21378
21353
  isModelChange: false,
21379
21354
  //是否正在输入中文
21380
21355
  isInputChinese: false,
21356
+ //工具条和菜单栏判定延时器
21357
+ rangeUpdateTimer: null,
21381
21358
  //表格列宽拖拽记录数据
21382
21359
  tableColumnResizeParams: {
21383
21360
  element: null,
@@ -21926,14 +21903,20 @@ const _sfc_main = {
21926
21903
  return;
21927
21904
  }
21928
21905
  this.dataRangeCaches = this.editor.getElementsByRange();
21929
- if (this.toolbarConfig.use || this.menuConfig.use) {
21930
- if (this.toolbarConfig.use) {
21931
- this.handleToolbar();
21932
- }
21933
- if (this.menuConfig.use) {
21934
- this.$refs.menu.handleRangeUpdate();
21906
+ if (this.rangeUpdateTimer) {
21907
+ clearTimeout(this.rangeUpdateTimer);
21908
+ this.rangeUpdateTimer = null;
21909
+ }
21910
+ this.rangeUpdateTimer = setTimeout(() => {
21911
+ if (this.toolbarConfig.use || this.menuConfig.use) {
21912
+ if (this.toolbarConfig.use) {
21913
+ this.handleToolbar();
21914
+ }
21915
+ if (this.menuConfig.use) {
21916
+ this.$refs.menu.handleRangeUpdate();
21917
+ }
21935
21918
  }
21936
- }
21919
+ }, 200);
21937
21920
  this.$emit("rangeupdate");
21938
21921
  },
21939
21922
  //编辑器粘贴html
@@ -22053,7 +22036,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22053
22036
  const _component_Menu = resolveComponent("Menu");
22054
22037
  const _component_Toolbar = resolveComponent("Toolbar");
22055
22038
  return openBlock(), createElementBlock("div", {
22056
- class: normalizeClass(["editify", { fullscreen: $data.isFullScreen }])
22039
+ class: normalizeClass(["editify", { fullscreen: $data.isFullScreen, autoheight: _ctx.autoheight }])
22057
22040
  }, [
22058
22041
  $options.menuConfig.use ? (openBlock(), createBlock(_component_Menu, {
22059
22042
  key: 0,
@@ -22099,7 +22082,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22099
22082
  ], 2)) : createCommentVNode("", true)
22100
22083
  ], 2);
22101
22084
  }
22102
- const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-40da9f9a"]]);
22085
+ const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7535307a"]]);
22103
22086
  const iconfont = "";
22104
22087
  const en_US = {
22105
22088
  textWrapUp: "Up feed",
@@ -22282,7 +22265,7 @@ const i18n = (locale) => {
22282
22265
  return translations[locale][key];
22283
22266
  };
22284
22267
  };
22285
- const version = "0.1.3";
22268
+ const version = "0.1.5";
22286
22269
  const install = (app, props) => {
22287
22270
  const locale = (props ? props.locale : "zh_CN") || "zh_CN";
22288
22271
  app.provide("$editTrans", i18n(locale));