Fast Highlight

@pfaffman could you please clarify “without opening the composer”?

I thought what you wanted was to be able to do a “fast edit” so that you could add the highlighting without opening the full composer.

Like this:

image

But maybe with a “highlight” button there (which might not be so hard). And what it sounded like you really wanted was a single click that would edit, apply the highlight, and save.

Yes indeed, that is exactly what I’m seeking.

Alright well now I’ve got 2 working theme components rolled for this…

and

The one above I modified from @merefield’s Coloured Text TC.

Now want to make it a quick edit tool.

3 Likes

Hey, where did this “Share” button on the Fast Edit popup come from? I can’t find a setting to enable it.

Is that Share button from a Plugin or TC?

That’s a great question! And we both suspect that if we can find that, then your dream will be much closer to coming true!

I think it must be Social Share . . . well, it doesn’t look like it from that topic. . .

There are site settings where you can configure it. It works only on desktop view public topics.

share quote visibility
share quote buttons

FWIW setting explorer explains the settings well:

GPT Bot Settings Explorer

Look up site setting context

Reading context for: share_quote_buttons

The share_quote_buttons setting in Discourse determines which items appear in the quote sharing widget, and in what order. The default options include “Twitter” and “Email”.

This setting is client-side and allows you to choose from a list of options including Twitter, Facebook, and Email. However, it does not allow any other choices apart from these.

The setting also includes a validation check. For example, if Facebook is included in the share_quote_buttons but the Facebook app ID is not set in the site settings, it will return an error.

This setting affects the visibility and options of the quote sharing widget in the user interface. For example, if the share_quote_buttons setting includes “Twitter” and “Email”, then when a user selects a text to quote, they will see options to share the quote on Twitter and via Email.

In the Discourse codebase, you can find this setting in the site_settings.yml file and its validations in the validations.rb file. The functionality of this setting is also tested in the topic-quote-button-test.js file.

Look up site setting context

Reading context for: share_quote_visibility

The share_quote_visibility setting in Discourse determines when to show quote sharing buttons. There are three possible choices for this setting:

  • “none”: The quote sharing buttons will never be shown.
  • “anonymous”: The quote sharing buttons will only be shown to anonymous users.
  • “all”: The quote sharing buttons will be shown to all users.

The default setting is “anonymous”. This means that by default, quote sharing buttons will only be visible to users who are not logged in.

This setting is used in the quoteSharingEnabled function in the quote-button.js file. This function checks several conditions to determine whether quote sharing should be enabled. These conditions include whether the site is in desktop view, whether there are any active sharing sources, whether the topic is visible, whether the topic’s category is read restricted, and what the share_quote_visibility setting is set to.

In the acceptance tests for the topic quote button, this setting is used to determine whether the quote sharing buttons should be shown or not. If the setting is “all”, the quote sharing buttons are shown. If the setting is “none”, the quote sharing buttons are not shown.

3 Likes

“Floating Highlight Button” - yes, Love that name!

1 Like

Could it be more feasible (or altogether crazy?) to allow all – or a specific group – of the built-in composer toolbar buttons to become Fast Edit “Floating Toolbar”? (i.e. Instead of adding more buttons to the Fast Edit, add the “Floating” option to something like MD Composer Extras or bbcode buttons.)

(The thin air up here in the high altitude of the Colorado Rocky Mountains sometimes makes me highly aspirational.)
Mountain Bike Bikes GIF by Electric Cyclery

2 posts were split to a new topic: Change “share quote visibility” default from ANONYMOUS to ALL

Hmm, why use [wrap] when there is <mark>highlighted text</mark> which works out of the box?

This is highlighted text within a sentence.

8 Likes

LOL. Why indeed?

4 Likes

To simplify separated styling? (Or not?)

So kind to come to my defense, but . . .

That would be true only if you’re using <mark> in other places and want it to be different. I doubt that’s the case.

What I’d recommend (and given that I didnt’ know <mark> existed, you might consider the source!), is to just use <mark>. You wouldn’t need any CSS that way.

4 Likes

My future plan for this is to provide color options (via a color picker).

So, for example, I can select some text and apply a light blue highlight, and then select some other text and apply a pink highlight, and so on.

One (sometimes fatal, I think) limitation in the current version is that the highlight is site-wide, so changing the color applies that color change to every highlight on the site.

I mean, I guess it’s useful that the admin can change the highlight color globally, but beyond that it could be more frustrating for end users to see their highlights change color.

@merefield’s approach might be better suited as a starting point.

1 Like

Yeah. That’s lots better than my idea too. :slight_smile:

A cool idea, though it may not apply to you, would be to have a user-custom-field with a color in it and use that. Then each use could have their own highlight color.

1 Like

Yep, for sure. So really 2 different Theme Components here (both integrating a color-picker).

  1. Site-global setting including a per-user global setting, starting with basis Highlighter Composer Button

  2. Composer/Fast Edit Button (with added CTRL-H keyboard shortcut) for select-color highlighting on-the-fly, based on @merefield’s approach where bbcode is stored in the post itself.

2 Likes

Reading through this, I am excited about the idea of being able to select some text and apply <mark></mark> code to it so it is highlighted. And also the ability to choose a highlight color or treatment. I often do this to draw attention to a key sentence in my posts. I also use <kbd></kbd> to refer to buttons in my posts.

But the place where I want to do this is in the composer when writing my post, not when I am reading posts. The quote/fast edit/share popup makes sense for those three actions but I don’t really see the point of adding a highlighter button there.

And why would each user have their own highlighter color? What’s the use case for that?

1 Like

How many times have I wished for a shortcut for this tag… :smile:

1 Like