ydoc | document site building tool
kandi X-RAY | ydoc Summary
kandi X-RAY | ydoc Summary
🐶YDoc is a document site building tool that understands you better, and easily generates a complete static site based on markdown
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ydoc
ydoc Key Features
ydoc Examples and Code Snippets
Community Discussions
Trending Discussions on ydoc
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
My main problem is initializing the text/value of a code editor(CodeMirror) on my website without it affecting the way I save/send POST requests to my backend. The following is the pug code I use for the POST request:
...ANSWER
Answered 2020-Jan-15 at 23:13The following is quoted from dmonad who is one of the developers of Yjs. For future reference regarding any technical questions about Yjs, you will probably get better luck asking here as there isn't a tag for Yjs yet on StackOverflow.
Hi @notemaster,
I assume that you mean you are unable to set the value of the CodeMirror editor.
The CodeMirrorBinding binds the value of the Y.Text type to a CodeMirror instance. The setValue method works, but the value of the editor is overwritten by the binding:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ydoc
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