vue-editify 0.0.38 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
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);
@@ -17290,7 +17291,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
17290
17291
  }, null, 2);
17291
17292
  }
17292
17293
  const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a], ["__scopeId", "data-v-5ed6cd4d"]]);
17293
- const Button_vue_vue_type_style_index_0_scoped_ea3e1e88_lang = "";
17294
+ const Button_vue_vue_type_style_index_0_scoped_32253355_lang = "";
17294
17295
  const _sfc_main$9 = {
17295
17296
  name: "Button",
17296
17297
  emits: ["operate", "layerShow", "layerShown", "layerHidden"],
@@ -17613,7 +17614,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
17613
17614
  border: "",
17614
17615
  fade: "",
17615
17616
  placement: "bottom-start",
17616
- "z-index": 20,
17617
+ "z-index": 12,
17617
17618
  animation: "translate",
17618
17619
  onShow: $options.layerShow,
17619
17620
  onShown: $options.layerShown,
@@ -17654,7 +17655,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
17654
17655
  ], 2)
17655
17656
  ]);
17656
17657
  }
17657
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-ea3e1e88"]]);
17658
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-32253355"]]);
17658
17659
  const Checkbox_vue_vue_type_style_index_0_scoped_50cd9e6c_lang = "";
17659
17660
  const _sfc_main$8 = {
17660
17661
  name: "Checkbox",
@@ -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_85cbaf03_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-85cbaf03"]]);
21210
+ const Editify_vue_vue_type_style_index_0_scoped_5506c37b_lang = "";
21210
21211
  const _sfc_main = {
21211
21212
  name: "editify",
21212
21213
  props: { ...editorProps },
@@ -21535,7 +21536,7 @@ const _sfc_main = {
21535
21536
  }
21536
21537
  }
21537
21538
  }
21538
- if (!obj.element.isContains(this.$el, e.target)) {
21539
+ if (!obj.element.isContains(this.$el, e.target) && !this.isSourceView) {
21539
21540
  this.canUseMenu = false;
21540
21541
  }
21541
21542
  },
@@ -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-5506c37b"]]);
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.40";
23007
23008
  const install = (app, props) => {
23008
23009
  const locale = (props ? props.locale : "zh_CN") || "zh_CN";
23009
23010
  app.provide("$editTrans", i18n(locale));