@@ -147,7 +147,7 @@ class TpenCreateColumn extends HTMLElement {
147147 .disable-other {
148148 pointer-events: none;
149149 user-select: none;
150- opcacity : 0.5;
150+ opacity : 0.5;
151151 color: gray !important;
152152 }
153153 .disable-button {
@@ -247,7 +247,7 @@ class TpenCreateColumn extends HTMLElement {
247247 this . showLoading ( )
248248 let { imgUrl, annotations, imgWidth, imgHeight } = await this . fetchPageViewerData ( pageID )
249249 await this . renderImage ( imgUrl )
250- const page = await TPEN . activeProject . layers . flatMap ( layer => layer . pages || [ ] ) . find ( p => p . id . split ( '/' ) . pop ( ) === this . annotationPageID )
250+ const page = TPEN . activeProject . layers . flatMap ( layer => layer . pages || [ ] ) . find ( p => p . id . split ( '/' ) . pop ( ) === this . annotationPageID )
251251 this . existingColumns = page ?. columns ?. map ( column => ( { label : column . label , lines : column . lines } ) ) || [ ]
252252 const assignedAnnotationIds = [ ]
253253 await this . columnLabelCheck ( )
@@ -350,7 +350,10 @@ class TpenCreateColumn extends HTMLElement {
350350 } else {
351351 btn . style . backgroundColor = 'var(--primary-color)'
352352 btn . style . color = 'white'
353- columnLabelsToMerge . pop ( columnLabels . indexOf ( label ) !== - 1 ? columnLabels . indexOf ( label ) : '' )
353+ const index = columnLabelsToMerge . indexOf ( columnLabels . indexOf ( label ) )
354+ if ( index > - 1 ) {
355+ columnLabelsToMerge . splice ( index , 1 )
356+ }
354357 }
355358 } )
356359 workspaceToolbar . appendChild ( btn )
@@ -510,23 +513,14 @@ class TpenCreateColumn extends HTMLElement {
510513 return false
511514 }
512515 }
513- isValidJSON ( input ) {
514- try {
515- ( typeof input === "string" ) ? JSON . parse ( input ) : JSON . parse ( JSON . stringify ( input ) )
516- return true
517- } catch {
518- return false
519- }
520- }
521516
522517 async getSpecificTypeData ( type ) {
523518 if ( ! type ) throw new Error ( "No IIIF resource provided" )
524519 if ( typeof type === "string" && this . isValidUrl ( type ) ) {
525520 const res = await fetch ( type , { cache : "no-store" } )
526521 if ( ! res . ok ) throw new Error ( `Fetch failed: ${ res . status } ` )
527522 return await res . json ( )
528- } else if ( typeof type === "object" && this . isValidJSON ( type ) ) return type
529- else throw new Error ( "Invalid IIIF input" )
523+ }
530524 }
531525
532526 async fetchPageViewerData ( pageID = null ) {
@@ -724,7 +718,6 @@ class TpenCreateColumn extends HTMLElement {
724718 } )
725719 window . location . reload ( )
726720 } catch ( err ) {
727- console . error ( "Column creation failed:" , err )
728721 TPEN . eventDispatcher . dispatch ( "tpen-toast" , {
729722 status : "error" , message : 'Failed to create column.'
730723 } )
@@ -746,7 +739,6 @@ class TpenCreateColumn extends HTMLElement {
746739 } )
747740 window . location . reload ( )
748741 } catch ( err ) {
749- console . error ( "Failed to clear columns:" , err )
750742 TPEN . eventDispatcher . dispatch ( "tpen-toast" , {
751743 status : "error" , message : 'Failed to clear columns.'
752744 } )
0 commit comments