Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/168007

Change subject: MWLinkNodeInspector: Provide an open button here too
......................................................................

MWLinkNodeInspector: Provide an open button here too

Bug: 71904
Change-Id: I50515671bb3ff08da8dc6c247c9959c27957c867
---
M modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
1 file changed, 28 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/07/168007/1

diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
index 5f49df5..7c20afe 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js
@@ -37,6 +37,10 @@
 
 ve.ui.MWLinkNodeInspector.static.actions = 
ve.ui.MWLinkNodeInspector.super.static.actions.concat( [
        {
+               action: 'open',
+               label: OO.ui.deferMsg( 'visualeditor-linkinspector-open' )
+       },
+       {
                action: 'convert',
                label: OO.ui.deferMsg( 
'visualeditor-linknodeinspector-add-label' )
        }
@@ -54,11 +58,35 @@
        // Properties
        this.targetInput = new OO.ui.TextInputWidget( { $: this.$ } );
 
+       // Events
+       this.targetInput.connect( this, { change: 'onTargetInputChange' } );
+
        // Initialization
        this.form.$element.append( this.targetInput.$element );
 };
 
 /**
+ * Handle target input change events.
+ *
+ * Updates the open button's hyperlink location.
+ *
+ * @param {string} value New target input value
+ */
+ve.ui.LinkInspector.prototype.onTargetInputChange = function () {
+       var href = this.targetInput.getHref(),
+               inspector = this;
+       this.targetInput.isValid().done( function ( valid ) {
+               inspector.actions.forEach( { actions: 'open' }, function ( 
action ) {
+                       action.setHref( href ).setTarget( '_blank' 
).setDisabled( !valid );
+                       // HACK: Chrome renders a dark outline around the 
action when it's a link, but causing it to
+                       // re-render makes it magically go away; this is 
incredibly evil and needs further
+                       // investigation
+                       action.$element.hide().fadeIn( 0 );
+               } );
+       } );
+};
+
+/**
  * @inheritdoc
  */
 ve.ui.MWLinkNodeInspector.prototype.getActionProcess = function ( action ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/168007
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50515671bb3ff08da8dc6c247c9959c27957c867
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to