Compare commits
6 Commits
v13.0.0-52
...
v13.0.0-54
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55f0abcdfc | ||
|
|
079de07eff | ||
|
|
54453e87fa | ||
|
|
1b0e3659c3 | ||
|
|
641f426339 | ||
|
|
fcbca65d8f |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yjs",
|
||||
"version": "13.0.0-52",
|
||||
"version": "13.0.0-54",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yjs",
|
||||
"version": "13.0.0-52",
|
||||
"version": "13.0.0-54",
|
||||
"description": "A framework for real-time p2p shared editing on any data",
|
||||
"main": "./y.node.js",
|
||||
"browser": "./y.js",
|
||||
|
||||
@@ -4,8 +4,10 @@ import { readDeleteSet, writeDeleteSet } from './deleteSet.js'
|
||||
import BinaryEncoder from '../Binary/Encoder.js'
|
||||
|
||||
export function fromBinary (y, decoder) {
|
||||
integrateRemoteStructs(y, decoder)
|
||||
readDeleteSet(y, decoder)
|
||||
y.transact(function () {
|
||||
integrateRemoteStructs(y, decoder)
|
||||
readDeleteSet(y, decoder)
|
||||
})
|
||||
}
|
||||
|
||||
export function toBinary (y) {
|
||||
|
||||
@@ -77,18 +77,19 @@ export default class Item {
|
||||
if (parent._redone !== null) {
|
||||
parent = parent._redone
|
||||
// find next cloned items
|
||||
while (left !== null && left._redone === null) {
|
||||
while (left !== null) {
|
||||
if (left._redone !== null && left._redone._parent === parent) {
|
||||
left = left._redone
|
||||
break
|
||||
}
|
||||
left = left._left
|
||||
}
|
||||
if (left !== null) {
|
||||
left = left._redone
|
||||
}
|
||||
while (right !== null && right._redone === null) {
|
||||
while (right !== null) {
|
||||
if (right._redone !== null && right._redone._parent === parent) {
|
||||
right = right._redone
|
||||
}
|
||||
right = right._right
|
||||
}
|
||||
if (right !== null) {
|
||||
right = right._redone
|
||||
}
|
||||
}
|
||||
struct._origin = left
|
||||
struct._left = left
|
||||
|
||||
@@ -73,6 +73,7 @@ export default class UndoManager {
|
||||
this._scope = scope
|
||||
this._undoing = false
|
||||
this._redoing = false
|
||||
this._lastTransactionWasUndo = false
|
||||
const y = scope._y
|
||||
this.y = y
|
||||
y.on('afterTransaction', (y, transaction, remote) => {
|
||||
@@ -80,7 +81,12 @@ export default class UndoManager {
|
||||
let reverseOperation = new ReverseOperation(y, transaction)
|
||||
if (!this._undoing) {
|
||||
let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null
|
||||
if (lastUndoOp !== null && reverseOperation.created - lastUndoOp.created <= options.captureTimeout) {
|
||||
if (
|
||||
this._redoing === false &&
|
||||
this._lastTransactionWasUndo === false &&
|
||||
lastUndoOp !== null &&
|
||||
reverseOperation.created - lastUndoOp.created <= options.captureTimeout
|
||||
) {
|
||||
lastUndoOp.created = reverseOperation.created
|
||||
if (reverseOperation.toState !== null) {
|
||||
lastUndoOp.toState = reverseOperation.toState
|
||||
@@ -90,12 +96,14 @@ export default class UndoManager {
|
||||
}
|
||||
reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs)
|
||||
} else {
|
||||
this._lastTransactionWasUndo = false
|
||||
this._undoBuffer.push(reverseOperation)
|
||||
}
|
||||
if (!this._redoing) {
|
||||
this._redoBuffer = []
|
||||
}
|
||||
} else {
|
||||
this._lastTransactionWasUndo = true
|
||||
this._redoBuffer.push(reverseOperation)
|
||||
}
|
||||
}
|
||||
|
||||
35
y.node.js
35
y.node.js
@@ -1,7 +1,7 @@
|
||||
|
||||
/**
|
||||
* yjs - A framework for real-time p2p shared editing on any data
|
||||
* @version v13.0.0-52
|
||||
* @version v13.0.0-54
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
@@ -1366,18 +1366,19 @@ class Item {
|
||||
if (parent._redone !== null) {
|
||||
parent = parent._redone;
|
||||
// find next cloned items
|
||||
while (left !== null && left._redone === null) {
|
||||
while (left !== null) {
|
||||
if (left._redone !== null && left._redone._parent === parent) {
|
||||
left = left._redone;
|
||||
break
|
||||
}
|
||||
left = left._left;
|
||||
}
|
||||
if (left !== null) {
|
||||
left = left._redone;
|
||||
}
|
||||
while (right !== null && right._redone === null) {
|
||||
while (right !== null) {
|
||||
if (right._redone !== null && right._redone._parent === parent) {
|
||||
right = right._redone;
|
||||
}
|
||||
right = right._right;
|
||||
}
|
||||
if (right !== null) {
|
||||
right = right._redone;
|
||||
}
|
||||
}
|
||||
struct._origin = left;
|
||||
struct._left = left;
|
||||
@@ -3745,6 +3746,7 @@ class UndoManager {
|
||||
this._scope = scope;
|
||||
this._undoing = false;
|
||||
this._redoing = false;
|
||||
this._lastTransactionWasUndo = false;
|
||||
const y = scope._y;
|
||||
this.y = y;
|
||||
y.on('afterTransaction', (y, transaction, remote) => {
|
||||
@@ -3752,7 +3754,12 @@ class UndoManager {
|
||||
let reverseOperation = new ReverseOperation(y, transaction);
|
||||
if (!this._undoing) {
|
||||
let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null;
|
||||
if (lastUndoOp !== null && reverseOperation.created - lastUndoOp.created <= options.captureTimeout) {
|
||||
if (
|
||||
this._redoing === false &&
|
||||
this._lastTransactionWasUndo === false &&
|
||||
lastUndoOp !== null &&
|
||||
reverseOperation.created - lastUndoOp.created <= options.captureTimeout
|
||||
) {
|
||||
lastUndoOp.created = reverseOperation.created;
|
||||
if (reverseOperation.toState !== null) {
|
||||
lastUndoOp.toState = reverseOperation.toState;
|
||||
@@ -3762,12 +3769,14 @@ class UndoManager {
|
||||
}
|
||||
reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs);
|
||||
} else {
|
||||
this._lastTransactionWasUndo = false;
|
||||
this._undoBuffer.push(reverseOperation);
|
||||
}
|
||||
if (!this._redoing) {
|
||||
this._redoBuffer = [];
|
||||
}
|
||||
} else {
|
||||
this._lastTransactionWasUndo = true;
|
||||
this._redoBuffer.push(reverseOperation);
|
||||
}
|
||||
}
|
||||
@@ -4641,8 +4650,10 @@ class AbstractConnector {
|
||||
}
|
||||
|
||||
function fromBinary (y, decoder) {
|
||||
integrateRemoteStructs(y, decoder);
|
||||
readDeleteSet(y, decoder);
|
||||
y.transact(function () {
|
||||
integrateRemoteStructs(y, decoder);
|
||||
readDeleteSet(y, decoder);
|
||||
});
|
||||
}
|
||||
|
||||
function toBinary (y) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
y.test.js.map
Normal file
1
y.test.js.map
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user