remirror
remirror copied to clipboard
Migrate from 2 to 3 throws ts error in prosemirrorNodeToHtml
Summary
When updating from 2 to 3 I get this typescript error. I suspect that it is some internal dependecies that are not correct. It is complaining about Property 'linebreakReplacement' is missing in type when passing state.doc into prosemirrorNodeToHtml.
It seems that something is colliding between prosemirror/model and prosemirror/view
Steps to reproduce
- Use
prosemirrorNodeToHtmlin version 2 passing instate.doc - Do the same thing after updating to newest
remirror@remirror/pmand@remirror/react
"@remirror/pm": "^3.0.0",
"@remirror/react": "^3.0.1",
"remirror": "^3.0.1",
Expected results
prosemirrorNodeToHtml should accept state.doc
Actual results
prosemirrorNodeToHtml throws an error (see image)
Possible Solution
Screenshot(s)
@apdrsn - Are you still able to reproduce this? I'm not. Here's what I tried:
- Setup a minimal app:
npx create-react-app my-app --template typescript - Install remirror dependencies:
npm install --save remirror @remirror/react @remirror/pm"@remirror/pm": "^3.0.0", "@remirror/react": "^3.0.1", "remirror": "^3.0.1", - Update
App.tsximport React from "react"; import { htmlToProsemirrorNode, prosemirrorNodeToHtml } from "remirror"; import { CodeExtension } from "remirror/extensions"; import { Remirror, ThemeProvider, useRemirror } from "@remirror/react"; import "remirror/styles/all.css"; import "./App.css"; const extensions = () => [new CodeExtension()]; function App() { const { manager, state, onChange } = useRemirror({ extensions: extensions, content: "<p>Text as <code>code</code></p>", stringHandler: htmlToProsemirrorNode, }); const html = prosemirrorNodeToHtml(state.doc); return ( <div className="App"> <ThemeProvider> <Remirror manager={manager} onChange={onChange} initialContent={state} autoRender="end" ></Remirror> </ThemeProvider> HTML: <textarea>{html}</textarea> </div> ); } export default App; - Build the app:
npm run build
I didn't see any type errors in the editor (VSCode) nor during build.