mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
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:
parent
9740d1683e
commit
0c2b6c353e
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in a new issue