P2Pvalue / angular-swellrt

SwellRT integration for angular.js: 3 way data binding (client, model, server) for real time collaboration over a federated infraestructure thanks to SwellRT technology.
GNU General Public License v3.0
7 stars 0 forks source link

Angular-SwellRT

SwellRT integration for angular.js:

Features

3 way data binding (client, model, server) for real time collaboration over a federated infrastructure thanks to SwellRT technology.

Use collaborative javascript models composed by:

Ready to use collaborative rich-text editor:

Use collaborative text edition in your angular projects thanks to the ready to use rich text collaborative editor from SwellRT.

Integrated real-time collaboration

Angular-SwellRT provides an intuitive way to use the powerful SwellRT technology on your angular projects.

The communication and storage of your Angular models has never been so easy: first, you get your object from a SwellRT data model, then, any changes you do in the object propagates in real time to any other client using that data model and is automatically persisted in the SwellRT federated infrastructure.

Getting started

Install

SwellRT server

You have several options for the SwellRT server:

Using a SwellRT model

  angular.module('App').controller('TextEditor', ['swellRT', function(swellRT) {
    window.SwellRT.openModel(modelId, function(model){
      $scope.proxy = swellRT.proxy(model);
      );
    }

Using Angular-SwellRT

Use collaborative javascript models composed by:

Once you get a proxy object of the model, any compatible change will be propagated, some examples are given bellow:

  // add a string to the 'newKey' key of the model
  proxy.newKey = "my new collaborative string";
  // add a list with a simple object and a string to the 'listKey' key of the model
  proxy.listKey = [{foo = "foo"}, "bar"];
  // remove the object at key 'newKey' of the model
  delete proxy.newKey;

Angular-SwellRT collaborative objects have a special attribute _participants to manage the participants of the SwellRT model.

  // add a participant to the model
  proxy._participants.push('foo@local.net');
  // make a model public:
  proxy._participants.push('@local.net');

Non-Compatible changes: Functions and Undefined values and Type changes:

Ready to use collaborative rich-text editor: Rich text objects can be edited through the SwellRT editor. Following example shows how:

note: TextObjects are not observed, since their changes are already propagated by SwellRT. To change the value that the model has at the path where a TextObject is attached, first delete that object.

Files and attachements: Attach files to your collaborative model structure and store them in the SwellRT server. Following example shows how:

Other features

Avatars

a collection of generated avatars can be obtained with the directive swellrtAvatars which receives a list of user names and returns avatars built with their initials. This feature is based in SwellRT avatars

    <div class="swellrt-avatars" ng-model="[foo@bar.net, foobar@baz.com]" swellrt-avatar-options = "{numberOfAvatars : 3}"></div>

See SwellRT avatars to learn what can be used in swellrt-avat-options parameter (size, number of avatars, etc).

Development

Clone angular-swellrt

Clone this repository using git:

git clone P2Pvalue/angular-swellrt.git
cd angular-swellrt

Install dependencies

Angular-swellRT uses npm and bower to manage dependencies, run the following code to get them:

npm install
bower install

Compile changes with Babel:

Angular-swellRT uses Babel to compile its ECMAScript 6 code to a previous javascript version. Following gulp commands does this job, resulting in the file dist/angular-swellrt.js:

To run it once:

gulp dist

To run it for every source code change:

gulp live:dist