mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that ERD throws a warning before closing unsaved changes if open in a new tab. Fixes #6193
This commit is contained in:
parent
e10dd6a80f
commit
75f887f5dc
@ -30,3 +30,4 @@ Bug fixes
|
|||||||
| `Issue #6179 <https://redmine.postgresql.org/issues/6179>`_ - Fixed an issue where Generate SQL displayed twice in the ERD tool.
|
| `Issue #6179 <https://redmine.postgresql.org/issues/6179>`_ - Fixed an issue where Generate SQL displayed twice in the ERD tool.
|
||||||
| `Issue #6180 <https://redmine.postgresql.org/issues/6180>`_ - Updated missing documentation for the 'Download Image' option in ERD.
|
| `Issue #6180 <https://redmine.postgresql.org/issues/6180>`_ - Updated missing documentation for the 'Download Image' option in ERD.
|
||||||
| `Issue #6187 <https://redmine.postgresql.org/issues/6187>`_ - Limit the upgrade check to run once per day.
|
| `Issue #6187 <https://redmine.postgresql.org/issues/6187>`_ - Limit the upgrade check to run once per day.
|
||||||
|
| `Issue #6193 <https://redmine.postgresql.org/issues/6193>`_ - Ensure that ERD throws a warning before closing unsaved changes if open in a new tab.
|
||||||
|
@ -355,9 +355,14 @@ export default class ERDCore {
|
|||||||
|
|
||||||
zoomOut() {
|
zoomOut() {
|
||||||
let model = this.getEngine().getModel();
|
let model = this.getEngine().getModel();
|
||||||
let zoomLevel = model.getZoomLevel();
|
if(model) {
|
||||||
if(model && zoomLevel > 25) {
|
let zoomLevel = model.getZoomLevel();
|
||||||
model.setZoomLevel(zoomLevel - 25);
|
zoomLevel -= 25;
|
||||||
|
/* Don't go belo zoom level 10 */
|
||||||
|
if(zoomLevel <= 10) {
|
||||||
|
zoomLevel = 10;
|
||||||
|
}
|
||||||
|
model.setZoomLevel(zoomLevel);
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,6 +235,12 @@ export default class BodyWidget extends React.Component {
|
|||||||
if(this.props.params.gen) {
|
if(this.props.params.gen) {
|
||||||
await this.loadTablesData();
|
await this.loadTablesData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('beforeunload', this.onBeforeUnload.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener('beforeunload', this.onBeforeUnload.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
@ -348,6 +354,15 @@ export default class BodyWidget extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeUnload(e) {
|
||||||
|
if(this.state.dirty) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.returnValue = 'prevent';
|
||||||
|
} else {
|
||||||
|
delete e['returnValue'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onEditNode() {
|
onEditNode() {
|
||||||
const selected = this.diagram.getSelectedNodes();
|
const selected = this.diagram.getSelectedNodes();
|
||||||
if(selected.length == 1) {
|
if(selected.length == 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user