wordpress-mobile / WordPress-Editor-Android

⛔️ [DEPRECATED] A reusable Android rich text editor component.
GNU General Public License v2.0
188 stars 50 forks source link

Issue #417: Apply inline formatting to current word #427

Closed aforcier closed 8 years ago

aforcier commented 8 years ago

Addresses #417. Using in-line formatting (bold, italics, strikethrough) with the cursor inside a word will apply the formatting to the entire word.

417-expand-inline-formatting

This PR also fixes an issue in the original selection expansion code (written for adding links to text): https://github.com/wordpress-mobile/WordPress-Editor-Android/commit/5031c47b2dec8c479176237bd709767c0f773eca. When some text was already selected, pressing the link button would still expand to the entire word, making it impossible to apply a link to part of a word without using HTML mode.

This also essentially fixes the mid-word styling autocorrect bug #123 (by avoiding it entirely). Autocorrect doesn't interfere with applying the styling to the whole word at once, and the only way to apply formatting to part of a word now is to select that part first and then press the format button, which is also not interfered with by autocorrect.

A few issues/notes

cc @maxme

maxme commented 8 years ago

Using a format button will leave the word highlighted at the end (demonstrated in the GIF above). I made some attempts to reset the cursor position but I wasn't able to get consistent results due to the way the formatting action changes the DOM. I'm not sure how big of an issue this is, but I suggest addressing this as a separate issue if we decide to change it.

I like it, make it more obvious the whole word was selected/changed.

aforcier commented 8 years ago

Using a format button will leave the word highlighted at the end (demonstrated in the GIF above). I made some attempts to reset the cursor position but I wasn't able to get consistent results due to the way the formatting action changes the DOM. I'm not sure how big of an issue this is, but I suggest addressing this as a separate issue if we decide to change it.

I like it, make it more obvious the whole word was selected/changed.

👍 I was thinking that too

maxme commented 8 years ago

:shipit:

This PR also fixes an issue in the original selection expansion code (written for adding links to text): 5031c47. When some text was already selected, pressing the link button would still expand to the entire word, making it impossible to apply a link to part of a word without using HTML mode.

Fix confirmed.