Feature: "Like" specific text inside a post, not just the post itself (Video)

Hi Community,

I have a programming question related to a new feature that I am building on a theme component. I prepared a short video to demonstrate what I already have and where I am blocked.

Here is a short description though:
I want people to be able to “like” specific text inside posts (also other peoples’ posts) - not just the entire post.
Once a user selects a text, he clicks a new icon which in turn wraps the selected text with the [warp] block, which I then use to style.

The wrapping happens by modifying the raw text - which poses a problem for non-admin users who cant modify other people’s posts.

Questions:

  • I am looking for a way to save my “meta information” on the model itself.
  • I am looking for a way to modify/decorate the text in a way that every user can do it.

Thanks for your help

5 Likes

like you i’m really interested in this feature. It helps us get community input in selecting/quoting good and valuable content to host for ourselves or create a publicly shared directory.

1 Like

I actually got this implemented in a more secure way, also using a theme component.

The goal
Give people the ability to like content inside a post, not just the post itself, e.g. people should be able to express that they like a picture specifically or text passages.

The approach
Since we are on a theme component I needed to find a way to save the meta information about such a “user like” somewhere, because apparently, only real plugins can modify the database. My initial approach was to edit the raw text of the post but this ended up being really messy since we were modifying users’ posts which we didn’t want.
The solution I ended up with was using Firebase Firestore to save things.

The result
Users can now “heart” thumbs, and texts inside LI elements and Ps.

Moving forward
I am planning on making this available as a theme component but the data storage part has to be handled by the developers themselves if they want to host the data elsewhere.

If people give enough likes I will push this out soon :slight_smile:

4 Likes

This feature could be useful for very large posts where some parts stand out more than others.
By the way, if there are multiple likes, could the 25% most liked be shown so that it is clearer? It may look very messy with lots of red lines of text all over the place.

Sure thing, we can build whatever we want :wink: What do you mean with the most 25% percent?

1 Like

Posts that are liked higher than the third quartile (the highest 25 percent.)

1 Like

Please, release this feature soon!
I love the highlight feature on medium and now i wish it could appear in the discourse. because sometimes we will want to express our feelings on a piece of text and save it so we can review it as a bookmark feature (but currently can only bookmark the entire article) :heart_eyes:

Hello, we have it workng stable now. Need to to code cleanup and provide a community ready version.
Perception of this is really amazing, people love it.
Will keep you posted! I hope to provide something this week.

5 Likes

This seems to be impressive work. I’d love to have a look at the code (and probably understand 30%) when it’s released. :slight_smile:

1 Like