vue-editify 0.1.0 → 0.1.2
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 +7 -2
 - package/lib/editify.es.js +19 -11
 - package/lib/editify.umd.js +1 -1
 - package/lib/style.css +1 -1
 - package/package.json +2 -2
 - package/src/Editify.vue +4 -3
 - package/src/core/tool.js +8 -1
 - package/src/index.js +1 -1
 
    
        package/examples/App.vue
    CHANGED
    
    | 
         @@ -15,7 +15,7 @@ 
     | 
|
| 
       15 
15 
     | 
    
         
             
                            </p>
         
     | 
| 
       16 
16 
     | 
    
         
             
            			</div>
         
     | 
| 
       17 
17 
     | 
    
         
             
            		</div>
         
     | 
| 
       18 
     | 
    
         
            -
            		<editify v-model="value" placeholder="请输入正文内容..." allow-paste-html :menu="menuConfig" ref="editify" :paste-keep-marks="{ 'data-zip': ['span'] }" autofocus :show-word-length="true" :border="true" :disabled="disabled" @updateview="updateview" :customParseNoe="customParseNoe"></editify>
         
     | 
| 
      
 18 
     | 
    
         
            +
            		<editify v-model="value" placeholder="请输入正文内容..." allow-paste-html :menu="menuConfig" ref="editify" :paste-keep-marks="{ 'data-zip': ['span'] }" autofocus :show-word-length="true" :border="true" :disabled="disabled" @updateview="updateview" :customParseNoe="customParseNoe" :renderRules="renderRules"></editify>
         
     | 
| 
       19 
19 
     | 
    
         
             
            	</div>
         
     | 
| 
       20 
20 
     | 
    
         
             
            </template>
         
     | 
| 
       21 
21 
     | 
    
         
             
            <script>
         
     | 
| 
         @@ -79,7 +79,12 @@ export default { 
     | 
|
| 
       79 
79 
     | 
    
         
             
            				}
         
     | 
| 
       80 
80 
     | 
    
         
             
            			},
         
     | 
| 
       81 
81 
     | 
    
         
             
            			btn: null,
         
     | 
| 
       82 
     | 
    
         
            -
            			disabled: false
         
     | 
| 
      
 82 
     | 
    
         
            +
            			disabled: false,
         
     | 
| 
      
 83 
     | 
    
         
            +
                        renderRules:[
         
     | 
| 
      
 84 
     | 
    
         
            +
                            el=>{
         
     | 
| 
      
 85 
     | 
    
         
            +
                                console.log(el);
         
     | 
| 
      
 86 
     | 
    
         
            +
                            }
         
     | 
| 
      
 87 
     | 
    
         
            +
                        ]
         
     | 
| 
       83 
88 
     | 
    
         
             
            		}
         
     | 
| 
       84 
89 
     | 
    
         
             
            	},
         
     | 
| 
       85 
