DLynch has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/351885 )
Change subject: TableAction: Handle non-TableCell cells better
......................................................................
TableAction: Handle non-TableCell cells better
This (downstream) lets MWTransclusionTableCells be pasted into tables. Without
this, only their attributes would be pasted in, which was insufficient to turn
a TableCell into a TransclusionTableCell.
Change-Id: I054f12f4218102a12d7a9ea843f9c61e8825c52c
---
M src/ui/actions/ve.ui.TableAction.js
1 file changed, 12 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/85/351885/1
diff --git a/src/ui/actions/ve.ui.TableAction.js
b/src/ui/actions/ve.ui.TableAction.js
index 54ad95b..9483752 100644
--- a/src/ui/actions/ve.ui.TableAction.js
+++ b/src/ui/actions/ve.ui.TableAction.js
@@ -288,8 +288,18 @@
cell = matrix.getCell( selection.fromRow + row,
selection.fromCol + col );
cellRange = cell.node.getRange();
importedCell = importedMatrix.getCell( row, col );
-
- if ( !importedCell.isPlaceholder() ) {
+ if ( !( importedCell instanceof ve.dm.TableCellNode ) )
{
+ // Since the imported cell isn't a regular
TableCellNode, we
+ // can't quite trust our assumptions about how
it's supposed
+ // to work. As such, it's safer to outright
replace the cell
+ // rather than trying to be clever and switch
out the
+ // attributes / data. We shouldn't have gotten
to this point
+ // without it being Cellable, so this should at
least work.
+ surfaceModel.change(
ve.dm.TransactionBuilder.static.newFromReplacement(
+ documentModel,
cell.node.getOuterRange(),
+
importedTableNode.getDocument().getData( importedCell.node.getOuterRange() )
+ ) );
+ } else if ( !importedCell.isPlaceholder() ) {
// Remove the existing cell contents
surfaceModel.change(
ve.dm.TransactionBuilder.static.newFromRemoval( documentModel, cellRange ) );
// Attribute changes are performed separately,
and removing the whole
--
To view, visit https://gerrit.wikimedia.org/r/351885
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I054f12f4218102a12d7a9ea843f9c61e8825c52c
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits