"Is there data?" a.k.a. Insert data only if there is a data to be inserted.

Change-Id: If5957c38668f4dedcba72fc79f9a273614c6dce3
This commit is contained in:
Inez Korczyński 2012-10-17 16:08:02 -07:00
parent 435d45cf9e
commit 4b1b63d357

View file

@ -222,12 +222,15 @@ ve.ce.Surface.prototype.onContentChange = function ( node, previous, next ) {
if ( annotations.getLength() > 0 ) { if ( annotations.getLength() > 0 ) {
ve.dm.Document.addAnnotationsToData( data, annotations ); ve.dm.Document.addAnnotationsToData( data, annotations );
} }
this.model.change( if ( data.length > 0)
ve.dm.Transaction.newFromInsertion( {
this.documentView.model, nodeOffset + 1 + fromLeft, data this.model.change(
), ve.dm.Transaction.newFromInsertion(
next.range this.documentView.model, nodeOffset + 1 + fromLeft, data
); ),
next.range
);
}
if ( fromLeft + fromRight < previous.text.length ) { if ( fromLeft + fromRight < previous.text.length ) {
this.model.change( this.model.change(
ve.dm.Transaction.newFromRemoval( ve.dm.Transaction.newFromRemoval(