Implement toggle bold and italic shortcuts #1733
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #861
This pr pairs with another pr that contains changes to the gutenberg repo. It follows the proposal I laid out here.
This only contains work for the italics and bold shortcuts because the undo and redo shortcuts are already working.
GutenbergViewController
andMainActivity
that host the React native app. On iOS, this enables us to leverage some of the native shortcut discoverability features that are on iOS as well as making shortcuts "global" for free. If we agree this is a reasonable choice on iOS, I'll need to add localized strings for shortcut discoverability (see checkbox below). For consistency and for making it easy to make shortcuts global, I also implemented the shortcut listener in theMainActivity
on android.GutenbergViewController
is already pretty long, I've created aShortcutsCoordinator
in the same spirit as theMedia*Coordinators
. In order for the shortcuts coordinator to do non-trivial work in handling shortcuts, I needed to modifier the responder chain so that it has a chance to handle shortcut events. On Android, the ideal home for this functionality was less obvious, and since theMainActivity
is pretty lean, I threw some of the shortcut code there for now. I'm totally open to feedback if anyone has any ideas where that code should live.To test:
If you want to test the bold shortcut, its as simple as clicking a textview and pressing modifier-b.
If you want to test italics, you'll have to run the apps in release mode so that the developer menu is disabled and the toggle inspector shortcut doesn't interfere with the toggle italics shortcut.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.