Skip to content

Commit

Permalink
Merge pull request #437 from esmero/ISSUE-436
Browse files Browse the repository at this point in the history
ISSUE-436:  PDFJS 4.x + VTT Content Search API + Plain text + Mirador 4.0 alpha 2 + ML/Annotations Twig based formatter
  • Loading branch information
DiegoPino authored Jun 19, 2024
2 parents 5e1a046 + b46c6a2 commit 6cac775
Show file tree
Hide file tree
Showing 25 changed files with 2,266 additions and 975 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'metadataexpose_entity.metadataapi_entity.*':
type: config_entity
label: 'Metadata API entity using Twig and Views Configuration'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Label'
uuid:
type: string
metadataWrapperDisplayentity:
label: 'Metadata Display entity that will output the API wrapper and process the json of the items & api arguments'
type: string
metadataItemDisplayentity:
label: 'Metadata Display entity that will output the each Item process the json coming from each Views result row & api arguments'
type: string
views_source_ids:
type: sequence
label: 'The views used to generate results. These might also get arguments mapped from the API to any exposed relationship, filter, etc.'
sequence:
- type: string
api_type:
label: 'If rest or Sword. Rest APIs can use HTTP codes and header to communicate, but Sword ones always return bodies.'
type: string
cache:
type: boolean
active:
type: boolean
label: 'Whether this endpoint is active'
16 changes: 14 additions & 2 deletions config/schema/format_strawberryfield.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,24 @@ format_strawberryfield.iiif_settings:
iiif_content_search_api_page_count:
type: int
label: 'The max results to show per page on a iiif_content_search_api_page_count'
iiif_content_search_api_enabled_processors:
iiif_content_search_api_visual_enabled_processors:
type: string
label: 'Comma separated list of Strawberry Runner Processors that can be fetched by the Content Search API on query.'
label: 'Comma separated list of Strawberry Runner Processors for Visual Annotations (OCR) that can be fetched by the Content Search API on query.'
iiif_content_search_api_time_enabled_processors:
type: string
label: 'Comma separated list of Strawberry Runner Processors for time Annotations (OCR from time) can be fetched by the Content Search API on query.'
iiif_content_search_api_text_enabled_processors:
type: string
label: 'Comma separated list of Strawberry Runner Processors for plain text annotations (no OCR) that can be fetched by the Content Search API on query.'
iiif_content_search_api_active:
type: bool
label: 'If IIIF Content Search API V1 and V2 are enabled.'
iiif_content_search_validate_exposed:
type: bool
label: 'If IIIF Only explicit definitions in a manifest allow a search against them'
iiif_content_search_time_targetannotations:
type: bool
label: 'If IIIF Content Search results for Time based media target the VTT annotation itself or the parent Canvas'
iiif_content_search_api_parent_node_fields:
type: sequence
label: 'Strawberry Flavor Data Source Search API Fields that can be used to connect a Strawberry Flavor to a Parent ADO.'
Expand Down Expand Up @@ -505,6 +514,9 @@ field.formatter.settings.strawberry_mirador_formatter:
custom_js:
type: boolean
label: 'If custom Mirador with plugin is going to be used instead of Vanilla CDN'
mirador_version:
type: integer
label: 'Version 3 or 4 from CDN. Does not apply if custom is selectoed'
mediasource:
type: mapping
label: 'Sources for IIIF URL'
Expand Down
4 changes: 4 additions & 0 deletions css/miradorviewer.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.MiradorViewer {
position:relative;
}

.MiradorViewer h4 {
font-size: 1.2rem;
}
47 changes: 47 additions & 0 deletions css/popper.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.popper-background {
background: #333;
color: white;
font-weight: bold;
padding: 4px 8px;
font-size: 13px;
border-radius: 4px;
display:none;
}

.popper-background[data-show] {
display: block;
}

.popper-arrow,
.popper-arrow::before {
position: absolute;
width: 8px;
height: 8px;
background: inherit;
}

.popper-arrow {
visibility: hidden;
}

.popper-arrow::before {
visibility: visible;
content: '';
transform: rotate(45deg);
}

.popper-background[data-popper-placement^='top'] >.popper-arrow {
bottom: -4px;
}

.popper-background[data-popper-placement^='bottom'] > .popper-arrow {
top: -4px;
}

.popper-background[data-popper-placement^='left'] > .popper-arrow {
right: -4px;
}

.popper-background[data-popper-placement^='right'] > .popper-arrow {
left: -4px;
}
71 changes: 62 additions & 9 deletions format_strawberryfield.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ iiif_formatstrawberryfield_utils:
version: 1.0
js:
js/iiif-archipelago-interactions_utils.js: {minified: false}
https://cdn.jsdelivr.net/npm/[email protected]/dist/pako.min.js: { external: true, minified: true, preprocess: false}
dependencies:
- core/jquery
- core/drupal
Expand All @@ -21,6 +22,14 @@ jmespath_strawberry:
dependencies:
- core/drupal

popper:
js:
https://unpkg.com/@popperjs/core@2 : { external: true, minified: true, preprocess: false}
css:
component:
css/popper.css: { }


iiif_openseadragon:
remote: http://openseadragon.github.io
version: 2.4.2
Expand Down Expand Up @@ -158,16 +167,19 @@ jsm_model_strawberry:
- format_strawberryfield/iiif_formatstrawberryfield_utils

