Catrope has uploaded a new change for review.

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

Change subject: Add focused class to wikitext editor when textarea has focus
......................................................................

Add focused class to wikitext editor when textarea has focus

Needed so we can style the entire editor when it's focused,
similar to VE.

Change-Id: I4de896974dd02a794501d44d327693ba270249b2
---
M modules/editor/editors/ext.flow.editors.none.js
1 file changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/00/207000/1

diff --git a/modules/editor/editors/ext.flow.editors.none.js 
b/modules/editor/editors/ext.flow.editors.none.js
index 992205f..75b6101 100644
--- a/modules/editor/editors/ext.flow.editors.none.js
+++ b/modules/editor/editors/ext.flow.editors.none.js
@@ -11,6 +11,7 @@
         * @param {string} [content='']
         */
        mw.flow.editors.none = function ( $node, content ) {
+               var $editor = $node.closest( '.flow-editor' );
                this.$node = $node;
                this.$node.val( content || '' );
 
@@ -24,6 +25,19 @@
                this.$node.keyup( this.autoExpand );
                this.autoExpand.call( this.$node.get( 0 ) );
 
+               // Add focused class when textarea is focused
+               this.$node
+                       .on( 'focus', function () {
+                               $editor.addClass( 'focused' );
+                       } )
+                       .on( 'blur', function () {
+                               $editor.removeClass( 'focused' );
+                       } );
+               // Add focused class if textarea is already focused
+               if ( this.$node.is( ':focus' ) ) {
+                       $editor.addClass( 'focused' );
+               }
+
                // only attach switcher if VE is actually enabled and supported
                // code to figure out if that VE is supported is in that module
                if ( mw.config.get( 'wgFlowEditorList' ).indexOf( 
'visualeditor' ) !== -1 ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4de896974dd02a794501d44d327693ba270249b2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Catrope <roan.katt...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to