Skip to content

Commit

Permalink
Merge branch 'recogito#127-annotating-enabled-reactive' into staging
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	packages/text-annotator-react/package.json
#	packages/text-annotator-react/src/TextAnnotator.tsx
#	packages/text-annotator/package.json
#	packages/text-annotator/src/SelectionHandler.ts
#	packages/text-annotator/src/TextAnnotatorOptions.ts
  • Loading branch information
oleksandr-danylchenko committed Aug 30, 2024
2 parents 7c4c471 + 3d7e09c commit 1aad7bc
Show file tree
Hide file tree
Showing 11 changed files with 562 additions and 527 deletions.
1,023 changes: 527 additions & 496 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@recogito/text-annotator-monorepo",
"version": "3.0.0-rc.39",
"version": "3.0.0-rc.41",
"description": "Recogito Text Annotator monorepo",
"author": "Rainer Simon",
"repository": {
Expand Down
12 changes: 6 additions & 6 deletions packages/extension-tei/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@recogito/text-annotator-tei",
"version": "3.0.0-rc.39",
"version": "3.0.0-rc.41",
"description": "Recogito Text Annotator TEI extension",
"author": "Rainer Simon",
"license": "BSD-3-Clause",
Expand All @@ -27,12 +27,12 @@
},
"devDependencies": {
"CETEIcean": "^1.9.3",
"typescript": "5.5.3",
"vite": "^5.3.5",
"vite-plugin-dts": "^3.9.1"
"typescript": "5.5.4",
"vite": "^5.4.2",
"vite-plugin-dts": "^4.0.3"
},
"peerDependencies": {
"@annotorious/core": "^3.0.0-rc.31",
"@recogito/text-annotator": "3.0.0-rc.39"
"@annotorious/core": "^3.0.0",
"@recogito/text-annotator": "3.0.0-rc.41"
}
}
15 changes: 7 additions & 8 deletions packages/text-annotator-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
"devDependencies": {
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"openseadragon": "4.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "5.5.3",
"vite": "^5.3.5",
"vite-plugin-dts": "^3.9.1",
"vite-tsconfig-paths": "^4.3.2"
"typescript": "5.5.4",
"vite": "^5.4.2",
"vite-plugin-dts": "^4.0.3",
"vite-tsconfig-paths": "^5.0.1"
},
"peerDependencies": {
"openseadragon": "^3.0.0 || ^4.0.0",
Expand All @@ -45,12 +44,12 @@
}
},
"dependencies": {
"@annotorious/core": "^3.0.0-rc.31",
"@annotorious/react": "^3.0.0-rc.31",
"@annotorious/core": "^3.0.0",
"@annotorious/react": "^3.0.0",
"@floating-ui/react": "^0.26.23",
"@soomo/text-annotator": "3.0.0-staging.50",
"@react-aria/live-announcer": "^3.3.4",
"@recogito/text-annotator-tei": "3.0.0-rc.39",
"@recogito/text-annotator-tei": "3.0.0-rc.41",
"CETEIcean": "^1.9.3",
"unique-random": "^4.0.0"
}
Expand Down
4 changes: 3 additions & 1 deletion packages/text-annotator-react/src/TextAnnotator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const TextAnnotator = <E extends unknown>(props: TextAnnotatorProps<E>) =
const el = useRef<HTMLDivElement>(null);

const { className, children, ...opts } = props;
const { annotatingEnabled, style, filter, userSelectAction, user } = opts;
const { style, filter, user, annotatingEnabled, userSelectAction } = opts;

const { anno, setAnno } = useContext(AnnotoriousContext);

Expand All @@ -45,6 +45,8 @@ export const TextAnnotator = <E extends unknown>(props: TextAnnotatorProps<E>) =

useEffect(() => anno?.setFilter(filter), [anno, filter]);

useEffect(() => anno?.setFilter(filter), [anno, filter]);

useEffect(() => anno?.setUserSelectAction(userSelectAction), [anno, userSelectAction]);

useEffect(() => anno?.setUser(user), [anno, user]);
Expand Down
18 changes: 9 additions & 9 deletions packages/text-annotator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@
},
"devDependencies": {
"@types/jsdom": "^21.1.7",
"@types/rbush": "^3.0.3",
"@types/rbush": "^3.0.4",
"@types/uuid": "^10.0.0",
"jsdom": "^24.1.1",
"svelte": "^4.2.18",
"typescript": "5.5.3",
"vite": "^5.3.5",
"vite-plugin-dts": "^3.9.1",
"vitest": "^2.0.4"
"jsdom": "^25.0.0",
"svelte": "^4.2.19",
"typescript": "5.5.4",
"vite": "^5.4.2",
"vite-plugin-dts": "^4.0.3",
"vitest": "^2.0.5"
},
"dependencies": {
"@annotorious/core": "^3.0.0-rc.31",
"@annotorious/core": "^3.0.0",
"colord": "^2.9.3",
"debounce": "^2.1.0",
"dequal": "^2.0.3",
"nanoevents": "^9.0.0",
"hotkeys-js": "^3.13.7",
"rbush": "^4.0.0",
"rbush": "^4.0.1",
"uuid": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/text-annotator/src/SelectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const createSelectionHandler = (
// ...then make the new annotation the current selection
selection.userSelect(currentTarget.annotation, lastDownEvent);
}
}, 10);
}, 10).bind(undefined);

document.addEventListener('selectionchange', onSelectionChange);

Expand Down
3 changes: 2 additions & 1 deletion packages/text-annotator/src/TextAnnotatorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface TextAnnotatorOptions<T extends unknown = TextAnnotation> {
style?: HighlightStyleExpression;

user?: User;

}

export type RendererType = 'SPANS' | 'CANVAS' | 'CSS_HIGHLIGHTS';
Expand All @@ -32,7 +33,7 @@ export const fillDefaults = <T extends unknown = TextAnnotation>(
return {
...opts,
annotatingEnabled: opts.annotatingEnabled ?? defaults.annotatingEnabled,
user: opts.user || defaults.user,
user: opts.user || defaults.user
};

};
2 changes: 1 addition & 1 deletion packages/text-annotator/src/highlight/baseRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const createBaseRenderer = (
currentPainter.reset();

redraw();
}, 10);
}, 10).bind(undefined);

window.addEventListener('resize', onResize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const createRenderer = (container: HTMLElement): RendererImplementation => {
});
});

const onResize = debounce(() => resetCanvas(canvas), 10);
const onResize = debounce(() => resetCanvas(canvas), 10).bind(undefined);

window.addEventListener('resize', onResize);

Expand Down
6 changes: 4 additions & 2 deletions packages/text-annotator/src/state/TextAnnotatorState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Filter, UserSelectAction, Store, ViewportState, UserSelectActionExpression } from '@annotorious/core';
import type { Filter, Store, ViewportState, UserSelectActionExpression } from '@annotorious/core';
import {
createHoverState,
createSelectionState,
Expand Down Expand Up @@ -35,7 +35,9 @@ export const createTextAnnotatorState = (

const tree = createSpatialTree(store, container);

const selection = createSelectionState<TextAnnotation>(store, defaultUserSelectAction);
// Temporary
const selection = createSelectionState<TextAnnotation>(store)
selection.setUserSelectAction(defaultUserSelectAction);

const hover = createHoverState(store);

Expand Down

0 comments on commit 1aad7bc

Please sign in to comment.