Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

annotatingEnabled is not reactive and cannot be changed upon initial mouting #127

Open
oleksandr-danylchenko opened this issue Aug 1, 2024 · 0 comments

Comments

@oleksandr-danylchenko
Copy link
Contributor

oleksandr-danylchenko commented Aug 1, 2024

Issue

The annotatingEnabled property, used by the SelectionHandler, gets populated only once upon creating the text annotator instance.

export const createTextAnnotator = <E extends unknown = TextAnnotation>(
container: HTMLElement,
options: TextAnnotatorOptions<E> = {}
): TextAnnotator<E> => {

const opts = fillDefaults<E>(options, {
annotatingEnabled: true
});

const selectionHandler = SelectionHandler(container, state, opts.annotatingEnabled, opts.offsetReferenceSelector);

And, unfortunately, there's no callback exposed to update that value during the lifespan of the annotator. Additionally, passing different values for the annotatingEnabled as props in the React component- will do nothing 🤷🏻‍♂️

Suggested Changes

Following the example of "API addition: method to change userSelectAction" change, we can add the setUserSelectAction and preserve the currentAnnotatingEnabled within the SelectionHandler

oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 2, 2024
…to staging

# Conflicts:
#	packages/text-annotator-react/src/TextAnnotator.tsx
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 28, 2024
…to keyboard-event-selection

# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 28, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 28, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
#	packages/text-annotator/src/utils/index.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 28, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 30, 2024
# Conflicts:
#	packages/text-annotator-react/src/TextAnnotator.tsx
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 30, 2024
# 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
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Aug 30, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
#	packages/text-annotator/src/utils/index.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 2, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 2, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 3, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 3, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 10, 2024
# Conflicts:
#	packages/text-annotator/src/TextAnnotator.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 10, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
#	packages/text-annotator/src/utils/index.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 10, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 26, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
#	packages/text-annotator/src/TextAnnotator.ts
#	packages/text-annotator/src/highlight/baseRenderer.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 26, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 30, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
#	packages/text-annotator/src/utils/index.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Sep 30, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Oct 7, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Oct 7, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Oct 29, 2024
# Conflicts:
#	packages/text-annotator/src/utils/index.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Oct 29, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Nov 4, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Nov 4, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Nov 4, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Nov 6, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Nov 11, 2024
# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
#	packages/text-annotator/src/TextAnnotator.ts
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Nov 11, 2024
oleksandr-danylchenko added a commit to oleksandr-danylchenko/text-annotator-js that referenced this issue Dec 16, 2024
# Conflicts:
#	packages/text-annotator/src/TextAnnotator.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant