From ccc266472eff6fd90220986eae90bb1382a1e0c2 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 15 Nov 2019 13:59:31 -0500 Subject: [PATCH] LPXXX MARC enriched editor WIP Signed-off-by: Bill Erickson --- .../staff/share/marc-edit/editor.component.html | 4 ++-- .../app/staff/share/marc-edit/editor.component.ts | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html index be6845583b..557b04ec29 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html @@ -40,8 +40,8 @@
- - + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts index 3294f1e708..361a4fb176 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts @@ -6,12 +6,14 @@ import {AuthService} from '@eg/core/auth.service'; import {OrgService} from '@eg/core/org.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {ToastService} from '@eg/share/toast/toast.service'; +import {ServerStoreService} from '@eg/core/server-store.service'; import {StringComponent} from '@eg/share/string/string.component'; import {MarcRecord} from './marcrecord'; import {ComboboxEntry, ComboboxComponent } from '@eg/share/combobox/combobox.component'; import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; import {MarcEditContext} from './editor-context'; +import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap'; interface MarcSavedEvent { marcXml: string; @@ -63,9 +65,6 @@ export class MarcEditorComponent implements OnInit { // the record is successfully saved. @Output() recordSaved: EventEmitter; - // Fired when our underlying source record changes. - recordChange: EventEmitter; - @ViewChild('sourceSelector', { static: true }) sourceSelector: ComboboxComponent; @ViewChild('confirmDelete', { static: true }) confirmDelete: ConfirmDialogComponent; @ViewChild('confirmUndelete', { static: true }) confirmUndelete: ConfirmDialogComponent; @@ -80,7 +79,8 @@ export class MarcEditorComponent implements OnInit { private auth: AuthService, private org: OrgService, private pcrud: PcrudService, - private toast: ToastService + private toast: ToastService, + private store: ServerStoreService ) { this.sources = []; this.recordSaved = new EventEmitter(); @@ -88,8 +88,9 @@ export class MarcEditorComponent implements OnInit { } ngOnInit() { - // Default to flat for now since it's all that's supported. - // this.editorTab = 'flat'; + + this.store.getItem('cat.marcedit.flateditor').then( + useFlat => this.editorTab = useFlat ? 'flat' : 'rich') this.pcrud.retrieveAll('cbs').subscribe( src => this.sources.push({id: +src.id(), label: src.source()}), @@ -106,6 +107,15 @@ export class MarcEditorComponent implements OnInit { ); } + // Remember the last used tab as the preferred tab. + tabChange(evt: NgbTabChangeEvent) { + if (evt.nextId === 'flat') { + this.store.setItem('cat.marcedit.flateditor', true); + } else { + this.store.removeItem('cat.marcedit.flateditor'); + } + } + saveRecord(): Promise { const xml = this.record.toXml(); -- 2.11.0