added support for getNext/getPrev on insertions
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -281,6 +281,28 @@ module.exports = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Insert.prototype.getNext = function() {
|
||||||
|
var n;
|
||||||
|
n = this.next_cl;
|
||||||
|
while (n.is_deleted && (n.next_cl != null)) {
|
||||||
|
n = n.next_cl;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
};
|
||||||
|
|
||||||
|
Insert.prototype.getPrev = function() {
|
||||||
|
var n;
|
||||||
|
n((function(_this) {
|
||||||
|
return function() {
|
||||||
|
return _this.prev_cl;
|
||||||
|
};
|
||||||
|
})(this));
|
||||||
|
while (n.is_deleted && (n.prev_cl != null)) {
|
||||||
|
n = n.prev_cl;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
};
|
||||||
|
|
||||||
Insert.prototype.applyDelete = function(o) {
|
Insert.prototype.applyDelete = function(o) {
|
||||||
var callLater, garbagecollect, _ref;
|
var callLater, garbagecollect, _ref;
|
||||||
if (this.deleted_by == null) {
|
if (this.deleted_by == null) {
|
||||||
|
|||||||
@@ -385,15 +385,15 @@ module.exports = function() {
|
|||||||
Composition.prototype.callOperationSpecificInsertEvents = function(op) {
|
Composition.prototype.callOperationSpecificInsertEvents = function(op) {
|
||||||
var o;
|
var o;
|
||||||
if (this.composition_ref.next_cl === op) {
|
if (this.composition_ref.next_cl === op) {
|
||||||
o.undo_delta = this.custom_type._apply(op.content);
|
op.undo_delta = this.getCustomType()._apply(op.content);
|
||||||
} else {
|
} else {
|
||||||
o = this.end.prev_cl;
|
o = this.end.prev_cl;
|
||||||
while (o !== op) {
|
while (o !== op) {
|
||||||
this.custom_type._unapply(o.undo_delta);
|
this.getCustomType()._unapply(o.undo_delta);
|
||||||
o = o.next_cl;
|
o = o.next_cl;
|
||||||
}
|
}
|
||||||
while (o !== this.end) {
|
while (o !== this.end) {
|
||||||
o.undo_delta = this.custom_type._apply(o.content);
|
o.undo_delta = this.getCustomType()._apply(o.content);
|
||||||
o = o.next_cl;
|
o = o.next_cl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,7 @@ module.exports = function() {
|
|||||||
Composition.prototype.callOperationSpecificDeleteEvents = function(op, del_op) {};
|
Composition.prototype.callOperationSpecificDeleteEvents = function(op, del_op) {};
|
||||||
|
|
||||||
Composition.prototype.applyDelta = function(delta) {
|
Composition.prototype.applyDelta = function(delta) {
|
||||||
(new ops.Insert(null, content, this, null, this.end.prev_cl, this.end)).execute();
|
(new ops.Insert(null, delta, this, null, this.end.prev_cl, this.end)).execute();
|
||||||
return void 0;
|
return void 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -328,6 +328,18 @@ module.exports = ()->
|
|||||||
else
|
else
|
||||||
@content
|
@content
|
||||||
|
|
||||||
|
getNext: ()->
|
||||||
|
n = @next_cl
|
||||||
|
while n.is_deleted and n.next_cl?
|
||||||
|
n = n.next_cl
|
||||||
|
n
|
||||||
|
|
||||||
|
getPrev: ()->
|
||||||
|
n => @prev_cl
|
||||||
|
while n.is_deleted and n.prev_cl?
|
||||||
|
n = n.prev_cl
|
||||||
|
n
|
||||||
|
|
||||||
#
|
#
|
||||||
# set content to null and other stuff
|
# set content to null and other stuff
|
||||||
# @private
|
# @private
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user