Fixed sticky URL when using Escape to close view theme modal
no issue - we were missing handling for the view-theme modal being closed outside of a route transition meaning the URL would stay on `/settings/design/view-theme/Theme` even though it's the index that was shown, preventing the same theme being viewable again and back/forward behaving as expected
This commit is contained in:
parent
4db4233b87
commit
4d8c12d2b8
@ -1,4 +1,5 @@
|
||||
import AdminRoute from 'ghost-admin/routes/admin';
|
||||
import {action} from '@ember/object';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class ViewThemeRoute extends AdminRoute {
|
||||
@ -25,10 +26,23 @@ export default class ViewThemeRoute extends AdminRoute {
|
||||
|
||||
this.themeModal = this.modals.open('modals/design/view-theme', {
|
||||
theme: model
|
||||
}, {
|
||||
beforeClose: this.beforeModalClose
|
||||
});
|
||||
}
|
||||
|
||||
deactivate() {
|
||||
this.isLeaving = true;
|
||||
this.themeModal?.close();
|
||||
|
||||
this.isLeaving = false;
|
||||
this.themeModal = null;
|
||||
}
|
||||
|
||||
@action
|
||||
beforeModalClose() {
|
||||
if (this.themeModal && !this.isLeaving) {
|
||||
this.router.transitionTo('settings.design.change-theme');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user