Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* Created by dario on 11.05.17.
*/
import ShareDB from 'sharedb/lib/client';
import RichText from 'rich-text';
import CollabForm from './CollabForm';
import CollabEditor from './CollabEditor';
import CollabRichEditor from './CollabRichEditor';
import { Quill } from 'react-quill';
import DragAndDropModule from './DragAndDropModule';
// Register rich-text type on the client
ShareDB.types.register(RichText.type);
// Register module Drag and Drop into Quill
Quill.register('modules/dragAndDrop', DragAndDropModule);
export { CollabForm, CollabEditor, CollabRichEditor };
var Model = require('./Model');
var defaultType = require('sharedb/lib/client').types.defaultType;
Model.BUNDLE_TIMEOUT = 10 * 1000;
Model.INITS.push(function(model, options) {
model.root.bundleTimeout = options.bundleTimeout || Model.BUNDLE_TIMEOUT;
});
Model.prototype.bundle = function(cb) {
var root = this.root;
var timeout = setTimeout(function() {
var message = 'Model bundle took longer than ' + root.bundleTimeout + 'ms';
var err = new Error(message);
cb(err);
// Keep the callback from being called more than once
cb = function() {};
}, root.bundleTimeout);
var util = require('../util');
var Model = require('./Model');
var defaultType = require('sharedb/lib/client').types.defaultType;
module.exports = Query;
Model.INITS.push(function(model) {
model.root._queries = new Queries();
});
Model.prototype.query = function(collectionName, expression, options) {
// DEPRECATED: Passing in a string as the third argument specifies the db
// option for backward compatibility
if (typeof options === 'string') {
options = {db: options};
}
return this._getOrCreateQuery(collectionName, expression, options, Query);
};
var ShareDB = require('sharedb/lib/client');
var richText = require('rich-text');
ShareDB.types.register(richText.type);
// Open WebSocket connection to ShareDB server
var socket = new WebSocket(getWebSocketDocUrl());
var connection = new ShareDB.Connection(socket);
var docSubs = {};
var onTextChanges = {};
var onOps = {};
var realTime = {};
function getWebSocketDocUrl() {
var url = 'wss://' + window.location.host;
return (url.endsWith(':8443')) ? url : url + ':8443';
}
realTime.createAndSubscribeRichTextDoc =
var ReconnectingWebSocket = require('reconnecting-websocket');
var sharedb = require('sharedb/lib/client');
var richText = require('rich-text');
var Quill = require('quill');
sharedb.types.register(richText.type);
// Open WebSocket connection to ShareDB server
var socket = new ReconnectingWebSocket('ws://' + window.location.host);
var connection = new sharedb.Connection(socket);
// For testing reconnection
window.disconnect = function() {
connection.close();
};
window.connect = function() {
var socket = new ReconnectingWebSocket('ws://' + window.location.host);
connection.bindToSocket(socket);
};
// Create local Doc instance mapped to 'examples' collection document with id 'richtext'
var doc = connection.get('examples', 'richtext');
'use babel';
import CoeditorView from './coeditor-view';
import { CompositeDisposable, Range } from 'atom';
import ShareDB from 'sharedb/lib/client';
import otText from 'ot-text';
import WebSocket from 'ws';
import crypto from 'crypto';
import path from 'path';
import EventHandler from './EventHandler';
import Router from './router';
ShareDB.types.register(otText.type);
export default {
// config of this package
config: {
serverAddress: {
type: 'string',
default: '192.168.1.175:9090',
order: 1
},
clientId: {
type: 'string',
default: crypto.randomBytes(5).toString('hex'),
order: 2
},
indicatorBackgroundColor: {
var ShareDB = require('sharedb/lib/client');
var Quill = require('quill');
var ReconnectingWebSocket = require('reconnectingwebsocket');
var cursors = require('./cursors' );
var utils = require('./utils');
import QuillCursors from 'quill-cursors/src/cursors';
ShareDB.types.register(require('rich-text').type);
Quill.register('modules/cursors', QuillCursors);
var shareDBSocket = new ReconnectingWebSocket(((location.protocol === 'https:') ? 'wss' : 'ws') + '://' + window.location.host + '/sharedb');
var shareDBConnection = new ShareDB.Connection(shareDBSocket);
var quill = window.quill = new Quill('#editor', {
theme: 'snow',
modules: {
cursors: {
autoRegisterListener: false
},
history: {
userOnly: true
}