marsprince / slate-vue

slate.js implement for Vue2 and Vue3
https://marsprince.github.io/slate-vue
MIT License
141 stars 20 forks source link

Fix patch package #130

Open benjipott opened 2 years ago

benjipott commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch slate-vue@0.2.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/slate-vue/plugins/slate-plugin.ts b/node_modules/slate-vue/plugins/slate-plugin.ts
index f17af8b..c4eeb13 100644
--- a/node_modules/slate-vue/plugins/slate-plugin.ts
+++ b/node_modules/slate-vue/plugins/slate-plugin.ts
@@ -1,4 +1,4 @@
-import { createEditor, Operation, Editor, Range } from 'slate';
+import { createEditor, Operation, Editor, Range, Node } from 'slate';
 import {hooks} from './vue-hooks';
 import {withVue} from './with-vue';
 import Vue from 'vue'
@@ -21,7 +21,7 @@ const createGvm = () => {
         const editor = GVM_TO_EDITOR.get(this) as VueEditor
         const {selection} = editor
         if(selection) {
-          this.selected.elements.forEach(node => {
+          this.selected.elements.forEach((node: Node) => {
             const key = NODE_TO_KEY.get(node)
             if(key) {
               const {id} = key

This issue body was partially generated by patch-package.