From 8ba1e4ce27a75bb025a5478723ea57f7f437ccf0 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Fri, 18 Dec 2015 16:34:00 +0100 Subject: [PATCH] update --- Examples/Chat/index.js | 2 +- Examples/Quill/index.html | 36 ++++++++++++++++++++++++++++++++++++ Examples/Quill/index.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 Examples/Quill/index.html create mode 100644 Examples/Quill/index.js diff --git a/Examples/Chat/index.js b/Examples/Chat/index.js index 5a08c8b5..c8d106df 100644 --- a/Examples/Chat/index.js +++ b/Examples/Chat/index.js @@ -66,7 +66,7 @@ Y({ // This will call the observe function (see line 40) // and reflect the change in the DOM y.share.chat.push([message]) - this.reset() + this.querySelector("[name=message]").value = "" } // Do not send this form! event.preventDefault() diff --git a/Examples/Quill/index.html b/Examples/Quill/index.html new file mode 100644 index 00000000..0d452927 --- /dev/null +++ b/Examples/Quill/index.html @@ -0,0 +1,36 @@ + + + + + + + +
+ +
+ + +
+ + +
+
Hello World!
+
Some initial bold text
+

+
+
+ + + + + + + diff --git a/Examples/Quill/index.js b/Examples/Quill/index.js new file mode 100644 index 00000000..d73cc66e --- /dev/null +++ b/Examples/Quill/index.js @@ -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) +})