<!DOCTYPE html> <html> <head> <title>Yjs Textarea Example</title> </head> <body> <p>This example shows how to bind a YText type to a DOM Textarea.</p> <p>The content of this textarea is shared with every client who visits this domain.</p> <div class="code-html"> <textarea style="width:80%;" rows=40 autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea> </div> <!-- The actual source file for the following code is found in ./textarea.js. Run `npm run watch` to compile the files --> <script class="code-js" src="./build/textarea.js" type="module"> import * as Y from 'yjs' import { WebsocketProvider } from 'yjs/provider/websocket.js' import { TextareaBinding } from 'yjs/bindings/textarea.js' import * as conf from './exampleConfig.js' const provider = new WebsocketProvider(conf.serverAddress) const ydocument = provider.get('textarea') const type = ydocument.define('textarea', Y.Text) const textarea = document.querySelector('textarea') const binding = new TextareaBinding(type, textarea) window.textareaExample = { provider, ydocument, type, textarea, binding } </script> </body> </html>