Compare commits

...

2 Commits

Author SHA1 Message Date
Kevin Jahns
e1108d4007 Deploy 12.1.5 2017-03-06 13:27:26 +01:00
Kevin Jahns
c00dee819f Deploy 12.1.4 2016-12-19 10:41:55 +01:00
8 changed files with 37 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
#ace { #aceContainer {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
@@ -23,7 +23,7 @@
</head> </head>
<body> <body>
<div id="ace"></div> <div id="aceContainer"></div>
<script src="../bower_components/yjs/y.es6"></script> <script src="../bower_components/yjs/y.es6"></script>
<script src="../bower_components/ace-builds/src/ace.js"></script> <script src="../bower_components/ace-builds/src/ace.js"></script>

View File

@@ -17,7 +17,7 @@ Y({
window.yAce = y window.yAce = y
// bind the textarea to a shared text element // bind the textarea to a shared text element
var editor = ace.edit('ace') var editor = ace.edit('aceContainer')
editor.setTheme('ace/theme/chrome') editor.setTheme('ace/theme/chrome')
editor.getSession().setMode('ace/mode/javascript') editor.getSession().setMode('ace/mode/javascript')

View File

@@ -41,6 +41,12 @@ Connectors, Databases, and Types are available as modules that extend Yjs. Here
|[text](https://github.com/y-js/y-text) | Collaborate on text. Supports two way binding to the [Ace Editor](https://ace.c9.io), textareas, input elements, and HTML elements (e.g. <*h1*>, or <*p*>) | |[text](https://github.com/y-js/y-text) | Collaborate on text. Supports two way binding to the [Ace Editor](https://ace.c9.io), textareas, input elements, and HTML elements (e.g. <*h1*>, or <*p*>) |
|[richtext](https://github.com/y-js/y-richtext) | Collaborate on rich text. Supports two way binding to the [Quill Rich Text Editor](http://quilljs.com/)| |[richtext](https://github.com/y-js/y-richtext) | Collaborate on rich text. Supports two way binding to the [Quill Rich Text Editor](http://quilljs.com/)|
##### Other
| Name | Description |
|-----------|-------------------|
|[y-element](http://y-js.org/y-element/) | Yjs Polymer Element |
## Use it! ## Use it!
Install Yjs, and its modules with [bower](http://bower.io/), or [npm](https://www.npmjs.org/package/yjs). Install Yjs, and its modules with [bower](http://bower.io/), or [npm](https://www.npmjs.org/package/yjs).
@@ -145,6 +151,7 @@ Report _any_ issues to the [Github issue page](https://github.com/y-js/yjs/issue
* All our connectors implement a `room` property. Clients that specify the same room share the same data. * All our connectors implement a `room` property. Clients that specify the same room share the same data.
* All of our connectors specify an `url` property that defines the connection endpoint of the used connector. * All of our connectors specify an `url` property that defines the connection endpoint of the used connector.
* All of our connectors also have a default connection endpoint that you can use for development. * All of our connectors also have a default connection endpoint that you can use for development.
* Set `options.connector.generateUserId = true` in order to genenerate a userid, instead of receiving one from the server. This way the `Y(..)` is immediately going to be resolved, without waiting for any confirmation from the server. Use with caution.
* Have a look at the used connector repository to see all available options. * Have a look at the used connector repository to see all available options.
* options.sourceDir (browser only) * options.sourceDir (browser only)
* Path where all y-* modules are stored * Path where all y-* modules are stored
@@ -267,4 +274,3 @@ I created this framework during my bachelor thesis at the chair of computer scie
Yjs is licensed under the [MIT License](./LICENSE). Yjs is licensed under the [MIT License](./LICENSE).
<yjs@dbis.rwth-aachen.de> <yjs@dbis.rwth-aachen.de>

View File

@@ -1,6 +1,6 @@
{ {
"name": "yjs", "name": "yjs",
"version": "12.1.3", "version": "12.1.5",
"homepage": "y-js.org", "homepage": "y-js.org",
"authors": [ "authors": [
"Kevin Jahns <kevin.jahns@rwth-aachen.de>" "Kevin Jahns <kevin.jahns@rwth-aachen.de>"

12
y.es6
View File

@@ -1,6 +1,6 @@
/** /**
* yjs - A framework for real-time p2p shared editing on any data * yjs - A framework for real-time p2p shared editing on any data
* @version v12.1.2 * @version v12.1.4
* @link http://y-js.org * @link http://y-js.org
* @license MIT * @license MIT
*/ */
@@ -66,6 +66,9 @@ module.exports = function (Y/* :any */) {
this.protocolVersion = 11 this.protocolVersion = 11
this.authInfo = opts.auth || null this.authInfo = opts.auth || null
this.checkAuth = opts.checkAuth || function () { return Promise.resolve('write') } // default is everyone has write access this.checkAuth = opts.checkAuth || function () { return Promise.resolve('write') } // default is everyone has write access
if (opts.generateUserId === true) {
this.setUserId(Y.utils.generateGuid())
}
} }
resetAuth (auth) { resetAuth (auth) {
if (this.authInfo !== auth) { if (this.authInfo !== auth) {
@@ -1522,7 +1525,7 @@ module.exports = function (Y/* :any */) {
} }
// try to merge original op.left and op.origin // try to merge original op.left and op.origin
for (let i = 0; i < tryToRemergeLater.length; i++) { for (i = 0; i < tryToRemergeLater.length; i++) {
var m = yield* this.getOperation(tryToRemergeLater[i]) var m = yield* this.getOperation(tryToRemergeLater[i])
yield* this.tryCombineWithLeft(m) yield* this.tryCombineWithLeft(m)
} }
@@ -3471,6 +3474,11 @@ module.exports = function (Y /* : any*/) {
return SmallLookupBuffer return SmallLookupBuffer
} }
Y.utils.createSmallLookupBuffer = createSmallLookupBuffer Y.utils.createSmallLookupBuffer = createSmallLookupBuffer
// Generates a unique id, for use as a user id.
// Thx to @jed for this script https://gist.github.com/jed/982883
function generateGuid(a){return a?(a^Math.random()*16>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,generateGuid)} // eslint-disable-line
Y.utils.generateGuid = generateGuid
} }
},{}],7:[function(require,module,exports){ },{}],7:[function(require,module,exports){

File diff suppressed because one or more lines are too long

8
y.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long