cybersemics / em

A beautiful, minimalistic note-taking app for personal sensemaking.
Other
258 stars 88 forks source link

Toolbar: Active state of formatting shortcuts should reflect selected text #2060

Open raineorshine opened 1 week ago

raineorshine commented 1 week ago

When part of a thought is selected, the active state of the toolbar buttons for bold/italic/underline/strikethrought should reflect only the selected text, not the entire thought.

When no text is selected, the toolbar buttons for bold/italic/underline/strikethrough should be active if and only if all the text in the thought is formatted.

There are two incorrect cases given below. Please ensure the solution works for all types of formatting: bold, italic, underline, and strikethrough.

1. No text selected with mixed formatting

Steps to Reproduce

Hello **world**

Current Behavior

The toolbar button for bold is active.

image

Expected Behavior

The toolbar button for bold should not be active, because the thought has some non-bold characters.

2. Unformatted text selected

Steps to Reproduce

Select the word 'hello'.

Current Behavior

Currently, the toolbar button for bold is active, but not for the right reason. Once the above issue is fixed, it will (incorrectly) be inactive.

image

Expected Behavior

The toolbar button for bold should be active, because all selected characters are bold.