jenkins-bot has submitted this change and it was merged.

Change subject: Fix getDirectionFromSelection to work with table selections
......................................................................


Fix getDirectionFromSelection to work with table selections

Change-Id: Ie5c46e4eb0fc40982a47adb7ddb47a949d9de411
---
M demos/ve/pages/tables.html
M src/ce/ve.ce.Document.js
2 files changed, 22 insertions(+), 4 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/demos/ve/pages/tables.html b/demos/ve/pages/tables.html
index 56c5eea..3d1d068 100644
--- a/demos/ve/pages/tables.html
+++ b/demos/ve/pages/tables.html
@@ -125,6 +125,19 @@
   </tr>
 </table>
 
+<h2>RTL table</h2>
+
+<div dir="rtl">
+<table>
+  <tr>
+    <td>A</td><td>B</td><td>C</td><td>D</td>
+  </tr>
+  <tr>
+    <td>E</td><td>F</td><td>G</td><td>H</td>
+  </tr>
+</table>
+</div>
+
 <h2>Full table</h2>
 
 <table>
diff --git a/src/ce/ve.ce.Document.js b/src/ce/ve.ce.Document.js
index 532484d..166f9c2 100644
--- a/src/ce/ve.ce.Document.js
+++ b/src/ce/ve.ce.Document.js
@@ -209,12 +209,17 @@
  * @returns {string|null} 'rtl', 'ltr' or null if unknown
  */
 ve.ce.Document.prototype.getDirectionFromSelection = function ( selection ) {
-       if ( !( selection instanceof ve.dm.LinearSelection ) ) {
+       var effectiveNode, range, selectedNodes;
+
+       if ( selection instanceof ve.dm.LinearSelection ) {
+               range = selection.getRange();
+       } else if ( selection instanceof ve.dm.TableSelection ) {
+               range = selection.tableRange;
+       } else {
                return null;
        }
-       var effectiveNode,
-               range = selection.getRange(),
-               selectedNodes = this.selectNodes( range, 'covered' );
+
+       selectedNodes = this.selectNodes( range, 'covered' );
 
        if ( selectedNodes.length > 1 ) {
                // Selection of multiple nodes

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5c46e4eb0fc40982a47adb7ddb47a949d9de411
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to