moebius#339: Make it possible to add cookies, local and session storage entries

Issue #31
https://github.com/MoonchildProductions/moebius/pull/339
This commit is contained in:
janekptacijarabaci 2018-03-02 17:52:34 +01:00 committed by Roy Tam
commit 6d865bfda3
13 changed files with 309 additions and 43 deletions

View file

@ -123,6 +123,8 @@ function TableWidget(node, options = {}) {
TableWidget.prototype = {
items: null,
editBookmark: null,
scrollIntoViewOnUpdate: null,
/**
* Getter for the headers context menu popup id.
@ -1159,7 +1161,9 @@ Column.prototype = {
},
/**
* Called when a row is updated.
* Called when a row is updated e.g. a cell is changed. This means that
* for a new row this method will be called once for each column. If a single
* cell is changed this method will be called just once.
*
* @param {string} event
* The event name of the event. i.e. EVENTS.ROW_UPDATED
@ -1168,7 +1172,23 @@ Column.prototype = {
*/
onRowUpdated: function (event, id) {
this._updateItems();
if (this.highlightUpdated && this.items[id] != null) {
if (this.table.scrollIntoViewOnUpdate) {
let cell = this.cells[this.items[id]];
// When a new row is created this method is called once for each column
// as each cell is updated. We can only scroll to cells if they are
// visible. We check for visibility and once we find the first visible
// cell in a row we scroll it into view and reset the
// scrollIntoViewOnUpdate flag.
if (cell.label.clientHeight > 0) {
cell.scrollIntoView();
this.table.scrollIntoViewOnUpdate = null;
}
}
if (this.table.editBookmark) {
// A rows position in the table can change as the result of an edit. In
// order to ensure that the correct row is highlighted after an edit we
@ -1180,6 +1200,7 @@ Column.prototype = {
this.cells[this.items[id]].flash();
}
this.updateZebra();
},
@ -1594,6 +1615,10 @@ Cell.prototype = {
this.label.focus();
},
scrollIntoView: function () {
this.label.scrollIntoView(false);
},
destroy: function () {
this.label.remove();
this.label = null;