Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix refreshing table info while table is selected #1605

Merged
merged 1 commit into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build/changelog/entries/2018/03/12326.SUP-5832.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
When a row of a table was transformed into a header, and afterwards all rows were deleted,
the table itself was not deleted. This has been fixed now.
Also, after the selected rows/columns were deleted, the floating menu still showed table related tabs, which was
incorrect, because the table was not selected any more.
1 change: 1 addition & 0 deletions src/plugins/common/table/lib/table-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,7 @@ define([
} else {
// leave all scopes
TablePlugin.leaveTableScopes();
Scopes.setScope('Aloha.continuoustext');
}
};

Expand Down
9 changes: 1 addition & 8 deletions src/plugins/common/table/lib/table-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,7 @@ define([
this.selectedColumnIdxs = [];
this.selectedRowIdxs = [];
this.currentRectangle = {};

//we keep 'cell' as the default selection type instead of
//unsetting the selectionType to avoid an edge-case where a
//click into a cell doesn't trigger a call to
//TableCell.editableFocs (which would set the 'cell'
//selection type) which would result in the FloatingMenu
//losing the table scope.
this.selectionType = 'cell';
this.selectionType = undefined;

this._notifyCellsUnselected();
}
Expand Down
13 changes: 10 additions & 3 deletions src/plugins/common/table/lib/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ define([
// find the dimensions of the table
this.numCols = this.countVirtualCols();

var rows = this.getRows();
var rows = this.getRows(true);
this.numRows = rows.length;

// init the cell-attribute with an empty array
Expand Down Expand Up @@ -2225,13 +2225,20 @@ define([
};

/**
* @param {Boolean} filterSelectionRow filter selection row
* @return the rows of the table as an array of DOM nodes
*/
Table.prototype.getRows = function () {
Table.prototype.getRows = function (filterSelectionRow) {
//W3C DOM property .rows supported by all modern browsers
var rows = this.obj.get( 0 ).rows;
//converts the HTMLCollection to a real array
return jQuery.makeArray( rows );
rows = jQuery.makeArray(rows);
if (filterSelectionRow) {
rows = rows.filter(function(elt, i, array) {
return !jQuery(elt).hasClass('aloha-ephemera');
});
}
return rows;
};

return Table;
Expand Down