Browse Source

Do not ask for unsaved changes twice when switching to a schema with a contents list extension (#1386)

pull/1389/head
Tobias Laufersweiler 6 days ago
committed by GitHub
parent
commit
5fbc77bc32
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      frontend/src/app/features/content/pages/content/content-page.component.ts

8
frontend/src/app/features/content/pages/content/content-page.component.ts

@ -11,7 +11,7 @@ import { FormsModule } from '@angular/forms';
import { ActivatedRoute, Router, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
import { firstValueFrom, Observable, of } from 'rxjs';
import { tap } from 'rxjs/operators';
import { AnnotationCreate, AnnotationCreateAfterNavigate, AnnotationsSelected, AnnotationsSelectedAfterNavigate, ApiUrlConfig, AppLanguageDto, AppsState, AuthService, AutoSaveKey, AutoSaveService, CanComponentDeactivate, CollaborationService, CommentsState, ConfirmClickDirective, ContentDto, ContentsState, DialogService, DropdownMenuComponent, EditContentForm, LanguageSelectorComponent, LanguagesState, LayoutComponent, LocalStoreService, MessageBus, ModalDirective, ModalModel, ModalPlacementDirective, NotifoComponent, PreviousUrl, queryParam, ResolveAssets, ResolveContents, SchemaDto, SchemasState, Settings, ShortcutDirective, SidebarMenuDirective, TempService, TitleComponent, ToolbarComponent, ToolbarService, TooltipDirective, TourHintDirective, TourStepDirective, TranslatePipe, Types, Version, WatchingUsersComponent } from '@app/shared';
import { allParams, AnnotationCreate, AnnotationCreateAfterNavigate, AnnotationsSelected, AnnotationsSelectedAfterNavigate, ApiUrlConfig, AppLanguageDto, AppsState, AuthService, AutoSaveKey, AutoSaveService, CanComponentDeactivate, CollaborationService, CommentsState, ConfirmClickDirective, ContentDto, ContentsState, DialogService, DropdownMenuComponent, EditContentForm, LanguageSelectorComponent, LanguagesState, LayoutComponent, LocalStoreService, MessageBus, ModalDirective, ModalModel, ModalPlacementDirective, NotifoComponent, PreviousUrl, queryParam, ResolveAssets, ResolveContents, SchemaDto, SchemasState, Settings, ShortcutDirective, SidebarMenuDirective, TempService, TitleComponent, ToolbarComponent, ToolbarService, TooltipDirective, TourHintDirective, TourStepDirective, TranslatePipe, Types, Version, WatchingUsersComponent } from '@app/shared';
import { ContentExtensionComponent } from '../../shared/content-extension.component';
import { PreviewButtonComponent } from '../../shared/preview-button.component';
import { ContentEditorComponent } from './editor/content-editor.component';
@ -361,6 +361,12 @@ export class ContentPageComponent implements CanComponentDeactivate {
return of(true);
}
const schemaName = allParams(this.route)['schemaName'];
const schema = this.schema();
if (schemaName !== schema.name && schemaName !== schema.id) {
return of(true);
}
return this.contentForm().hasChanged() ?
this.dialogs.confirm('i18n:contents.pendingChangesTitle', text) :
of(true);

Loading…
Cancel
Save