vue-editify 0.1.41 → 0.1.42

Sign up to get free protection for your applications and to get access to all the features.
package/examples/App.vue CHANGED
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div style="padding: 10px; height: 100%; box-sizing: border-box">
3
- <Editify ref="editify" border v-model="val" :menu="menuConfig" style="height: 100%" placeholder="Please Enter Text..." :toolbar="toolbarConfig" locale="zh_CN" allow-paste-html :plugins="plugins"></Editify>
3
+ <Editify ref="editify" border v-model="val" :menu="menuConfig" style="height: 100%" placeholder="Please Enter Text..." :toolbar="toolbarConfig" locale="zh_CN" allow-paste-html :plugins="plugins" @rangeupdate="rangeupdate"></Editify>
4
4
  </div>
5
5
  </template>
6
6
  <script setup lang="ts">
7
7
  import { h, ref } from 'vue'
8
- import { AlexElement, MenuConfigType, Editify, attachment, PluginType, mathformula, ToolbarConfigType } from '../src/index'
8
+ import { AlexElement, MenuConfigType, Editify, attachment, PluginType, mathformula, ToolbarConfigType, getMatchElementsByRange } from '../src/index'
9
9
  const val = ref<string>(
10
10
  '<p><span>这是一个</span><a href="#" data-editify-element="41"><span>链接</span></a><span>文本这是一</span><span style="font-weight: bold;">个链接</span><span>文本</span></p><p><img src="https://www.ling0523.cn/images/image_0_1701871044625.jpg" data-editify-element="47"></p><p><span></span><video src="https://video.699pic.com/videos/92/12/46/b_zEMHgCfQS5fV1714921246.mp4" data-editify-element="50"></video><span></span></p><pre data-editify-element="52"><span class="editify-hljs-keyword">import</span><span> </span><span class="editify-hljs-title class_">AlexEditor</span><span> </span><span class="editify-hljs-keyword">from</span><span> </span><span class="editify-hljs-string">"alex-editor"</span></pre><table data-editify-element="60" style="white-space: pre-wrap; word-break: break-word;"><colgroup><col width="50%"><col width="auto"><col width="auto"><col width="auto"><col width="auto"><col width="auto"></colgroup><tbody><tr><th rowspan="4">1</th><th>2</th><th rowspan="3">3</th><th>4</th><th>5</th><th>6</th></tr><tr><td rowspan="3"><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td colspan="2"><br></td></tr></tbody></table>'
11
11
  )
@@ -34,6 +34,15 @@ const plugins = ref<PluginType[]>([
34
34
  }),
35
35
  mathformula()
36
36
  ])
37
+
38
+ const rangeupdate = () => {
39
+ const elements = getMatchElementsByRange(editify.value!.editor!, editify.value!.dataRangeCaches, {
40
+ styles: {
41
+ 'font-weight': 'bold'
42
+ }
43
+ })
44
+ console.log(elements)
45
+ }
37
46
  </script>
38
47
  <style lang="less">
39
48
  html,
package/lib/editify.es.js CHANGED
@@ -18757,11 +18757,8 @@ const getMenuConfig = function(editTrans, editLocale) {
18757
18757
  };
18758
18758
  };
18759
18759
  const elementIsMatch = (element2, config) => {
18760
- if (element2.isText()) {
18761
- return false;
18762
- }
18763
18760
  let isMatch = true;
18764
- if (config.parsedom && config.parsedom != element2.parsedom) {
18761
+ if (config.parsedom && element2.parsedom && config.parsedom != element2.parsedom) {
18765
18762
  isMatch = false;
18766
18763
  }
18767
18764
  if (config.marks) {
@@ -41188,7 +41185,7 @@ const attachment = (options) => {
41188
41185
  const install = (app) => {
41189
41186
  app.component(Editify.name, Editify);
41190
41187
  };
41191
- const version = "0.1.41";
41188
+ const version = "0.1.42";
41192
41189
  console.log(`%c vue-editify %c v${version} `, "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;", "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;");
41193
41190
  export {
41194
41191
  AlexElement,