林一二2020年10月28日 21:24
slate-react/src/components/slate.tsx
这里主要是给 EDITOR_TO_ON_CHANGE 这个 weakmap 设置 onContextChange,里面实际调用 onChange,以便能通过 editor 取到 onChange 来调用。
packages/slate-react/src/plugin/with-react.ts
这里是对各种 Command 例如 insert_text 做处理,更新 NODE_TO_KEY 这个 weakmap 等等。NODE_TO_KEY 会在 slate-react/src/plugin/react-editor.ts#L44 的 findKey 里被用到。