vue-editify 0.0.37 → 0.0.39

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'] }" autofocus :custom-parse-node="parseNode" show-word-length></editify>
4
4
  </div>
5
5
  </template>
6
6
  <script>
@@ -11,9 +11,9 @@ export default {
11
11
  name: 'App',
12
12
  data() {
13
13
  return {
14
- value: '<p><span>这是一个基于 </span><code>Vue3 + alex-editor</code><span> 构建的一套</span><span style="font-weight: bold;">精美UI样式</span><span>的</span><span style="font-weight: bold;">开箱即用</span><span>的</span><span style="color: #ec1a0a;">富文本编辑器</span></p>',
14
+ value: '<p><span>这是一个基于<img src="https://www.ling0523.cn/images/image_0_1701164609409.jpg"/> </span><code>Vue3 + alex-editor</code><span> 构建的一套</span><span style="font-weight: bold;">精美UI样式</span><span>的</span><span style="font-weight: bold;">开箱即用</span><span>的</span><span style="color: #ec1a0a;">富文本编辑器</span></p>',
15
15
  menuConfig: {
16
- //mode: 'inner',
16
+ mode: 'inner',
17
17
  sequence: {
18
18
  alert: 100,
19
19
  zip: 101
@@ -99,6 +99,12 @@ export default {
99
99
  // setTimeout(() => {
100
100
  // this.value = '<p><br></p>'
101
101
  // }, 3000)
102
+ setTimeout(() => {
103
+ const el = this.$refs.editify.editor.getElementByKey(4)
104
+ this.$refs.editify.editor.range.anchor.moveToStart(el)
105
+ this.$refs.editify.editor.range.focus.moveToStart(el)
106
+ this.$refs.editify.editor.rangeRender()
107
+ }, 100)
102
108
  },
103
109
  methods: {
104
110
  afterRender() {
@@ -119,10 +125,10 @@ export default {
119
125
  return ele
120
126
  },
121
127
  change() {
122
- console.log(this.$refs.editify.textValue)
128
+ //console.log(this.$refs.editify.textValue)
123
129
  },
124
130
  operate(name, val) {
125
- console.log('触发operate事件', name, val)
131
+ //console.log('触发operate事件', name, val)
126
132
  }
127
133
  }
128
134
  }
package/lib/editify.es.js CHANGED
@@ -3865,11 +3865,12 @@ class AlexEditor {
3865
3865
  const index = elements.findIndex((item) => {
3866
3866
  return this.range.anchor.element.isEqual(item);
3867
3867
  });
3868
+ const offset = this.range.anchor.offset;
3868
3869
  this.range.focus.moveToEnd(block);
3869
3870
  this.delete();
3870
3871
  const newElements = AlexElement.flatElements(newBlock.children);
3871
3872
  this.range.focus.element = newElements[index];
3872
- this.range.focus.offset = this.range.anchor.offset;
3873
+ this.range.focus.offset = offset;
3873
3874
  this.range.anchor.moveToStart(newBlock);
3874
3875
  this.delete();
3875
3876
  this.emit("insertParagraph", newBlock, block);
@@ -15413,6 +15414,13 @@ const editorProps = {
15413
15414
  pasteKeepStyles: {
15414
15415
  type: Object,
15415
15416
  default: null
15417
+ },
15418
+ //自定义渲染规则
15419
+ renderRules: {
15420
+ type: Array,
15421
+ default: function() {
15422
+ return [];
15423
+ }
15416
15424
  }
15417
15425
  };
15418
15426
  const getColNumbers = (row) => {
@@ -19980,7 +19988,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
19980
19988
  ]);
19981
19989
  }
19982
19990
  const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-227ede65"]]);
19983
- const Menu_vue_vue_type_style_index_0_scoped_42f60b43_lang = "";
19991
+ const Menu_vue_vue_type_style_index_0_scoped_a3e32a29_lang = "";
19984
19992
  const _sfc_main$1 = {
19985
19993
  name: "Menu",
19986
19994
  props: {
@@ -21198,8 +21206,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
21198
21206
  }), 256))
21199
21207
  ], 14, _hoisted_1$1);
21200
21208
  }
21201
- const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-42f60b43"]]);
21202
- const Editify_vue_vue_type_style_index_0_scoped_8415c1dc_lang = "";
21209
+ const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-a3e32a29"]]);
21210
+ const Editify_vue_vue_type_style_index_0_scoped_2702e06f_lang = "";
21203
21211
  const _sfc_main = {
21204
21212
  name: "editify",
21205
21213
  props: { ...editorProps },
@@ -21330,7 +21338,8 @@ const _sfc_main = {
21330
21338
  (el) => {
21331
21339
  var _a, _b, _c, _d, _e, _f;
21332
21340
  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]);
21333
- }
21341
+ },
21342
+ ...this.renderRules
21334
21343
  ],
21335
21344
  allowCopy: this.allowCopy,
21336
21345
  allowPaste: this.allowPaste,
@@ -22816,7 +22825,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22816
22825
  ])) : createCommentVNode("", true)
22817
22826
  ]);
22818
22827
  }
22819
- const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8415c1dc"]]);
22828
+ const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2702e06f"]]);
22820
22829
  const iconfont = "";
22821
22830
  const en_US = {
22822
22831
  textWrapUp: "Up feed",
@@ -22995,7 +23004,7 @@ const i18n = (locale) => {
22995
23004
  return translations[locale][key];
22996
23005
  };
22997
23006
  };
22998
- const version = "0.0.37";
23007
+ const version = "0.0.39";
22999
23008
  const install = (app, props) => {
23000
23009
  const locale = (props ? props.locale : "zh_CN") || "zh_CN";
23001
23010
  app.provide("$editTrans", i18n(locale));