DLynch has uploaded a new change for review. https://gerrit.wikimedia.org/r/278284
Change subject: LinkAnnotationInspector: add a button to edit the label ...................................................................... LinkAnnotationInspector: add a button to edit the label Adds a button which quickly selects the entire contents of the link annotation. This makes it far easier to select the entire label for editing, without accidentally selecting outside the annotation and thus removing it. This exactly mirrors the behavior of the mediawiki linknodeinspector, when converting from a numbered link to a labeled one. Bug: T124305 Change-Id: I5f36835fefaecd238ae66795a9c3abf348359c60 --- M i18n/en.json M i18n/qqq.json M src/ui/inspectors/ve.ui.LinkAnnotationInspector.js 3 files changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/84/278284/1 diff --git a/i18n/en.json b/i18n/en.json index 65d88ff..4be5165 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -96,6 +96,7 @@ "visualeditor-languageinspector-widget-label-direction": "Direction", "visualeditor-languageinspector-widget-label-langcode": "Language code", "visualeditor-languageinspector-widget-label-language": "Language", + "visualeditor-linkinspector-edit-label": "Edit label", "visualeditor-linkinspector-title": "Link", "visualeditor-listbutton-bullet-tooltip": "Bullet list", "visualeditor-listbutton-number-tooltip": "Numbered list", diff --git a/i18n/qqq.json b/i18n/qqq.json index a458100..dc51e67 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -104,6 +104,7 @@ "visualeditor-languageinspector-widget-label-direction": "Label for the language inspector widget, to denote the text direction of the current element (left-to-right or right-to-left).\n{{Identical|Direction}}", "visualeditor-languageinspector-widget-label-langcode": "Label for the language inspector widget, to denote the current block language code.\n{{Identical|Language code}}", "visualeditor-languageinspector-widget-label-language": "Label for the language inspector widget, to denote the current block language.\n{{Identical|Language}}", + "visualeditor-linkinspector-edit-label": "Label for the edit label button. This sets the current selection to the entire contents of the link, so it can be easily edited.", "visualeditor-linkinspector-title": "Title of the link inspector dialog.\n{{Identical|Link}}", "visualeditor-listbutton-bullet-tooltip": "Tooltip text for the bullet list button", "visualeditor-listbutton-number-tooltip": "Tooltip text for the numbered list button", diff --git a/src/ui/inspectors/ve.ui.LinkAnnotationInspector.js b/src/ui/inspectors/ve.ui.LinkAnnotationInspector.js index 9a5fbeb..21e24e2 100644 --- a/src/ui/inspectors/ve.ui.LinkAnnotationInspector.js +++ b/src/ui/inspectors/ve.ui.LinkAnnotationInspector.js @@ -30,6 +30,14 @@ ve.ui.LinkAnnotationInspector.static.modelClasses = [ ve.dm.LinkAnnotation ]; +ve.ui.LinkAnnotationInspector.static.actions = ve.ui.LinkAnnotationInspector.super.static.actions.concat( [ + { + action: 'label', + label: OO.ui.deferMsg( 'visualeditor-linkinspector-edit-label' ), + modes: [ 'edit' ] + } +] ); + /* Methods */ /** @@ -160,9 +168,24 @@ return ve.ui.LinkAnnotationInspector.super.prototype.getTeardownProcess.call( this, data ) .next( function () { this.annotationInput.setAnnotation( null ); + if ( data.action === 'label' ) { + this.manager.getSurface().getView().selectActiveLinkContents(); + } }, this ); }; +/** + * @inheritdoc + */ +ve.ui.LinkAnnotationInspector.prototype.getActionProcess = function ( action ) { + if ( action === 'label' ) { + return new OO.ui.Process( function () { + this.close( { action: action } ); + }, this ); + } + return ve.ui.LinkAnnotationInspector.super.prototype.getActionProcess.call( this, action ); +}; + /* Registration */ ve.ui.windowFactory.register( ve.ui.LinkAnnotationInspector ); -- To view, visit https://gerrit.wikimedia.org/r/278284 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5f36835fefaecd238ae66795a9c3abf348359c60 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: DLynch <dly...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits