update examples

This commit is contained in:
Kevin Jahns
2016-09-20 18:29:19 +02:00
parent 4726c71dd0
commit 0b14e90585
9 changed files with 153 additions and 134 deletions

View File

@@ -43,9 +43,7 @@ Y({
// call drawLine every time an array is appended
y.share.drawing.observe(function (event) {
if (event.type === 'insert') {
event.values().then(function (values) {
values.forEach(drawLine)
})
event.values.forEach(drawLine)
} else {
// just remove all elements (thats what we do anyway)
svg.selectAll('path').remove()
@@ -53,7 +51,7 @@ Y({
})
// draw all existing content
for (var i = 0; i < drawing.length; i++) {
drawing.get(i).then(drawLine)
drawLine(drawing.get(i))
}
// clear canvas on request
@@ -64,9 +62,7 @@ Y({
var sharedLine = null
function dragstart () {
drawing.insert(drawing.length, [Y.Array])
drawing.get(drawing.length - 1).then(function (array) {
sharedLine = array
})
sharedLine = drawing.get(drawing.length - 1)
}
// After one dragged event is recognized, we ignore them for 33ms.

View File

@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<!-- 1.0.0-rc.0 does currently not include dist files! We are using the hosted version instead -->
<!-- quill does not include dist files! We are using the hosted version instead -->
<!--link rel="stylesheet" href="../bower_components/quill/dist/quill.snow.css" /-->
<link href="//cdn.quilljs.com/1.0.0-rc.2/quill.snow.css" rel="stylesheet">
<link href="https://cdn.quilljs.com/1.0.4/quill.snow.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/monokai-sublime.min.css" rel="stylesheet">
<style>
@@ -21,8 +21,8 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/highlight.min.js" type="text/javascript"></script>
<script src="//cdn.quilljs.com/1.0.0-rc.2/quill.js"></script>
<!-- 1.0.0-rc.0 does currently not include dist files! We are using the hosted version instead (see above)
<script src="https://cdn.quilljs.com/1.0.4/quill.js"></script>
<!-- quill does not include dist files! We are using the hosted version instead (see above)
<script src="../bower_components/quill/dist/quill.js"></script>
-->
<script src="../bower_components/yjs/y.es6"></script>

View File

@@ -7,8 +7,8 @@ Y({
name: 'memory'
},
connector: {
name: 'webrtc',
room: 'richtext-example-quill-beta'
name: 'websockets-client',
room: 'richtext-example-quill-1.0'
},
sourceDir: '/bower_components',
share: {

View File

@@ -16,8 +16,6 @@ Y({
}).then(function (y) {
window.yXml = y
// bind xml type to a dom, and put it in body
y.share.xml.getDom().then(function (dom) {
window.sharedDom = dom
document.body.appendChild(dom)
})
window.sharedDom = y.share.xml.getDom()
document.body.appendChild(window.sharedDom)
})