Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/172191
Change subject: TableNode, TableContext: Position row/column overlays better
when caption is present
......................................................................
TableNode, TableContext: Position row/column overlays better when caption is
present
When updating overlays, find out if there's a caption, and if yes
offset the overlays on the captioned side by caption's width/height,
appropriately.
The caption is usually at the top, but this can be overridden using
the 'caption-side' CSS property on the <table/> node. 'top' and
'bottom' from CSS 2 spec are widely supported ('top' being the
default), Firefox also supports 'left' and 'right' (CSS 3).
Minor changes to ve.ui.TableContext.css are because we can no longer
set 'top' or 'left' on .ve-ui-tableContext-rowContext and
.ve-ui-tableContext-colContext (these are used for the offsetting).
colContext was okay, rowContext was done weirdly and now is fixed.
Bug: 72829
Change-Id: I140e63d828ce0432ad804be85f86f53432d84166
---
M src/ce/nodes/ve.ce.TableNode.js
M src/ui/styles/ve.ui.TableContext.css
2 files changed, 14 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/91/172191/1
diff --git a/src/ce/nodes/ve.ce.TableNode.js b/src/ce/nodes/ve.ce.TableNode.js
index a6103ed..513944d 100644
--- a/src/ce/nodes/ve.ce.TableNode.js
+++ b/src/ce/nodes/ve.ce.TableNode.js
@@ -336,6 +336,7 @@
}
var i, l, nodes, cellOffset, anchorNode, anchorOffset, selectionOffset,
+ captionModel, captionView, captionSide,
top, left, bottom, right,
selection = this.editingFragment ?
this.editingFragment.getSelection() :
@@ -350,6 +351,12 @@
}
nodes = this.getCellNodesFromSelection( selection );
+ captionModel = selection.getTableNode().getCaptionNode();
+ captionView = captionModel ?
+ this.getNodeFromOffset( captionModel.getOffset() -
this.model.getOffset() ) :
+ null;
+ captionSide = this.$element.css( 'caption-side' );
+
anchorNode = this.getCellNodesFromSelection( selection.collapseToFrom()
)[0];
anchorOffset = ve.translateRect(
anchorNode.$element[0].getBoundingClientRect(), -tableOffset.left,
-tableOffset.top );
@@ -393,7 +400,8 @@
left: tableOffset.left - surfaceOffset.left
} );
this.colContext.$element.css( {
- left: selectionOffset.left
+ left: selectionOffset.left,
+ top: ( captionView && captionSide === 'top' ) ?
captionView.$element.height() : 0
} );
this.colContext.indicator.$element.css( {
width: selectionOffset.width
@@ -402,7 +410,8 @@
'margin-left': selectionOffset.width / 2
} );
this.rowContext.$element.css( {
- top: selectionOffset.top
+ top: selectionOffset.top,
+ left: ( captionView && captionSide === 'left' ) ?
captionView.$element.width() : 0
} );
this.rowContext.indicator.$element.css( {
height: selectionOffset.height
diff --git a/src/ui/styles/ve.ui.TableContext.css
b/src/ui/styles/ve.ui.TableContext.css
index e3d9421..4489db4 100644
--- a/src/ui/styles/ve.ui.TableContext.css
+++ b/src/ui/styles/ve.ui.TableContext.css
@@ -29,18 +29,15 @@
border-bottom: 0;
}
-.ve-ui-tableContext-rowContext {
+.ve-ui-tableContext-rowContext .oo-ui-popupWidget {
/* Gap + half context width (for centering), 0.2 + 0.8/2 */
left: -0.6em;
-}
-
-.ve-ui-tableContext-rowContext .oo-ui-popupWidget {
top: 0.3em;
}
.ve-ui-tableContext-rowContext .ve-ui-tableContext-indicator {
width: 0.8em;
- /* Half context width (for centering) */
- margin-left: -0.4em;
+ /* Gap + context width, 0.2 + 0.8 */
+ margin-left: -1em;
border-right: 0;
}
--
To view, visit https://gerrit.wikimedia.org/r/172191
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I140e63d828ce0432ad804be85f86f53432d84166
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits