parent
17d9f06b65
commit
d7b1a53248
2 changed files with 22 additions and 1 deletions
|
@ -760,6 +760,21 @@ class VirtualizedTable extends React.Component {
|
|||
}
|
||||
|
||||
// ------------------------ Column Methods ------------------------- //
|
||||
|
||||
/**
|
||||
* A public function to update the column CSS flex widths. To be used
|
||||
* upon window resize and similar. Especially important on macOS where
|
||||
* column borders are used and get out of sync with column headers.
|
||||
*/
|
||||
updateColumnWidths = Zotero.Utilities.debounce(() => {
|
||||
let resizeData = {};
|
||||
const columns = this._getVisibleColumns();
|
||||
for (const column of columns) {
|
||||
const elem = document.querySelector(`#${this.props.id} .virtualized-table-header .cell.${column.dataKey}`)
|
||||
resizeData[column.dataKey] = elem.getBoundingClientRect().width;
|
||||
}
|
||||
this._columns.onResize(resizeData, true);
|
||||
}, 200)
|
||||
|
||||
_handleResizerDragStart = (index, event) => {
|
||||
if (event.button !== 0) return false;
|
||||
|
|
|
@ -106,6 +106,7 @@ var ZoteroPane = new function()
|
|||
this.updateWindow();
|
||||
this.updateToolbarPosition();
|
||||
this.updateTagsBoxSize();
|
||||
this.updateItemTreeColumnWidths();
|
||||
});
|
||||
window.setTimeout(this.updateToolbarPosition.bind(this), 0);
|
||||
|
||||
|
@ -5457,7 +5458,12 @@ var ZoteroPane = new function()
|
|||
list.style.height = height + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.updateItemTreeColumnWidths = function() {
|
||||
if (!ZoteroPane.itemsView) return;
|
||||
ZoteroPane.itemsView.tree.updateColumnWidths();
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the about dialog
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue