|
|
@ -1443,7 +1443,13 @@ var rebase = Operation.rebase = function (oldOp, newOp) {
|
|
|
|
* @param transformBy an existing operation which also has the same base.
|
|
|
|
* @param transformBy an existing operation which also has the same base.
|
|
|
|
* @return toTransform *or* null if the result is a no-op.
|
|
|
|
* @return toTransform *or* null if the result is a no-op.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
var transform0 = Operation.transform0 = function (text, toTransform, transformBy) {
|
|
|
|
|
|
|
|
|
|
|
|
var transform0 = Operation.transform0 = function (text, toTransformOrig, transformByOrig) {
|
|
|
|
|
|
|
|
// Cloning the original transformations makes this algorithm such that it
|
|
|
|
|
|
|
|
// **DOES NOT MUTATE ANYMORE**
|
|
|
|
|
|
|
|
var toTransform = Operation.clone(toTransformOrig);
|
|
|
|
|
|
|
|
var transformBy = Operation.clone(transformByOrig);
|
|
|
|
|
|
|
|
|
|
|
|
if (toTransform.offset > transformBy.offset) {
|
|
|
|
if (toTransform.offset > transformBy.offset) {
|
|
|
|
if (toTransform.offset > transformBy.offset + transformBy.toRemove) {
|
|
|
|
if (toTransform.offset > transformBy.offset + transformBy.toRemove) {
|
|
|
|
// simple rebase
|
|
|
|
// simple rebase
|
|
|
|