Skip to content

V4 Β #237

@rsimon

Description

@rsimon

The architecture has grown and IMO the code would benefit from refactoring and cleanup. I started drafting a "version 4" in a separate branch. So far, I have only worked on the text-annotator package, not the TEI or React packages yet.

Key Changes

  • Removed the canvas renderer. I don't think anyone has been using it, and compared to the (default) SPANs renderer it IMO has no advantages.
  • Removed the presence utility. I don't think anyone (except ourselves in Recogito Studio) is using this either, and I'd like to move that into a separate plugin package from v4 onwards.
  • Sub-divided the utils folder. Introduced a (hopefully) reasonable structure, for better readability.
  • Cleaned up project structure. Structure and naming has become a bit chaotic. I made an attempt at cleaning this up. Files are also renamed to a common lowercase+hyphen naming convention.

The project structure is now reduced to:

- model/              # core and w3c data model classes (no change)
- rendering/          # rendering code (previously "highlight")
  - renderer-css-highlight/
  - renderer-spans/
  - base-renderer.ts
  - color.ts          # color utilities - used to be inside /spans
  - highlight-style.ts
  - highlight.ts
  - renderer.ts       # essential types
  - viewport.ts
- state/ # no change
- utils/
  - annotation/       # annotation-related helpers
  - dom/              # DOM element and range helpers
  - events/           # event handling helpers
  - highlight/        # helper related to highlight rendering
- selection-handler.ts
- text-annotator.ts
- text-annotator-options.ts
- text-annotator.css

Next Steps

  • Use CSS modules for the stylesheets
  • Extend the setStyle(style) method to setStyle(style, id?), as a helper to easily set specific styles on a particular annotation. (Mostly needed to externalize the presence package, but should be generally useful.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions