no start content in prosemirror example
This commit is contained in:
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>
|
||||
<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'
|
||||
|
||||
Reference in New Issue
Block a user