wwwsqldesigner
wwwsqldesigner copied to clipboard
State should not be dirty
If we were to
- Load https://ondras.zarovi.cz/sql/demo/?keyword=default
- Click on an empty space once
- Try to close or jump to another URL
- Browser prompts us to save
- It should not, since no changes were made
Good suggestion. We will need a way to track (unsaved) changes, though.
I have gotten this working, but need to understand which of my PRs you can accept so that I can find a suitable spot to PR this in. Thank you.
temporary parking spot for my code
// globals.js
window.onbeforeunload = function (e) {
if (SQL.Designer.is_dirty) {
return "" /* some browsers will show this text, some won't. */;
} else {
return undefined;
}
};
// wwwsqldesigner.js
SQL.Designer = function () {
SQL.Designer = this;
this.is_dirty = false;
SQL.Designer.prototype.dirty = function (value, remarks) {
if (value === undefined) {
value = true;
}
this.is_dirty = value;
console.log("Dirty flag set to", this.is_dirty, remarks);
};
// rowmanager.js - nothing
// row.js::update, up, down, changeComment, addRelation, removeRelation, addKey, removeKey, destroy
SQL.Designer.dirty();
// io.js
SQL.Designer.dirty(false, "serversave");
SQL.Designer.dirty(false, "loadresponse");
I have gotten this working, but need to understand which of my PRs you can accept so that I can find a suitable spot to PR this in. Thank you.
Sorry for being late all the time. As far as I can tell, there is only one PR pending right now (keyboard shortcuts); please feel free to submit this one based on the current master.
ok thanks!
@ondras this is the other one https://github.com/ondras/wwwsqldesigner/pull/321
bump :)
@ondras help :)