Skip to content

Commit

Permalink
Merge branch 'refs/heads/improve-user-action-consistency' into staging
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/text-annotator-react/src/TextAnnotator.tsx
  • Loading branch information
oleksandr-danylchenko committed Aug 2, 2024
2 parents 3e4f100 + 4db1cb7 commit 99179f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
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 { style, filter, user } = opts;
const { style, filter, userSelectAction, user } = 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?.setUserSelectAction(userSelectAction), [anno, userSelectAction]);

useEffect(() => anno?.setUser(user), [anno, user]);

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/text-annotator/src/TextAnnotator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const createTextAnnotator = <E extends unknown = TextAnnotation>(
user: createAnonymousGuest()
});

const state: TextAnnotatorState = createTextAnnotatorState(container, opts.userAction);
const state: TextAnnotatorState = createTextAnnotatorState(container, opts.userSelectAction);

const { selection, viewport } = state;

Expand Down
2 changes: 1 addition & 1 deletion packages/text-annotator/src/TextAnnotatorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface TextAnnotatorOptions<T extends unknown = TextAnnotation> {

offsetReferenceSelector?: string;

userAction?: UserSelectActionExpression<TextAnnotation>,
userSelectAction?: UserSelectActionExpression<TextAnnotation>,

presence?: PresencePainterOptions;

Expand Down
4 changes: 2 additions & 2 deletions packages/text-annotator/src/state/TextAnnotatorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export interface TextAnnotatorState extends AnnotatorState<TextAnnotation> {

export const createTextAnnotatorState = (
container: HTMLElement,
defaultUserAction?: UserSelectActionExpression<TextAnnotation>
defaultUserSelectAction?: UserSelectActionExpression<TextAnnotation>
): TextAnnotatorState => {

const store: Store<TextAnnotation> = createStore<TextAnnotation>();

const tree = createSpatialTree(store, container);

const selection = createSelectionState<TextAnnotation>(store, defaultUserAction);
const selection = createSelectionState<TextAnnotation>(store, defaultUserSelectAction);

const hover = createHoverState(store);

Expand Down

0 comments on commit 99179f9

Please sign in to comment.