Skip to content

Commit

Permalink
Merge pull request cu-mkp#113 from cu-mkp/dev
Browse files Browse the repository at this point in the history
Updates to CSS and small bug fix
  • Loading branch information
ajolipa authored May 2, 2024
2 parents bb2d4b8 + 7c3d5d9 commit 765c8c8
Show file tree
Hide file tree
Showing 24 changed files with 2,137 additions and 2,074 deletions.
2 changes: 1 addition & 1 deletion editioncrafter-umd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cu-mkp/editioncrafter-umd",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://cu-mkp.github.io/editioncrafter/",
"description": "A simple digital critical edition publication tool",
"private": false,
Expand Down
2 changes: 1 addition & 1 deletion editioncrafter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cu-mkp/editioncrafter",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple digital critical edition publication tool",
"homepage": "https://cu-mkp.github.io/editioncrafter/",
"private": false,
Expand Down
63 changes: 34 additions & 29 deletions editioncrafter/src/action/DocumentActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ function parseImageURLs(canvas) {
if (annotation.type !== 'Annotation') throwError(`Expected Annotation in items property of ${annotationPage.id}`);
if (annotation.motivation === 'painting') {
if (!annotation.body) throwError(`Expected body property in Annotation ${annotation.id}`);
if (!annotation.body.id) {
return null;
}
return {
bodyId: annotation.body.id,
imageURL: `${annotation.body.id}/info.json`,
Expand Down Expand Up @@ -139,36 +142,38 @@ function parseSingleManifest(manifest, transcriptionTypes, document) {
const canvas = canvases[i];
if (canvas.type !== 'Canvas') throwError(`Expected items[${i}] to be of type 'Canvas'.`);
if (!canvas.id) throwError(`Expected items[${i}] to have an id property.`);
const folioID = canvas.id.substr(canvas.id.lastIndexOf('/') + 1);
const canvasLabel = parseLabel(canvas);
const { bodyId, imageURL } = parseImageURLs(canvas);
const annotationURLs = parseAnnotationURLs(canvas, transcriptionTypes);

const ratio = canvas.width / canvas.height;

let thumbnailDimensions = [];
if (ratio > 1) {
thumbnailDimensions = [MAX_THUMBNAIL_DIMENSION, Math.round(MAX_THUMBNAIL_DIMENSION / ratio)];
} else {
thumbnailDimensions = [Math.round(MAX_THUMBNAIL_DIMENSION * ratio), MAX_THUMBNAIL_DIMENSION];
if (parseImageURLs(canvas)) {
const folioID = canvas.id.substr(canvas.id.lastIndexOf('/') + 1);
const canvasLabel = parseLabel(canvas);
const { bodyId, imageURL } = parseImageURLs(canvas);
const annotationURLs = parseAnnotationURLs(canvas, transcriptionTypes);

const ratio = canvas.width / canvas.height;

let thumbnailDimensions = [];
if (ratio > 1) {
thumbnailDimensions = [MAX_THUMBNAIL_DIMENSION, Math.round(MAX_THUMBNAIL_DIMENSION / ratio)];
} else {
thumbnailDimensions = [Math.round(MAX_THUMBNAIL_DIMENSION * ratio), MAX_THUMBNAIL_DIMENSION];
}

const thumbnailURL = `${bodyId}/full/${thumbnailDimensions.join(',')}/0/default.jpg`;

const folio = {
id: folioID,
doc_id: document || manifest.id,
name: canvasLabel,
pageNumber: i,
image_zoom_url: imageURL,
image_thumbnail_url: thumbnailURL,
annotationURLs,
annotations: canvas.annotations
? canvas.annotations.filter(a => a.motivation === 'tagging')
: [],
};

folios.push(folio);
}

const thumbnailURL = `${bodyId}/full/${thumbnailDimensions.join(',')}/0/default.jpg`;

const folio = {
id: folioID,
doc_id: document || manifest.id,
name: canvasLabel,
pageNumber: i,
image_zoom_url: imageURL,
image_thumbnail_url: thumbnailURL,
annotationURLs,
annotations: canvas.annotations
? canvas.annotations.filter(a => a.motivation === 'tagging')
: [],
};

folios.push(folio);
}
return folios;
}
Expand Down
2 changes: 1 addition & 1 deletion editioncrafter/src/component/DiploMatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const DiploMatic = (props) => {
}, [containerRef]);

const { fixedFrameMode } = props.diplomatic;
const fixedFrameModeClass = fixedFrameMode ? 'fixed' : 'sticky';
const fixedFrameModeClass = fixedFrameMode ? 'editioncrafter' : 'editioncrafter sticky';

return (
<Provider store={props.store}>
Expand Down
2 changes: 1 addition & 1 deletion editioncrafter/src/component/ImageGridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ImageGridView extends React.Component {
const thumbs = folios.map((folio, index) => (
// eslint-disable-next-line react/no-array-index-key
<li key={`thumb-${index}`} className="thumbnail">
<figure className={(folio.id === currentID) ? 'current' : ''}><a id={folio.id} onClick={this.onClickThumb.bind(this, folio.id)}><img src={folio.image_thumbnail_url} alt={folio.name} style={{maxWidth: "130px", maxHeight: "130px"}} onError={({ currentTarget }) => {currentTarget.onerror = null; currentTarget.src=`${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`; }} /></a></figure>
<figure className={(folio.id === currentID) ? 'current' : ''}><a id={folio.id} onClick={this.onClickThumb.bind(this, folio.id)}><img src={folio.image_thumbnail_url} alt={folio.name} style={{maxWidth: "130px", maxHeight: "130px"}} onError={({ currentTarget }) => {currentTarget.onerror = null; if (folio.image_zoom_url && currentTarget.src !== `${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`) {currentTarget.src=`${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`;} }} /></a></figure>
<figcaption className={(folio.id === currentID) ? 'thumbnail-caption current' : 'thumbnail-caption'}>
{(folio.id === currentID) ? (`*${folio.name}`) : folio.name}
</figcaption>
Expand Down
Loading

0 comments on commit 765c8c8

Please sign in to comment.