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

Highlight text and images on a page and make annotations #144

Open
kaidatavis opened this issue Jan 8, 2024 · 6 comments
Open

Highlight text and images on a page and make annotations #144

kaidatavis opened this issue Jan 8, 2024 · 6 comments

Comments

@kaidatavis
Copy link
Collaborator

No description provided.

@Yuu-Han
Copy link
Collaborator

Yuu-Han commented Jan 13, 2024

Update: c31b896 supports highlighting selected text on the tab page (reuse the implementation in old-historymap with a few apis migrated to manifest v3 features). The highlighted content is not sent to HistoryMap yet.

@Yuu-Han
Copy link
Collaborator

Yuu-Han commented Jan 14, 2024

I just had a look at the wiki page and found the comments on missing features.

Image highlighting * (what about multiple images?)

I think highlighting multiple images is a practical need. For example, when I searching for inspiring prompts and images on a web gallery, I would like to highlight all the images that might be desirable.

The original implementation allows only one representative image by removing any previously highlighted image when there is a new one (see the following code). It should be easy to push multiple images to highlights array, the main question is how to present the images in HistoryMap. The options can be: (1) gallery (like mac finder), (2) list.

//adds highlighted text image or note
addHighlight: function (url, highlight) {
this.prepareUrlForHighlights(url);
var highlights = this.urlToHighlight[url];
if (highlight.type === "highlightImage"){
//removing an already highlighted image(if it exists)
var foundNode = highlights.find(a => (a.type === "highlightImage") && (a.pageUrl === highlight.pageUrl));
var foundNodeIndex = highlights.indexOf(foundNode);
if(foundNodeIndex > -1){
highlights.splice(foundNodeIndex, 1);
}
}
//pushes "highlightImage", "highlightSelection"(text) or "noted"(note)
highlights.push(highlight);
return highlights;
},

@kaidatavis
Copy link
Collaborator Author

the main question is how to present the images in HistoryMap.

Indeed, and it needs to be compact so it would still work when there are many nodes and images. I don't have a strong preference between the two; maybe it also relates to the layout, i.e., how the node size/shape with images would better work with the layout.

@Yuu-Han
Copy link
Collaborator

Yuu-Han commented Jan 20, 2024

Implemented highlighting images and showing the highlighted text and images on historymap (902f4ab).

  • Images are saved as base64 data stored in the highlights array in hmPages.

A preview figure:

image

Todo

  • Removing image and selecting representative image is not supported yet
  • Currently multiple images are shown as gallery, I might take the layout into consideration and investigate other options.
  • Better to save highlights in background

@Yuu-Han Yuu-Han changed the title Highlight text and images on a page Highlight text and images on a page and make annotations May 25, 2024
@Yuu-Han
Copy link
Collaborator

Yuu-Han commented Jun 1, 2024

Highlight text is back (252fce6).

Take note on a webpage (6b14a0a):

hm-add-note

Loading highlights and note from historymap to a reopened webpage is not yet supported.

@Yuu-Han
Copy link
Collaborator

Yuu-Han commented Jun 8, 2024

Editing note on HistoryMap (5edec7e):

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants