Add setting to decide whether the edit dialog should automatically close on save

This commit is contained in:
Daniel Dietzler
2023-06-12 09:26:13 +02:00
committed by GitHub
parent e3ea5dd13c
commit feef3c909b
3 changed files with 19 additions and 1 deletions

View File

@@ -180,6 +180,10 @@ export class DocumentDetailComponent
return this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER)
}
get exitOnSave(): boolean {
return this.settings.get(SETTINGS_KEYS.EXIT_ON_SAVE)
}
getContentType() {
return this.metadata?.has_archive_version
? 'application/pdf'
@@ -529,7 +533,7 @@ export class DocumentDetailComponent
next: () => {
this.store.next(this.documentForm.value)
this.toastService.showInfo($localize`Document saved successfully.`)
this.close()
this.exitOnSave && this.close()
this.networkActive = false
this.error = null
},

View File

@@ -82,6 +82,7 @@ export class SettingsComponent
darkModeInvertThumbs: new FormControl(null),
themeColor: new FormControl(null),
useNativePdfViewer: new FormControl(null),
exitOnSave: new FormControl(null),
displayLanguage: new FormControl(null),
dateLocale: new FormControl(null),
dateFormat: new FormControl(null),
@@ -193,6 +194,9 @@ export class SettingsComponent
useNativePdfViewer: this.settings.get(
SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER
),
exitOnSave: this.settings.get(
SETTINGS_KEYS.EXIT_ON_SAVE
),
displayLanguage: this.settings.getLanguage(),
dateLocale: this.settings.get(SETTINGS_KEYS.DATE_LOCALE),
dateFormat: this.settings.get(SETTINGS_KEYS.DATE_FORMAT),
@@ -527,6 +531,10 @@ export class SettingsComponent
SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER,
this.settingsForm.value.useNativePdfViewer
)
this.settings.set(
SETTINGS_KEYS.EXIT_ON_SAVE,
this.settingsForm.value.exitOnSave
)
this.settings.set(
SETTINGS_KEYS.DATE_LOCALE,
this.settingsForm.value.dateLocale

View File

@@ -24,6 +24,7 @@ export const SETTINGS_KEYS = {
DARK_MODE_THUMB_INVERTED: 'general-settings:dark-mode:thumb-inverted',
THEME_COLOR: 'general-settings:theme:color',
USE_NATIVE_PDF_VIEWER: 'general-settings:document-details:native-pdf-viewer',
EXIT_ON_SAVE: 'general-settings:document-details:exit-on-save',
DATE_LOCALE: 'general-settings:date-display:date-locale',
DATE_FORMAT: 'general-settings:date-display:date-format',
NOTIFICATIONS_CONSUMER_NEW_DOCUMENT:
@@ -95,6 +96,11 @@ export const SETTINGS: PaperlessUiSetting[] = [
type: 'boolean',
default: false,
},
{
key: SETTINGS_KEYS.EXIT_ON_SAVE,
type: 'boolean',
default: true,
},
{
key: SETTINGS_KEYS.DATE_LOCALE,
type: 'string',