mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Select the label properly when converting LinkNode to LinkAnnotation
We were selecting outside the annotation, when converting a LinkNode to a LinkAnnotation. This meant that typing would overwrite the annotation as well as the label. Speculatively, this is probably a side-effect of recent changes to how nails and cursor offsets interact. Bug: T121448 Change-Id: Ib2274bc5857294c5b691b3c3567b135d68bfa596 Depends-On: I3954c7f8f8e5870b13a8f6c4f0e86fb3b20b3cd3
This commit is contained in:
parent
7f9ab36d6a
commit
8bb1399c97
|
@ -143,7 +143,12 @@ ve.ui.MWLinkNodeInspector.prototype.getTeardownProcess = function ( data ) {
|
|||
// selection starts inside or outside of the node.
|
||||
// If you can think of a test function for "the selection has stabilised", this could
|
||||
// be moved to ve.scheduler.
|
||||
surfaceView.selectActiveLinkContents();
|
||||
// Note: we can't rely on surfaceView.activeLink, because the selection-focus created
|
||||
// by the transaction might be outside the link node. As such, get the node immediately
|
||||
// after the offset where we inserted the annotation, and then get the closest link
|
||||
// annotation to it.
|
||||
var node = surfaceView.getDocument().getNodeAndOffset( nodeRange.start + 1 ).node;
|
||||
surfaceView.selectNodeContents( $( node ).closest( '.ve-ce-linkAnnotation' )[ 0 ] );
|
||||
} );
|
||||
} else {
|
||||
surfaceModel.change(
|
||||
|
|
Loading…
Reference in a new issue