Compare commits

..

1 Commits

Author SHA1 Message Date
Kevin Jahns
70e8ed37e4 v13.0.0-52 -- distribution files 2018-02-18 19:20:34 +01:00
11 changed files with 31 additions and 19539 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "yjs", "name": "yjs",
"version": "13.0.0-54", "version": "13.0.0-52",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "yjs", "name": "yjs",
"version": "13.0.0-54", "version": "13.0.0-52",
"description": "A framework for real-time p2p shared editing on any data", "description": "A framework for real-time p2p shared editing on any data",
"main": "./y.node.js", "main": "./y.node.js",
"browser": "./y.js", "browser": "./y.js",

View File

@@ -4,10 +4,8 @@ import { readDeleteSet, writeDeleteSet } from './deleteSet.js'
import BinaryEncoder from '../Binary/Encoder.js' import BinaryEncoder from '../Binary/Encoder.js'
export function fromBinary (y, decoder) { export function fromBinary (y, decoder) {
y.transact(function () { integrateRemoteStructs(y, decoder)
integrateRemoteStructs(y, decoder) readDeleteSet(y, decoder)
readDeleteSet(y, decoder)
})
} }
export function toBinary (y) { export function toBinary (y) {

View File

@@ -77,19 +77,18 @@ export default class Item {
if (parent._redone !== null) { if (parent._redone !== null) {
parent = parent._redone parent = parent._redone
// find next cloned items // find next cloned items
while (left !== null) { while (left !== null && left._redone === null) {
if (left._redone !== null && left._redone._parent === parent) {
left = left._redone
break
}
left = left._left left = left._left
} }
while (right !== null) { if (left !== null) {
if (right._redone !== null && right._redone._parent === parent) { left = left._redone
right = right._redone }
} while (right !== null && right._redone === null) {
right = right._right right = right._right
} }
if (right !== null) {
right = right._redone
}
} }
struct._origin = left struct._origin = left
struct._left = left struct._left = left

View File

@@ -73,7 +73,6 @@ export default class UndoManager {
this._scope = scope this._scope = scope
this._undoing = false this._undoing = false
this._redoing = false this._redoing = false
this._lastTransactionWasUndo = false
const y = scope._y const y = scope._y
this.y = y this.y = y
y.on('afterTransaction', (y, transaction, remote) => { y.on('afterTransaction', (y, transaction, remote) => {
@@ -81,12 +80,7 @@ export default class UndoManager {
let reverseOperation = new ReverseOperation(y, transaction) let reverseOperation = new ReverseOperation(y, transaction)
if (!this._undoing) { if (!this._undoing) {
let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null
if ( if (lastUndoOp !== null && reverseOperation.created - lastUndoOp.created <= options.captureTimeout) {
this._redoing === false &&
this._lastTransactionWasUndo === false &&
lastUndoOp !== null &&
reverseOperation.created - lastUndoOp.created <= options.captureTimeout
) {
lastUndoOp.created = reverseOperation.created lastUndoOp.created = reverseOperation.created
if (reverseOperation.toState !== null) { if (reverseOperation.toState !== null) {
lastUndoOp.toState = reverseOperation.toState lastUndoOp.toState = reverseOperation.toState
@@ -96,14 +90,12 @@ export default class UndoManager {
} }
reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs) reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs)
} else { } else {
this._lastTransactionWasUndo = false
this._undoBuffer.push(reverseOperation) this._undoBuffer.push(reverseOperation)
} }
if (!this._redoing) { if (!this._redoing) {
this._redoBuffer = [] this._redoBuffer = []
} }
} else { } else {
this._lastTransactionWasUndo = true
this._redoBuffer.push(reverseOperation) this._redoBuffer.push(reverseOperation)
} }
} }

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

View File

@@ -1,7 +1,7 @@
/** /**
* 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 v13.0.0-54 * @version v13.0.0-52
* @license MIT * @license MIT
*/ */
@@ -1366,19 +1366,18 @@ class Item {
if (parent._redone !== null) { if (parent._redone !== null) {
parent = parent._redone; parent = parent._redone;
// find next cloned items // find next cloned items
while (left !== null) { while (left !== null && left._redone === null) {
if (left._redone !== null && left._redone._parent === parent) {
left = left._redone;
break
}
left = left._left; left = left._left;
} }
while (right !== null) { if (left !== null) {
if (right._redone !== null && right._redone._parent === parent) { left = left._redone;
right = right._redone; }
} while (right !== null && right._redone === null) {
right = right._right; right = right._right;
} }
if (right !== null) {
right = right._redone;
}
} }
struct._origin = left; struct._origin = left;
struct._left = left; struct._left = left;
@@ -3746,7 +3745,6 @@ class UndoManager {
this._scope = scope; this._scope = scope;
this._undoing = false; this._undoing = false;
this._redoing = false; this._redoing = false;
this._lastTransactionWasUndo = false;
const y = scope._y; const y = scope._y;
this.y = y; this.y = y;
y.on('afterTransaction', (y, transaction, remote) => { y.on('afterTransaction', (y, transaction, remote) => {
@@ -3754,12 +3752,7 @@ class UndoManager {
let reverseOperation = new ReverseOperation(y, transaction); let reverseOperation = new ReverseOperation(y, transaction);
if (!this._undoing) { if (!this._undoing) {
let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null; let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null;
if ( if (lastUndoOp !== null && reverseOperation.created - lastUndoOp.created <= options.captureTimeout) {
this._redoing === false &&
this._lastTransactionWasUndo === false &&
lastUndoOp !== null &&
reverseOperation.created - lastUndoOp.created <= options.captureTimeout
) {
lastUndoOp.created = reverseOperation.created; lastUndoOp.created = reverseOperation.created;
if (reverseOperation.toState !== null) { if (reverseOperation.toState !== null) {
lastUndoOp.toState = reverseOperation.toState; lastUndoOp.toState = reverseOperation.toState;
@@ -3769,14 +3762,12 @@ class UndoManager {
} }
reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs); reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs);
} else { } else {
this._lastTransactionWasUndo = false;
this._undoBuffer.push(reverseOperation); this._undoBuffer.push(reverseOperation);
} }
if (!this._redoing) { if (!this._redoing) {
this._redoBuffer = []; this._redoBuffer = [];
} }
} else { } else {
this._lastTransactionWasUndo = true;
this._redoBuffer.push(reverseOperation); this._redoBuffer.push(reverseOperation);
} }
} }
@@ -4650,10 +4641,8 @@ class AbstractConnector {
} }
function fromBinary (y, decoder) { function fromBinary (y, decoder) {
y.transact(function () { integrateRemoteStructs(y, decoder);
integrateRemoteStructs(y, decoder); readDeleteSet(y, decoder);
readDeleteSet(y, decoder);
});
} }
function toBinary (y) { function toBinary (y) {

File diff suppressed because one or more lines are too long

19485
y.test.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long