DLynch has uploaded a new change for review.
https://gerrit.wikimedia.org/r/284223
Change subject: Select the label properly when converting LinkNode to
LinkAnnotation
......................................................................
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
---
M modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/23/284223/1
diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
index 9f9c67c..1778ba7 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
@@ -143,7 +143,12 @@
// 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(
--
To view, visit https://gerrit.wikimedia.org/r/284223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib2274bc5857294c5b691b3c3567b135d68bfa596
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits