update
This commit is contained in:
parent
625a64635a
commit
8ba1e4ce27
@ -66,7 +66,7 @@ Y({
|
|||||||
// This will call the observe function (see line 40)
|
// This will call the observe function (see line 40)
|
||||||
// and reflect the change in the DOM
|
// and reflect the change in the DOM
|
||||||
y.share.chat.push([message])
|
y.share.chat.push([message])
|
||||||
this.reset()
|
this.querySelector("[name=message]").value = ""
|
||||||
}
|
}
|
||||||
// Do not send this form!
|
// Do not send this form!
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
36
Examples/Quill/index.html
Normal file
36
Examples/Quill/index.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="../bower_components/quill/dist/quill.snow.css" />
|
||||||
|
<style>
|
||||||
|
#quill {
|
||||||
|
border: 1px solid gray;
|
||||||
|
box-shadow: 0px 0px 10px gray;
|
||||||
|
}
|
||||||
|
#toolbar {
|
||||||
|
border-bottom: 1px solid gray;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="quill">
|
||||||
|
<!-- Create the toolbar container -->
|
||||||
|
<div id="toolbar">
|
||||||
|
<button class="ql-bold">Bold</button>
|
||||||
|
<button class="ql-italic">Italic</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Create the editor container -->
|
||||||
|
<div id="editor">
|
||||||
|
<div>Hello World!</div>
|
||||||
|
<div>Some initial <b>bold</b> text</div>
|
||||||
|
<div><br></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Include the Quill library -->
|
||||||
|
<script src="../bower_components/quill/dist/quill.js"></script>
|
||||||
|
<script src="../bower_components/yjs/y.js"></script>
|
||||||
|
<script src="./index.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
30
Examples/Quill/index.js
Normal file
30
Examples/Quill/index.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/* global Y, Quill */
|
||||||
|
|
||||||
|
// initialize a shared object. This function call returns a promise!
|
||||||
|
|
||||||
|
Y({
|
||||||
|
db: {
|
||||||
|
name: 'memory'
|
||||||
|
},
|
||||||
|
connector: {
|
||||||
|
name: 'websockets-client',
|
||||||
|
room: 'richtext-example'
|
||||||
|
// debug: true
|
||||||
|
// url: 'http://127.0.0.1:2345'
|
||||||
|
},
|
||||||
|
sourceDir: '/bower_components',
|
||||||
|
share: {
|
||||||
|
richtext: 'Richtext' // y.share.richtext is of type Y.Richtext
|
||||||
|
}
|
||||||
|
}).then(function (y) {
|
||||||
|
window.y = y
|
||||||
|
|
||||||
|
// bind the textarea to a shared text element
|
||||||
|
var quill = new Quill('#editor', {
|
||||||
|
modules: {
|
||||||
|
'toolbar': { container: '#toolbar' }
|
||||||
|
},
|
||||||
|
theme: 'snow'
|
||||||
|
})
|
||||||
|
y.share.richtext.bind(quill)
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user