90 
     | 
    
         
             
            	mounted() {
         
     | 
    
        package/lib/editify.es.js
    CHANGED
    
    | 
         @@ -2570,7 +2570,7 @@ const setRangeInVisible = function() { 
     | 
|
| 
       2570 
2570 
     | 
    
         
             
                  const childRect = target.getBoundingClientRect();
         
     | 
| 
       2571 
2571 
     | 
    
         
             
                  const parentRect = root.getBoundingClientRect();
         
     | 
| 
       2572 
2572 
     | 
    
         
             
                  if (root.clientHeight < scrollHeight) {
         
     | 
| 
       2573 
     | 
    
         
            -
                    if (childRect. 
     | 
| 
      
 2573 
     | 
    
         
            +
                    if (childRect.top < parentRect.top) {
         
     | 
| 
       2574 
2574 
     | 
    
         
             
                      await element$1.setScrollTop({
         
     | 
| 
       2575 
2575 
     | 
    
         
             
                        el: root,
         
     | 
| 
       2576 
2576 
     | 
    
         
             
                        number: 0
         
     | 
| 
         @@ -2581,7 +2581,7 @@ const setRangeInVisible = function() { 
     | 
|
| 
       2581 
2581 
     | 
    
         
             
                        el: root,
         
     | 
| 
       2582 
2582 
     | 
    
         
             
                        number: tempChildRect.top - tempParentRect.top
         
     | 
| 
       2583 
2583 
     | 
    
         
             
                      });
         
     | 
| 
       2584 
     | 
    
         
            -
                    } else if (childRect. 
     | 
| 
      
 2584 
     | 
    
         
            +
                    } else if (childRect.bottom > parentRect.bottom) {
         
     | 
| 
       2585 
2585 
     | 
    
         
             
                      await element$1.setScrollTop({
         
     | 
| 
       2586 
2586 
     | 
    
         
             
                        el: root,
         
     | 
| 
       2587 
2587 
     | 
    
         
             
                        number: 0
         
     | 
| 
         @@ -2595,7 +2595,7 @@ const setRangeInVisible = function() { 
     | 
|
| 
       2595 
2595 
     | 
    
         
             
                    }
         
     | 
| 
       2596 
2596 
     | 
    
         
             
                  }
         
     | 
| 
       2597 
2597 
     | 
    
         
             
                  if (root.clientWidth < scrollWidth) {
         
     | 
| 
       2598 
     | 
    
         
            -
                    if (childRect. 
     | 
| 
      
 2598 
     | 
    
         
            +
                    if (childRect.left < parentRect.left) {
         
     | 
| 
       2599 
2599 
     | 
    
         
             
                      await element$1.setScrollLeft({
         
     | 
| 
       2600 
2600 
     | 
    
         
             
                        el: root,
         
     | 
| 
       2601 
2601 
     | 
    
         
             
                        number: 0
         
     | 
| 
         @@ -2606,7 +2606,7 @@ const setRangeInVisible = function() { 
     | 
|
| 
       2606 
2606 
     | 
    
         
             
                        el: root,
         
     | 
| 
       2607 
2607 
     | 
    
         
             
                        number: tempChildRect.left - tempParentRect.left + 20
         
     | 
| 
       2608 
2608 
     | 
    
         
             
                      });
         
     | 
| 
       2609 
     | 
    
         
            -
                    } else if (childRect. 
     | 
| 
      
 2609 
     | 
    
         
            +
                    } else if (childRect.right > parentRect.right) {
         
     | 
| 
       2610 
2610 
     | 
    
         
             
                      await element$1.setScrollLeft({
         
     | 
| 
       2611 
2611 
     | 
    
         
             
                        el: root,
         
     | 
| 
       2612 
2612 
     | 
    
         
             
                        number: 0
         
     | 
| 
         @@ -14435,9 +14435,16 @@ const editorProps = { 
     | 
|
| 
       14435 
14435 
     | 
    
         
             
                default: null
         
     | 
| 
       14436 
14436 
     | 
    
         
             
              },
         
     | 
| 
       14437 
14437 
     | 
    
         
             
              //自定义node转元素时的处理
         
     | 
| 
       14438 
     | 
    
         
            -
               
     | 
| 
      
 14438 
     | 
    
         
            +
              customParseNode: {
         
     | 
| 
       14439 
14439 
     | 
    
         
             
                type: Function,
         
     | 
| 
       14440 
14440 
     | 
    
         
             
                default: null
         
     | 
| 
      
 14441 
     | 
    
         
            +
              },
         
     | 
| 
      
 14442 
     | 
    
         
            +
              //自定义额外的渲染规范
         
     | 
| 
      
 14443 
     | 
    
         
            +
              renderRules: {
         
     | 
| 
      
 14444 
     | 
    
         
            +
                type: Array,
         
     | 
| 
      
 14445 
     | 
    
         
            +
                default: function() {
         
     | 
| 
      
 14446 
     | 
    
         
            +
                  return [];
         
     | 
| 
      
 14447 
     | 
    
         
            +
                }
         
     | 
| 
       14441 
14448 
     | 
    
         
             
              }
         
     | 
| 
       14442 
14449 
     | 
    
         
             
            };
         
     | 
| 
       14443 
14450 
     | 
    
         
             
            const mergeObject = function(o1, o2) {
         
     | 
| 
         @@ -21324,7 +21331,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { 
     | 
|
| 
       21324 
21331 
     | 
    
         
             
              ], 14, _hoisted_1$1);
         
     | 
| 
       21325 
21332 
     | 
    
         
             
            }
         
     | 
| 
       21326 
21333 
     | 
    
         
             
            const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-25262a69"]]);
         
     | 
| 
       21327 
     | 
    
         
            -
            const  
     | 
| 
      
 21334 
     | 
    
         
            +
            const Editify_vue_vue_type_style_index_0_scoped_8d0f0eb2_lang = "";
         
     | 
| 
       21328 
21335 
     | 
    
         
             
            const _sfc_main = {
         
     | 
| 
       21329 
21336 
     | 
    
         
             
              name: "editify",
         
     | 
| 
       21330 
21337 
     | 
    
         
             
              props: { ...editorProps },
         
     | 
| 
         @@ -21595,7 +21602,8 @@ const _sfc_main = { 
     | 
|
| 
       21595 
21602 
     | 
    
         
             
                      },
         
     | 
| 
       21596 
21603 
     | 
    
         
             
                      (el) => {
         
     | 
| 
       21597 
21604 
     | 
    
         
             
                        specialInblockHandle(this.editor, el);
         
     | 
| 
       21598 
     | 
    
         
            -
                      }
         
     | 
| 
      
 21605 
     | 
    
         
            +
                      },
         
     | 
| 
      
 21606 
     | 
    
         
            +
                      ...this.renderRules
         
     | 
| 
       21599 
21607 
     | 
    
         
             
                    ],
         
     | 
| 
       21600 
21608 
     | 
    
         
             
                    allowCopy: this.allowCopy,
         
     | 
| 
       21601 
21609 
     | 
    
         
             
                    allowPaste: this.allowPaste,
         
     | 
| 
         @@ -21772,8 +21780,8 @@ const _sfc_main = { 
     | 
|
| 
       21772 
21780 
     | 
    
         
             
                      ele.marks = marks;
         
     | 
| 
       21773 
21781 
     | 
    
         
             
                    }
         
     | 
| 
       21774 
21782 
     | 
    
         
             
                  }
         
     | 
| 
       21775 
     | 
    
         
            -
                  if (typeof this. 
     | 
| 
       21776 
     | 
    
         
            -
                    ele = this. 
     | 
| 
      
 21783 
     | 
    
         
            +
                  if (typeof this.customParseNode == "function") {
         
     | 
| 
      
 21784 
     | 
    
         
            +
                    ele = this.customParseNode.apply(this, [ele]);
         
     | 
| 
       21777 
21785 
     | 
    
         
             
                  }
         
     | 
| 
       21778 
21786 
     | 
    
         
             
                  return ele;
         
     | 
| 
       21779 
21787 
     | 
    
         
             
                },
         
     | 
| 
         @@ -22061,7 +22069,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { 
     | 
|
| 
       22061 
22069 
     | 
    
         
             
                ], 2)) : createCommentVNode("", true)
         
     | 
| 
       22062 
22070 
     | 
    
         
             
              ], 2);
         
     | 
| 
       22063 
22071 
     | 
    
         
             
            }
         
     | 
| 
       22064 
     | 
    
         
            -
            const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v- 
     | 
| 
      
 22072 
     | 
    
         
            +
            const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8d0f0eb2"]]);
         
     | 
| 
       22065 
22073 
     | 
    
         
             
            const iconfont = "";
         
     | 
| 
       22066 
22074 
     | 
    
         
             
            const en_US = {
         
     | 
| 
       22067 
22075 
     | 
    
         
             
              textWrapUp: "Up feed",
         
     | 
| 
         @@ -22244,7 +22252,7 @@ const i18n = (locale) => { 
     | 
|
| 
       22244 
22252 
     | 
    
         
             
                return translations[locale][key];
         
     | 
| 
       22245 
22253 
     | 
    
         
             
              };
         
     | 
| 
       22246 
22254 
     | 
    
         
             
            };
         
     | 
| 
       22247 
     | 
    
         
            -
            const version = "0.1. 
     | 
| 
      
 22255 
     | 
    
         
            +
            const version = "0.1.2";
         
     | 
| 
       22248 
22256 
     | 
    
         
             
            const install = (app, props) => {
         
     | 
| 
       22249 
22257 
     | 
    
         
             
              const locale = (props ? props.locale : "zh_CN") || "zh_CN";
         
     | 
| 
       22250 
22258 
     | 
    
         
             
              app.provide("$editTrans", i18n(locale));
         
     |