y-prosemirror | ProseMirror editor binding for Yjs | Editor library
kandi X-RAY | y-prosemirror Summary
kandi X-RAY | y-prosemirror Summary
ProseMirror editor binding for Yjs
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert XMirror object to plain javascript object
y-prosemirror Key Features
y-prosemirror Examples and Code Snippets
Community Discussions
Trending Discussions on y-prosemirror
QUESTION
I have a prosemirror based editor that I'd like to enable real-time collaboration on. So I've set up a socket server as described here
I set up the WebsocketProvider
as a useRef()
so that we're not constantly re-creating it everytime we render the component (before I was spinning up dozens of websockets). However, now it's not even getting defined, as the console.log(this.yXmlFragment, this.provider)
in get plugins()
is returning both as undefined
My desired behavior is that I want provider
and yXmlFragment
to be updated only when the sectionID
changes, not for any other re-render. But it's not even being set the first time. Can anyone explain how I'm wrong?
ANSWER
Answered 2021-Apr-20 at 20:48This is happening because you are including sectionID
in the dependency list of the useEffect
within EditorContainer
. Because sectionID
doesn't change on initial load, this useEffect
never fires. I've created a minimal example of this here:
https://codesandbox.io/s/focused-babbage-ilx4j?file=/src/App.js
I recommend changing useEffect
to useMemo
because it runs at least once on initial render of EditorContainer
. And you still get the performance benefit because it shouldn't rerun unless sectionID
changes.
QUESTION
I found a package here: https://stackblitz.com/edit/y-prosemirror-ynw2fg?file=index.ts I have downloaded and enter image description here
I ran npm install
and the dependencies should be installed already.
But when I run node index.ts
or ts-node index.ts
errors show up:
ANSWER
Answered 2020-Sep-26 at 12:23Sorry, I found out how it was done.
Compile the ts into js using babel first or here: https://babeljs.io/repl.
Use browserify to make your files web compatible.
browserify index.js > bundle.js
then include the file to your index.html.
I don't understand why node js has to have so many versions of typescript that isn't compatible with browser. Just making everyone's life more horrible.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install y-prosemirror
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page