From 4b1b63d357fdc49a8a894ded94f35172036544e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Inez=20Korczyn=CC=81ski?= Date: Wed, 17 Oct 2012 16:08:02 -0700 Subject: [PATCH] "Is there data?" a.k.a. Insert data only if there is a data to be inserted. Change-Id: If5957c38668f4dedcba72fc79f9a273614c6dce3 --- modules/ve/ce/ve.ce.Surface.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js index d3ac20da69..2829e449a2 100644 --- a/modules/ve/ce/ve.ce.Surface.js +++ b/modules/ve/ce/ve.ce.Surface.js @@ -222,12 +222,15 @@ ve.ce.Surface.prototype.onContentChange = function ( node, previous, next ) { if ( annotations.getLength() > 0 ) { ve.dm.Document.addAnnotationsToData( data, annotations ); } - this.model.change( - ve.dm.Transaction.newFromInsertion( - this.documentView.model, nodeOffset + 1 + fromLeft, data - ), - next.range - ); + if ( data.length > 0) + { + this.model.change( + ve.dm.Transaction.newFromInsertion( + this.documentView.model, nodeOffset + 1 + fromLeft, data + ), + next.range + ); + } if ( fromLeft + fromRight < previous.text.length ) { this.model.change( ve.dm.Transaction.newFromRemoval(