Skip to content

Migrate annotation changes - #1554

Draft
schu96 wants to merge 4 commits into
internetarchive:masterfrom
schu96:annotation-merge
Draft

Migrate annotation changes#1554
schu96 wants to merge 4 commits into
internetarchive:masterfrom
schu96:annotation-merge

Conversation

@schu96

@schu96 schu96 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Migrated annotation code to work with newly improved main branch

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 5.55556% with 527 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.07%. Comparing base (16f5d95) to head (2ed063b).

Files with missing lines Patch % Lines
src/util/OlPopover.js 1.80% 325 Missing and 2 partials ⚠️
src/plugins/plugin.annotations.js 10.45% 137 Missing ⚠️
src/util/TextSelectionManager.js 11.76% 45 Missing ⚠️
src/util/scroll-lock.js 14.28% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1554      +/-   ##
==========================================
- Coverage   63.70%   59.07%   -4.63%     
==========================================
  Files          68       71       +3     
  Lines        6216     6752     +536     
  Branches     1378     1496     +118     
==========================================
+ Hits         3960     3989      +29     
- Misses       2217     2722     +505     
- Partials       39       41       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cdrini cdrini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got through the first half ; will finish the rest later today!

Comment thread src/util/TextSelectionManager.js Outdated
Comment thread src/util/TextSelectionManager.js Outdated
}

@customElement('br-annotation-menu')
class BRAnnotationMenu extends LitElement {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also let's create a new file, plugin.annotations.js and move this there and then import it into this file. That'll let us start structuring these in the way we'll eventually want them to be structured, can keep this file a bit more focussed/targetted.

Comment thread src/util/TextSelectionManager.js Outdated
Comment thread src/util/TextSelectionManager.js Outdated
Comment thread src/util/TextSelectionManager.js Outdated
Comment thread src/util/TextSelectionManager.js Outdated
Comment on lines +870 to +874
if (storage[idx].uuid === currentUUID) {
storage.splice(idx, 1);
saveToLocalStorage(storage);
for (const ele of this.currentAnnotationNodes) {
const tempText = ele.textContent;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of logic in this web component that requires internal knowledge of how annotations are saved. It would be better if it didn't have that internal knowledge, and all that logic was centralized in one place. Let's create a new class (in plugin.annotations.js) called AnnotationStorageService. That should have methods for easy edit/save/delete. This will also set us up for when we switch all these methods from local storage to instead using API calls.

This component can then just take in the storage service as another parameter.

Comment thread src/util/TextSelectionManager.js Outdated
Comment thread src/util/TextSelectionManager.js Outdated
Comment thread src/util/TextSelectionManager.js Outdated
@schu96
schu96 force-pushed the annotation-merge branch 2 times, most recently from b205c70 to 1ac3b87 Compare July 13, 2026 03:21
@schu96
schu96 force-pushed the annotation-merge branch from 467afe4 to 2ed063b Compare August 8, 2026 22:03
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

Successfully merging this pull request may close these issues.

2 participants