Use a blank temp document when selection is empty

shallowCloneFromRange can a broken document if you pass
a collapsed range. That should be fixed upstream but for
now this fixes a major bug (and is faster).

Bug: T150492
Change-Id: I9b539c588d91ef7f22e662c7cae0b3f89b21d33a
This commit is contained in:
Ed Sanders 2016-11-11 00:08:11 +00:00
parent 20b802cc85
commit 003c5ac410

View file

@ -51,7 +51,7 @@ ve.ui.MWWikitextWindowAction.prototype.open = function ( name, data, action ) {
originalFragment = fragment;
originalDocument = originalFragment.getDocument();
coveringRange = originalFragment.getSelection().getCoveringRange();
if ( coveringRange ) {
if ( coveringRange && !coveringRange.isCollapsed() ) {
tempDocument = surface.getModel().getDocument().shallowCloneFromRange( coveringRange );
rangeInDocument = tempDocument.originalRange;
} else {