no start content in prosemirror example

This commit is contained in:
Kevin Jahns 2018-11-26 16:16:46 +01:00
parent 656d85c62e
commit 70a0a03130
4 changed files with 62 additions and 4 deletions

18
README.v13.md Normal file
View File

@ -0,0 +1,18 @@
# ![Yjs](https://user-images.githubusercontent.com/5553757/48975307-61efb100-f06d-11e8-9177-ee895e5916e5.png)
> 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
View 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
View 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
}

View File

@ -43,10 +43,7 @@
<body>
<div class="code-html">
<div id="editor" style="margin-bottom: 23px"></div>
<div style="display: none" id="content">
<h3>Hello User</h3>
<p>type here ...</p>
</div>
<div style="display: none" id="content"></div>
</div>
<script class="code-js" src="./build/prosemirror.js">
import * as Y from 'yjs'