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

View File

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

View File

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