vue-editify 0.0.36 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/examples/App.vue CHANGED
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div style="padding: 100px 50px 50px 50px">
3
- <editify v-model="value" placeholder="请输入正文内容..." allow-paste-html border @change="change" :menu="menuConfig" ref="editify" height="400px" @after-render="afterRender" :paste-keep-marks="{ 'data-zip': ['span'] }" :custom-parse-node="parseNode"></editify>
3
+ <editify v-model="value" placeholder="请输入正文内容..." allow-paste-html border @change="change" :menu="menuConfig" ref="editify" height="400px" @after-render="afterRender" :paste-keep-marks="{ 'data-zip': ['span'] }" :custom-parse-node="parseNode" :renderRules="renderRules"></editify>
4
4
  </div>
5
5
  </template>
6
6
  <script>
@@ -92,7 +92,12 @@ export default {
92
92
  }
93
93
  }
94
94
  },
95
- btn: null
95
+ btn: null,
96
+ renderRules: [
97
+ el => {
98
+ console.log(el)
99
+ }
100
+ ]
96
101
  }
97
102
  },
98
103
  mounted() {
package/lib/editify.es.js CHANGED
@@ -2485,9 +2485,11 @@ class AlexHistory {
2485
2485
  const focusElement = AlexElement.flatElements(newStack).find((ele) => {
2486
2486
  return ele.key == range.focus.element.key;
2487
2487
  });
2488
- const anchor = new AlexPoint(anchorElement, range.anchor.offset);
2489
- const focus = new AlexPoint(focusElement, range.focus.offset);
2490
- return new AlexRange(anchor, focus);
2488
+ if (anchorElement && focusElement) {
2489
+ const anchor = new AlexPoint(anchorElement, range.anchor.offset);
2490
+ const focus = new AlexPoint(focusElement, range.focus.offset);
2491
+ return new AlexRange(anchor, focus);
2492
+ }
2491
2493
  }
2492
2494
  return null;
2493
2495
  }
@@ -4822,7 +4824,7 @@ class AlexEditor {
4822
4824
  /**
4823
4825
  * 查询虚拟光标包含的文本元素是否具有某个样式
4824
4826
  */
4825
- queryTextStyle(name, value, useCache) {
4827
+ queryTextStyle(name, value, useCache = false) {
4826
4828
  if (!name) {
4827
4829
  throw new Error("The first argument cannot be null");
4828
4830
  }
@@ -4889,7 +4891,7 @@ class AlexEditor {
4889
4891
  this.insertElement(el);
4890
4892
  } else {
4891
4893
  const el = AlexElement.getSpaceElement();
4892
- el.marks = UcloneData(marks);
4894
+ el.marks = cloneData(marks);
4893
4895
  this.insertElement(el);
4894
4896
  }
4895
4897
  } else {
@@ -4952,7 +4954,7 @@ class AlexEditor {
4952
4954
  /**
4953
4955
  * 查询选区内的文本元素是否具有某个标记
4954
4956
  */
4955
- queryTextMark(name, value, useCache) {
4957
+ queryTextMark(name, value, useCache = false) {
4956
4958
  if (!name) {
4957
4959
  throw new Error("The first argument cannot be null");
4958
4960
  }
@@ -15411,6 +15413,13 @@ const editorProps = {
15411
15413
  pasteKeepStyles: {
15412
15414
  type: Object,
15413
15415
  default: null
15416
+ },
15417
+ //自定义渲染规则
15418
+ renderRules: {
15419
+ type: Array,
15420
+ default: function() {
15421
+ return [];
15422
+ }
15414
15423
  }
15415
15424
  };
15416
15425
  const getColNumbers = (row) => {
@@ -21197,7 +21206,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
21197
21206
  ], 14, _hoisted_1$1);
21198
21207
  }
21199
21208
  const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-42f60b43"]]);
21200
- const Editify_vue_vue_type_style_index_0_scoped_8415c1dc_lang = "";
21209
+ const Editify_vue_vue_type_style_index_0_scoped_744c85a9_lang = "";
21201
21210
  const _sfc_main = {
21202
21211
  name: "editify",
21203
21212
  props: { ...editorProps },
@@ -21328,7 +21337,8 @@ const _sfc_main = {
21328
21337
  (el) => {
21329
21338
  var _a, _b, _c, _d, _e, _f;
21330
21339
  preHandle.apply(this.editor, [el, ((_a = this.toolbarConfig) == null ? void 0 : _a.use) && ((_d = (_c = (_b = this.toolbarConfig) == null ? void 0 : _b.codeBlock) == null ? void 0 : _c.languages) == null ? void 0 : _d.show), (_f = (_e = this.toolbarConfig) == null ? void 0 : _e.codeBlock) == null ? void 0 : _f.languages.options]);
21331
- }
21340
+ },
21341
+ ...this.renderRules
21332
21342
  ],
21333
21343
  allowCopy: this.allowCopy,
21334
21344
  allowPaste: this.allowPaste,
@@ -22814,7 +22824,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22814
22824
  ])) : createCommentVNode("", true)
22815
22825
  ]);
22816
22826
  }
22817
- const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8415c1dc"]]);
22827
+ const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-744c85a9"]]);
22818
22828
  const iconfont = "";
22819
22829
  const en_US = {
22820
22830
  textWrapUp: "Up feed",
@@ -22993,7 +23003,7 @@ const i18n = (locale) => {
22993
23003
  return translations[locale][key];
22994
23004
  };
22995
23005
  };
22996
- const version = "0.0.36";
23006
+ const version = "0.0.38";
22997
23007
  const install = (app, props) => {
22998
23008
  const locale = (props ? props.locale : "zh_CN") || "zh_CN";
22999
23009
  app.provide("$editTrans", i18n(locale));