no start content in prosemirror example
This commit is contained in:
parent
656d85c62e
commit
70a0a03130
18
README.v13.md
Normal file
18
README.v13.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 
|
||||||
|
> A CRDT library with a powerful abstraction of shared data
|
||||||
|
|
||||||
|
Yjs v13 is a work in progress.
|
||||||
|
|
||||||
|
### Typescript Declarations
|
||||||
|
|
||||||
|
Until [this](https://github.com/Microsoft/TypeScript/issues/7546) is fixed, the only way to get type declarations is by adding Yjs to the list of checked files:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"checkJs": true,
|
||||||
|
"include": [
|
||||||
|
"./node_modules/yjs/"
|
||||||
|
]
|
||||||
|
..
|
||||||
|
}
|
||||||
|
```
|
31
examples/dom.html
Normal file
31
examples/dom.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Yjs Prosemirror Example</title>
|
||||||
|
<link rel=stylesheet href="https://prosemirror.net/css/editor.css">
|
||||||
|
<style>
|
||||||
|
#content {
|
||||||
|
min-height: 500px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="code-html">
|
||||||
|
<div id="content" contenteditable=""></div>
|
||||||
|
</div>
|
||||||
|
<script class="code-js" src="./build/dom.js">
|
||||||
|
import * as Y from 'yjs/index.mjs'
|
||||||
|
import { WebsocketProvider } from 'yjs/provider/websocket.mjs'
|
||||||
|
import { DomBinding } from 'yjs/bindings/dom.mjs'
|
||||||
|
|
||||||
|
const provider = new WebsocketProvider('wss://api.yjs.website')
|
||||||
|
const ydocument = provider.get('dom')
|
||||||
|
const type = ydocument.define('xml', Y.XmlFragment)
|
||||||
|
const binding = new DomBinding(type, document.querySelector('#content'), { scrollingElement: document.scrollingElement })
|
||||||
|
|
||||||
|
window.example = {
|
||||||
|
provider, ydocument, type, binding
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
12
examples/dom.mjs
Normal file
12
examples/dom.mjs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as Y from '../index.mjs'
|
||||||
|
import { WebsocketProvider } from '../provider/websocket.mjs'
|
||||||
|
import { DomBinding } from '../bindings/dom.mjs'
|
||||||
|
|
||||||
|
const provider = new WebsocketProvider('wss://api.yjs.website')
|
||||||
|
const ydocument = provider.get('dom')
|
||||||
|
const type = ydocument.define('xml', Y.XmlFragment)
|
||||||
|
const binding = new DomBinding(type, document.querySelector('#content'), { scrollingElement: document.scrollingElement })
|
||||||
|
|
||||||
|
window.example = {
|
||||||
|
provider, ydocument, type, binding
|
||||||
|
}
|
@ -43,10 +43,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="code-html">
|
<div class="code-html">
|
||||||
<div id="editor" style="margin-bottom: 23px"></div>
|
<div id="editor" style="margin-bottom: 23px"></div>
|
||||||
<div style="display: none" id="content">
|
<div style="display: none" id="content"></div>
|
||||||
<h3>Hello User</h3>
|
|
||||||
<p>type here ...</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<script class="code-js" src="./build/prosemirror.js">
|
<script class="code-js" src="./build/prosemirror.js">
|
||||||
import * as Y from 'yjs'
|
import * as Y from 'yjs'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user