vue-editify 0.0.38 → 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" :renderRules="renderRules"></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
@@ -92,18 +92,19 @@ export default {
92
92
  }
93
93
  }
94
94
  },
95
- btn: null,
96
- renderRules: [
97
- el => {
98
- console.log(el)
99
- }
100
- ]
95
+ btn: null
101
96
  }
102
97
  },
103
98
  mounted() {
104
99
  // setTimeout(() => {
105
100
  // this.value = '<p><br></p>'
106
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)
107
108
  },
108
109
  methods: {
109
110
  afterRender() {
@@ -124,10 +125,10 @@ export default {
124
125
  return ele
125
126
  },
126
127
  change() {
127
- console.log(this.$refs.editify.textValue)
128
+ //console.log(this.$refs.editify.textValue)
128
129
  },
129
130
  operate(name, val) {
130
- console.log('触发operate事件', name, val)
131
+ //console.log('触发operate事件', name, val)
131
132
  }
132
133
  }
133
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);
@@ -19987,7 +19988,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
19987
19988
  ]);
19988
19989
  }
19989
19990
  const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-227ede65"]]);
19990
- const Menu_vue_vue_type_style_index_0_scoped_42f60b43_lang = "";
19991
+ const Menu_vue_vue_type_style_index_0_scoped_a3e32a29_lang = "";
19991
19992
  const _sfc_main$1 = {
19992
19993
  name: "Menu",
19993
19994
  props: {
@@ -21205,8 +21206,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
21205
21206
  }), 256))
21206
21207
  ], 14, _hoisted_1$1);
21207
21208
  }
21208
- const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-42f60b43"]]);
21209
- const Editify_vue_vue_type_style_index_0_scoped_744c85a9_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 = "";
21210
21211
  const _sfc_main = {
21211
21212
  name: "editify",
21212
21213
  props: { ...editorProps },
@@ -22824,7 +22825,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22824
22825
  ])) : createCommentVNode("", true)
22825
22826
  ]);
22826
22827
  }
22827
- const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-744c85a9"]]);
22828
+ const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2702e06f"]]);
22828
22829
  const iconfont = "";
22829
22830
  const en_US = {
22830
22831
  textWrapUp: "Up feed",
@@ -23003,7 +23004,7 @@ const i18n = (locale) => {
23003
23004
  return translations[locale][key];
23004
23005
  };
23005
23006
  };
23006
- const version = "0.0.38";
23007
+ const version = "0.0.39";
23007
23008
  const install = (app, props) => {
23008
23009
  const locale = (props ? props.locale : "zh_CN") || "zh_CN";
23009
23010
  app.provide("$editTrans", i18n(locale));