From 1d74945dfcf75e33ddc49f3ef4114d884e0ea57b Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Fri, 4 May 2012 16:13:54 -0700 Subject: [PATCH] Fixes for Roan's crazy half-baked commit Change-Id: Ic104debc3a941e4cf8e4dca19633dcad04a0fe0a --- modules/ve2/dm/ve.dm.DocumentSynchronizer.js | 4 ++-- modules/ve2/dm/ve.dm.Surface.js | 2 +- modules/ve2/dm/ve.dm.TransactionProcessor.js | 2 +- tests/ve2/dm/ve.dm.Surface.test.js | 2 +- tests/ve2/index.html | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/ve2/dm/ve.dm.DocumentSynchronizer.js b/modules/ve2/dm/ve.dm.DocumentSynchronizer.js index 649c606637..eabe3aa573 100644 --- a/modules/ve2/dm/ve.dm.DocumentSynchronizer.js +++ b/modules/ve2/dm/ve.dm.DocumentSynchronizer.js @@ -34,7 +34,7 @@ ve.dm.DocumentSynchronizer.prototype.getDocument = function() { * @param {ve.Range} range Range that was annotated */ ve.dm.DocumentSynchronizer.prototype.pushAnnotation = function( range ) { - this.action.push( { + this.actions.push( { 'type': 'annotation', 'range': range } ); @@ -49,7 +49,7 @@ ve.dm.DocumentSynchronizer.prototype.pushAnnotation = function( range ) { * @param to New value of the attribute */ ve.dm.DocumentSynchronizer.prototype.pushAttributeChange = function( node, key, from, to ) { - this.action.push( { + this.actions.push( { 'type': 'attributeChange', 'node': node, 'key': key, diff --git a/modules/ve2/dm/ve.dm.Surface.js b/modules/ve2/dm/ve.dm.Surface.js index aa7570cdbe..6a04363dd3 100644 --- a/modules/ve2/dm/ve.dm.Surface.js +++ b/modules/ve2/dm/ve.dm.Surface.js @@ -60,7 +60,7 @@ ve.dm.Surface.prototype.setSelection = function( selection ) { * @param {ve.dm.Transaction} transactions Tranasction to apply to the document */ ve.dm.Surface.prototype.transact = function( transaction ) { - this.documentModel.commit( transaction ); + ve.dm.TransactionProcessor.commit( this.documentModel, transaction ); this.emit( 'transact', transaction ); }; diff --git a/modules/ve2/dm/ve.dm.TransactionProcessor.js b/modules/ve2/dm/ve.dm.TransactionProcessor.js index 99d68d1c49..7ad08112c0 100644 --- a/modules/ve2/dm/ve.dm.TransactionProcessor.js +++ b/modules/ve2/dm/ve.dm.TransactionProcessor.js @@ -14,7 +14,7 @@ ve.dm.TransactionProcessor = function( doc, transaction, reversed ) { this.document = doc; this.operations = transaction.getOperations(); // TODO add DocumentSynchronizer - //this.synchronizer = new ve.dm.DocumentSynchronizer( this.model ); + this.synchronizer = new ve.dm.DocumentSynchronizer( this.model ); this.reversed = reversed; // Linear model offset that we're currently at diff --git a/tests/ve2/dm/ve.dm.Surface.test.js b/tests/ve2/dm/ve.dm.Surface.test.js index 3a316c7fb5..1f3eb46b58 100644 --- a/tests/ve2/dm/ve.dm.Surface.test.js +++ b/tests/ve2/dm/ve.dm.Surface.test.js @@ -32,7 +32,7 @@ test('setSelection', 1, function(){ test('transact', 1, function(){ var surface = new ve.dm.SurfaceStub(); - var tx = 'transaction'; + var tx = new ve.dm.Transaction(); surface.on('transact', function(){ ok( true, 'transact was emitted'); }); diff --git a/tests/ve2/index.html b/tests/ve2/index.html index 1ad61654a3..1ee60934a0 100644 --- a/tests/ve2/index.html +++ b/tests/ve2/index.html @@ -37,6 +37,7 @@ +