Robmoen has uploaded a new change for review.

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


Change subject: Restore focus to documentNode on convert
......................................................................

Restore focus to documentNode on convert

Since format dropdown tool is the only tool where we actually lose
focus to the documentNode, we must restore focus so that firefox
and chrome will display a cursor after converting content branches.

Bug: 50338
Change-Id: I4059b2688565570e0efc21078035775b7aed49e1
---
M modules/ve/dm/ve.dm.Surface.js
M modules/ve/ui/actions/ve.ui.FormatAction.js
2 files changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve/dm/ve.dm.Surface.js b/modules/ve/dm/ve.dm.Surface.js
index 95d214d..ffef4f2 100644
--- a/modules/ve/dm/ve.dm.Surface.js
+++ b/modules/ve/dm/ve.dm.Surface.js
@@ -398,7 +398,7 @@
        if ( contextChange ) {
                this.emit( 'contextChange' );
        }
-
+       this.emit( 'select', this.selection.clone() );
        this.emit( 'change', transactions, selection );
 
        // Continue observation polling, we want to know about things that 
change from here on out
diff --git a/modules/ve/ui/actions/ve.ui.FormatAction.js 
b/modules/ve/ui/actions/ve.ui.FormatAction.js
index 0d5c6b7..bddee14 100644
--- a/modules/ve/ui/actions/ve.ui.FormatAction.js
+++ b/modules/ve/ui/actions/ve.ui.FormatAction.js
@@ -68,6 +68,10 @@
        }
        selection = fragmentForSelection.getRange();
 
+       // Since format dropdown tool is a focusable menu, documentNode has 
lost focus.
+       // Restore focus to documentNode so that firefox will display the 
cursor after conversion.
+       this.surface.view.documentView.documentNode.$.focus();
+
        txs = ve.dm.Transaction.newFromContentBranchConversion( doc, selection, 
type, attributes );
        surfaceModel.change( txs, selection );
 };

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

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

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

Reply via email to