Skip to content

Commit

Permalink
Merge branch 'recogito#71-fix-losing-styleClass' into local-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-danylchenko committed Feb 29, 2024
2 parents 96b3dff + 666e392 commit 955a976
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/text-annotator-react/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ export default defineConfig(({ command, mode }) => ({
},
sourcemap: true
}
}));
}));
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const createCanvasHighlightRenderer = (
container.addEventListener('pointermove', onPointerMove);

const refresh = () => requestAnimationFrame(() => {
const bounds = getViewportBounds(container);
const bounds = getViewportBounds(container);

const { top, left, minX, minY, maxX, maxY } = bounds;

Expand Down
2 changes: 2 additions & 0 deletions packages/text-annotator/src/model/core/TextAnnotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface TextAnnotationTarget extends AnnotationTarget {

selector: TextSelector[];

styleClass?: string;

}

export interface TextSelector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ const parseW3CTextTargets = (annotation: W3CTextAnnotation) => {
} = annotation;

const w3cTargets = Array.isArray(target) ? target : [target];
if (w3cTargets.length === 0) {
return { error: Error(`No targets found for annotation: ${annotation.id}`) };
}

const parsed: TextAnnotationTarget = {
creator: parseW3CUser(creator),
created: created ? new Date(created) : undefined,
updated: modified ? new Date(modified) : undefined,
annotation: annotationId,
selector: []
selector: [],
styleClass: w3cTargets[0].styleClass
};

for (const w3cTarget of w3cTargets) {
Expand Down
2 changes: 1 addition & 1 deletion packages/text-annotator/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ export default defineConfig({
}
}
}
});
});

0 comments on commit 955a976

Please sign in to comment.