@@ -5,7 +5,6 @@ import {filter, debounceTime, distinctUntilChanged, map} from 'rxjs/operators';
55import { MarcRecord , MarcField , MarcSubfield } from './marcrecord' ;
66import { MarcEditContext , FieldFocusRequest , MARC_EDITABLE_FIELD_TYPE ,
77 TextUndoRedoAction } from './editor-context' ;
8- import { ContextMenuEntry } from '@eg/share/context-menu/context-menu.service' ;
98import { StringComponent } from '@eg/share/string/string.component' ;
109import { TagTable } from './tagtable.service' ;
1110import { ComboboxComponent , ComboboxEntry } from '@eg/share/combobox/combobox.component' ;
@@ -71,9 +70,6 @@ implements OnInit, AfterViewInit, OnDestroy {
7170 // Cache of fixed field menu options
7271 ffValues : ComboboxEntry [ ] = [ ] ;
7372
74- // Cache of context menu entries
75- tagMenuEntries : ContextMenuEntry [ ] = [ ] ;
76-
7773 // Cache of tag combobox entries
7874 tagComboListEntries : ComboboxEntry [ ] = [ ] ;
7975
@@ -365,66 +361,6 @@ implements OnInit, AfterViewInit, OnDestroy {
365361 return null ;
366362 }
367363
368-
369- // These are served dynamically to handle cases where a tag or
370- // subfield is modified in place.
371- contextMenuEntries ( ) : ContextMenuEntry [ ] {
372- if ( this . isLeader ) { return ; }
373-
374- switch ( this . fieldType ) {
375- case 'tag' :
376- return this . tagContextMenuEntries ( ) ;
377-
378- case 'sfc' :
379- return this . tt ( ) . getSubfieldCodes ( this . field . tag ) ;
380-
381- case 'sfv' :
382- return this . tt ( ) . getSubfieldValues (
383- this . field . tag , this . subfield [ 0 ] ) ;
384-
385- case 'ind1' :
386- case 'ind2' :
387- return this . tt ( ) . getIndicatorValues (
388- this . field . tag , this . fieldType ) ;
389-
390- case 'ffld' :
391- return this . tt ( ) . getFfValues ( this . fixedFieldCode ) ;
392- }
393-
394- return null ;
395- }
396-
397- tagContextMenuEntries ( ) : ContextMenuEntry [ ] {
398-
399- // string components may not yet be loaded.
400- if ( this . tagMenuEntries . length > 0 || ! this . add006Str ) {
401- return this . tagMenuEntries ;
402- }
403-
404- this . tagMenuEntries . push (
405- { label : this . add006Str . text , value : '_add006' } ,
406- { label : this . add007Str . text , value : '_add007' } ,
407- { label : this . add008Str . text , value : '_add008' }
408- ) ;
409-
410- if ( ! this . field . isCtrlField ) {
411- // Only data field tags get these.
412- this . tagMenuEntries . push (
413- { label : this . insertAfterStr . text , value : '_insertAfter' } ,
414- { label : this . insertBeforeStr . text , value : '_insertBefore' }
415- ) ;
416- }
417-
418- this . tagMenuEntries . push (
419- { label : this . deleteFieldStr . text , value : '_deleteField' } ,
420- { divider : true }
421- ) ;
422-
423- this . tt ( ) . getFieldTags ( ) . forEach ( e => this . tagMenuEntries . push ( e ) ) ;
424-
425- return this . tagMenuEntries ;
426- }
427-
428364 getContent ( ) : string {
429365
430366 switch ( this . fieldType ) {
@@ -581,13 +517,15 @@ implements OnInit, AfterViewInit, OnDestroy {
581517 if ( evt . ctrlKey ) { // redo
582518 this . context . requestRedo ( ) ;
583519 evt . preventDefault ( ) ;
520+ evt . stopPropagation ( ) ;
584521 }
585522 break ;
586523
587524 case 'z' :
588525 if ( evt . ctrlKey ) { // undo
589526 this . context . requestUndo ( ) ;
590527 evt . preventDefault ( ) ;
528+ evt . stopPropagation ( ) ;
591529 }
592530 break ;
593531
@@ -632,8 +570,10 @@ implements OnInit, AfterViewInit, OnDestroy {
632570 }
633571
634572 // down == move focus to tag of next field
635- // but not in a combobox or textarea
636- if ( ! evt . ctrlKey && ! this . suggest && ! this . bigText ) {
573+ // but not in an open combobox or textarea
574+ if ( ! evt . ctrlKey && ! this . TagComboBox ?. instance . isPopupOpen ( ) && ! this . bigText ) {
575+ evt . preventDefault ( ) ;
576+ evt . stopPropagation ( ) ;
637577 // avoid dupe focus requests during copy
638578 this . context . focusNextTag ( this . field ) ;
639579 }
@@ -652,8 +592,10 @@ implements OnInit, AfterViewInit, OnDestroy {
652592 }
653593
654594 // up == move focus to tag of previous field
655- // but not in a combobox or textarea
656- if ( ! evt . ctrlKey && ! this . suggest && ! this . bigText ) {
595+ // but not in an open combobox or textarea
596+ if ( ! evt . ctrlKey && ! this . TagComboBox ?. instance . isPopupOpen ( ) && ! this . bigText ) {
597+ evt . preventDefault ( ) ;
598+ evt . stopPropagation ( ) ;
657599 // avoid dupe focus requests
658600 this . context . focusPreviousTag ( this . field ) ;
659601 }
@@ -675,6 +617,7 @@ implements OnInit, AfterViewInit, OnDestroy {
675617 }
676618
677619 evt . preventDefault ( ) ; // Bare newlines not allowed.
620+ evt . stopPropagation ( ) ;
678621 break ;
679622
680623 case 'Delete' :
@@ -683,6 +626,7 @@ implements OnInit, AfterViewInit, OnDestroy {
683626 // ctrl+delete == delete whole field
684627 this . context . deleteField ( this . field ) ;
685628 evt . preventDefault ( ) ;
629+ evt . stopPropagation ( ) ;
686630
687631 } else if ( evt . shiftKey ) {
688632
@@ -694,6 +638,7 @@ implements OnInit, AfterViewInit, OnDestroy {
694638 // prevent any shift-delete from bubbling up becuase
695639 // unexpected stuff will be deleted.
696640 evt . preventDefault ( ) ;
641+ evt . stopPropagation ( ) ;
697642 }
698643
699644 break ;
@@ -705,6 +650,7 @@ implements OnInit, AfterViewInit, OnDestroy {
705650 const pos = this . subfield ? this . subfield [ 2 ] + 1 : 0 ;
706651 this . context . insertStubSubfield ( this . field , pos ) ;
707652 evt . preventDefault ( ) ;
653+ evt . stopPropagation ( ) ;
708654 }
709655 break ;
710656 }
@@ -713,7 +659,7 @@ implements OnInit, AfterViewInit, OnDestroy {
713659
714660 // if the user has added the max number of characters for the field, advance focus to the next input
715661 // NOT USED
716- // TODO: to use, add (input)="inputEvent(inputSize(), $event)" to eg-combobox
662+ // TODO: to use, add (input)="inputEvent(inputSize (), $event)" to eg-combobox
717663 skipToNext ( max : number , $event ?: InputEvent ) {
718664 if ( $event . data . length === max ) {
719665 switch ( this . fieldType ) {
@@ -776,25 +722,6 @@ implements OnInit, AfterViewInit, OnDestroy {
776722 this . context . requestFieldFocus ( focus ) ;
777723 }
778724
779- contextMenuChange ( value : string ) {
780-
781- switch ( value ) {
782- case '_add006' : return this . context . add00X ( '006' ) ;
783- case '_add007' : return this . context . add00X ( '007' ) ;
784- case '_add008' : return this . context . insertReplace008 ( ) ;
785- case '_insertBefore' :
786- return this . context . insertStubField ( this . field , true ) ;
787- case '_insertAfter' :
788- return this . context . insertStubField ( this . field ) ;
789- case '_deleteField' : return this . context . deleteField ( this . field ) ;
790- }
791-
792- this . setContent ( value , true ) ;
793-
794- // Context menus can steal focus.
795- this . context . requestFieldFocus ( this . context . lastFocused ) ;
796- }
797-
798725 isAuthInvalid ( ) : boolean {
799726 return (
800727 this . fieldType === 'sfv' &&
0 commit comments