pdfs_mozilla:
version: 2.2.228
version: 4.0.379
license:
name: Apache
url: //raw.githubusercontent.com/mozilla/pdf.js/master/LICENSE
gpl-compatible: true
js:
https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.min.js: { external: true, minified: true, preprocess: false}
# js/pdfs_strawberry_webpack.js: {minified: false, attributes: { type: module } } Unused but kept around for posterity
# The only reason we use this one directly is to ensure faster (browser cache) and to use as path/settings in the actual
# js/pdfs_strawberry.js where we load the node module directly async. New to PDFJS 4.0.379+
https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.min.mjs: { external: true, minified: true, attributes: { type: module }}

pdfs_strawberry:
version: 1.2
version: 1.3
js:
js/pdfs_strawberry.js: {minified: false}
dependencies:
Expand All @@ -179,14 +191,27 @@ pdfs_strawberry:
- format_strawberryfield/iiif_formatstrawberryfield_utils

mirador_projectmirador:
version: 3.1.1
version: 3.3.0
license:
name: Apache
url: /ProjectMirador/mirador/blob/master/LICENSE
gpl-compatible: true
js:
https://cdn.jsdelivr.net/npm/[email protected]/dist/mirador.min.js: { external: true, minified: true, preprocess: false}
https://cdn.jsdelivr.net/npm/[email protected]/dist/redux-saga.umd.min.js: { external: true, minified: true, preprocess: false}

mirador_projectmirador_4:
version: 4.0.0-alpha
license:
name: Apache
url: /ProjectMirador/mirador/blob/master/LICENSE
gpl-compatible: true
js:
https://cdn.jsdelivr.net/npm/mirador@3.1.1/dist/mirador.min.js: { external: true, minified: true, preprocess: false}
https://unpkg.com/mirador@4.0.0-alpha.2/dist/mirador.min.js: { external: true, minified: true, preprocess: false}
https://cdn.jsdelivr.net/npm/[email protected]/dist/redux-saga.umd.min.js: { external: true, minified: true, preprocess: false}
dependencies:
- format_strawberryfield/mirador_font
- format_strawberryfield/iiif_formatstrawberryfield_utils

mirador_font:
css:
Expand Down Expand Up @@ -235,6 +260,22 @@ mirador_custom_strawberry:
- format_strawberryfield/mirador_font
- format_strawberryfield/iiif_formatstrawberryfield_utils

mirador_strawberry_four:
version: 1.4
js:
js/mirador_strawberry.js: {minified: false}
css:
component:
css/miradorviewer.css: {}
dependencies:
- core/jquery
- core/drupal
- core/once
- core/drupalSettings
- format_strawberryfield/mirador_projectmirador_4
- format_strawberryfield/mirador_font
- format_strawberryfield/iiif_formatstrawberryfield_utils

uv_strawberry:
version: 1.2
js:
Expand Down Expand Up @@ -284,7 +325,6 @@ leaflet_core:
component:
https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css: { external: true}


leaftleft_iiif_bound:
version: 1.0
js:
Expand Down Expand Up @@ -339,17 +379,30 @@ universalviewer:
component:
https://cdn.jsdelivr.net/npm/[email protected]/dist/uv.css: { external: true, preprocess: false }

iiif_flavor_annotations_strawberry:
version: 1.0
js:
js/iiif-annotations_strawberry.js: {minified: false}
dependencies:
- core/jquery
- core/once
- core/drupal
- core/drupalSettings
- format_strawberryfield/annotorious
- format_strawberryfield/iiif_formatstrawberryfield_utils
- format_strawberryfield/popper

annotorious:
version: 2.5.10
version: 2.7.12
license:
name: BSD-3 Clause
url: https:/recogito/annotorious/blob/master/LICENSE
gpl-compatible: true
js:
https://cdn.jsdelivr.net/npm/@recogito/annotorious@2.5.10/dist/annotorious.min.js: { external: true, minified: true, preprocess: false}
https://cdn.jsdelivr.net/npm/@recogito/annotorious@2.7.12/dist/annotorious.min.js: { external: true, minified: true, preprocess: false}
css:
component:
https://cdn.jsdelivr.net/npm/@recogito/annotorious@2.5.10/dist/annotorious.min.css: { external: true }
https://cdn.jsdelivr.net/npm/@recogito/annotorious@2.7.12/dist/annotorious.min.css: { external: true }

annotoriousopenseadragon:
version: 2.5.16
Expand Down
3 changes: 3 additions & 0 deletions format_strawberryfield.module
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function format_strawberryfield_page_attachments(array &$page) {
/* if (\Drupal::service('router.admin_context')->isAdminRoute()) {
return;
}*/
if (\Drupal::currentUser()->hasPermission('view strawberryfield webannotation')) {
$page['#attached']['library'][] = 'format_strawberryfield/iiif_flavor_annotations_strawberry';
}

$page['#attached']['library'][] = 'format_strawberryfield/lazyload_strawberry';
$page['#attached']['library'][] = 'core/jquery';
Expand Down
17 changes: 17 additions & 0 deletions format_strawberryfield.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,23 @@ format_strawberryfield.deletetmp_webannotations:
_entity_access: 'node.update'
_permission: 'add strawberryfield webannotation'

# Persist in a SBF any generated Webannotations.
format_strawberryfield.get_webannotations_fromflavor:
path: '/do/{node}/webannon/readsbf'
methods: [GET]
defaults:
_controller: '\Drupal\format_strawberryfield\Controller\WebAnnotationController::readFromFlavors'
options:
parameters:
node:
type: 'entity:node'
resource_type:
type: 'ado'
requirements:
_format: 'json'
_entity_access: 'node.view'
_permission: 'view strawberryfield webannotation'

# Display settings for each ADO
format_strawberryfield.display_settings:
path: '/node/{node}/display-settings/{bundle}/{view_mode_name}'
Expand Down
Loading

0 comments on commit 6cac775

Please sign in to comment.