Detect collapsed range inside focusable node in ve.ce.Surface#onChange

When the document starts with a focusable node, and we try to initialise
the selection to [1,1], the current logic does not detect that as being
on the focusable node and tries to do a native selection.

Bug: 54446
Change-Id: Ib515c435314c35c4e9b3802da117b963b3ef4169
This commit is contained in:
Ed Sanders 2013-09-24 16:53:55 +01:00
parent 9740d1683e
commit 0c2b6c353e

View file

@ -924,6 +924,12 @@ ve.ce.Surface.prototype.onChange = function ( transaction, selection ) {
next = start;
}
}
} else {
// Check we haven't been programmatically placed inside a focusable node with a collapsed selection
start = this.documentView.getDocumentNode().getNodeFromOffset( selection.start );
if ( ve.isMixedIn( start, ve.ce.FocusableNode ) ) {
next = start;
}
}
// Update nodes if something changed
if ( previous !== next ) {