yjs | Shared data types for building collaborative software | Collaboration library
kandi X-RAY | yjs Summary
kandi X-RAY | yjs Summary
This repository contains a collection of shared types that can be observed for changes and manipulated concurrently. Network functionality and two-way-bindings are implemented in separate modules.
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 yjs
yjs Key Features
yjs Examples and Code Snippets
yarn add zustand-yjs yjs zustand
import * as Y from 'yjs'
import { useYDoc } from 'zustand-yjs'
const connectDoc = (doc: Y.Doc) => {
console.log('connect to a provider with room', doc.guid)
return () => console.log('disconnect', doc.guid)
// you need to create and inject a IPFS object
const IPFS = require('ipfs')
const Y = require('yjs')
require('y-ipfs-connector')(Y)
// other Yjs deps:
require('y-memory')(Y)
require('y-array')(Y)
require('y-text')(Y)
// create IPFS node
const ipf
npm install y-dynamodb --save
const DynamoDbPersistence = require('./src/y-dynamodb')
const Y = require('yjs')
const config = {
aws: {
region: 'us-west-2',
accessKeyId: 'accessKeyId',
secretAccessKey: 'secretAccessKey',
endpoint:
Community Discussions
Trending Discussions on yjs
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:
QUESTION
I am not able to see the cjk characters correctly. It seems that it is mistaken as in ISO-8859 encode. I think the UTF-8 encode is the appropriate one. Does anybody know how to fix the problem.
...ANSWER
Answered 2019-Jun-13 at 17:04https://www.w3.org/International/questions/qa-changing-encoding
Summary:
Step 1: Save the data as UTF-8
Step 2: Declare the encoding in your page
QUESTION
I tried to use Y.js (Yjs) npm package and it works in npm start
but not npm run build
because Uglify doesn't support ES6. So I downloaded the release of that package and include it directly. But my reactjs npm run build
is still complaining about Uglify.
ANSWER
Answered 2018-May-15 at 09:04If you look at what npm run build
does, it actually runs another script, react-scripts build
. Your project is bootstrapped with create-react-app, correct?
As you can see in the package.json
, you also have access to a script called eject
.
Running npm run eject
will allow you to remove the app from the preconfigured workflow ( webpack
, babel
, etc ) and let you modify the workflow as you see fit.
With access to the configuration files, you can add, for example, the babel uglify plugin.
But be careful, there is a trade-off. As the docs mention
If your project needs more customization, you can "eject" and customize it, but then you will need to maintain this configuration.
QUESTION
I tried to build my reactjs app using webpack and babel.
I started this app from react starter which comes with react-scripts build
which worked before. However, it's a black box and didn't really provide all the features I need, especially when it comes to that a module doesn't like UglifyJS.
My webpack.config.js
looks like this which is pretty simple:
ANSWER
Answered 2017-Apr-14 at 19:24Please add babel-preset-env package.
Your .babelrc
should look something like this: (["env" ...]
part is important here)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install yjs
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