use-prosemirror
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -49,7 +49,5 @@ "use strict"; | ||
const viewRef = react_1.useRef(null); | ||
(_b = viewRef.current) === null || _b === void 0 ? void 0 : _b.update(props); | ||
(_b = viewRef.current) === null || _b === void 0 ? void 0 : _b.update(buildProps(props)); | ||
react_1.useEffect(() => { | ||
const view = new prosemirror_view_1.EditorView(root.current, Object.assign(Object.assign({}, initialProps.current), { dispatchTransaction: transaction => { | ||
onChangeRef.current(view.state.apply(transaction)); | ||
} })); | ||
const view = new prosemirror_view_1.EditorView(root.current, buildProps(initialProps.current)); | ||
viewRef.current = view; | ||
@@ -66,2 +64,7 @@ return () => { | ||
return react_1.default.createElement("div", { ref: root, style: style, className: className }); | ||
function buildProps(props) { | ||
return Object.assign(Object.assign({}, props), { dispatchTransaction: transaction => { | ||
onChangeRef.current(viewRef.current.state.apply(transaction)); | ||
} }); | ||
} | ||
}); |
{ | ||
"name": "use-prosemirror", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "ProseMirror for React", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -5,2 +5,8 @@ # use-prosemirror | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [`useProseMirror(config)`](#useprosemirrorconfig) | ||
- [`<ProseMirror />`](#prosemirror-) | ||
- [More Info](#more-info) | ||
[ProseMirror](https://prosemirror.net/) is one of the best rich text editors out there. | ||
@@ -7,0 +13,0 @@ Although it's not written in React, its render model is very |
11453
115
135