From 7f97520af28e1dc9092da2e274e92c5a2dca414d Mon Sep 17 00:00:00 2001 From: Catrope Date: Thu, 14 Jun 2012 19:34:30 -0700 Subject: [PATCH] Don't produce an invalid range I know this code is still being worked on but I felt like I should put this in anyway, it might save the person working on it some work Change-Id: I1535399b3798cd8de2fc5334cd1eac64b71e8821 --- modules/ve2/ce/ve.ce.Surface.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/ve2/ce/ve.ce.Surface.js b/modules/ve2/ce/ve.ce.Surface.js index d82109b397..ed84e5b73e 100644 --- a/modules/ve2/ce/ve.ce.Surface.js +++ b/modules/ve2/ce/ve.ce.Surface.js @@ -668,9 +668,15 @@ return; } ); // Create range surrounding the entire sourceNode and remove - var range = new ve.Range(); + /*var range = new ve.Range(); range.from = this.documentView.getDocumentNode().getOffsetFromNode( sourceNode ) - range.to = range.from + sourceNode.model.getOuterLength(); + range.to = range.from + sourceNode.model.getOuterLength();*/ + // Just setting .from and .to produces an invalid range with .start and .end unset --Roan + var from = this.documentView.getDocumentNode().getOffsetFromNode( sourceNode ), + range = new ve.Range( + from, + from + sourceNode.model.getOuterLength() + ); tx = ve.dm.Transaction.newFromRemoval( this.documentView.model, range ); this.model.transact( tx ); }