Skip to content

Commit c2a0868

Browse files
1 parent ca78028 commit c2a0868

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

app/webapp/controller/App.controller.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,20 +1190,26 @@ sap.ui.define("z2ui5/Dirty", ["sap/ui/core/Control"], (Control) => {
11901190
},
11911191
setIsDirty(val) {
11921192

1193-
sap.ui.require([ "sap/ushell/Container"
1194-
], async (Container) => {
1193+
sap.ui.require([ "sap/ushell/Container" ], async (Container) => {
11951194

11961195
if (Container) {
11971196
Container.setDirtyFlag(val);
11981197
} else {
11991198
window.onbeforeunload = function (e) {
1199+
if (val) {
1200+
e.preventDefault();
1201+
}
1202+
}
1203+
}
1204+
1205+
}, () => {
1206+
// Fallback if ushell is not available (OpenUI5)
1207+
window.onbeforeunload = function (e) {
12001208
if (val) {
12011209
e.preventDefault();
12021210
}
12031211
}
1204-
}
1205-
1206-
});
1212+
});
12071213

12081214
},
12091215
renderer(oRm, oControl) { }

0 commit comments

Comments
 (0)