Closed theck13 closed 7 years ago
Look's like I cant really test this one with Genymotion/Emulator, so will have to pass on it, as I don't have a HW keyboard.
Yeah, neither do I.. :/
But @astralbodies has Pixel C ;).
@astralbodies and @hypest, do either of you have an external keyboard?
I have a tablet+keyboard so I can give this a try. Will report back.
OK, gave it a go with a BT tablet case keyboard and works OK, good job!
Not sure if this has been code reviewed already but, any particular reason the keyboard mapping is handled by the demo app instead of the Aztec lib? I mean, the toolbar itself is part of Aztec so, i'd expect the shortcuts to be handled by Aztec as well. Any insight? Thanks!
any particular reason the keyboard mapping is handled by the demo app instead of the Aztec lib?
I considered handling the keyboard shortcuts within the library rather than the app. If they are in the library, they would be handled in the textbox or the toolbar. That means if the user has focus on the textbox, the toolbar wouldn't recognize the keyboard. Similarly, if the user has focus on the toolbar, the textbox wouldn't recognize the keyboard. In other words, it's possible the library wouldn't recognize the keyboard depending on the view in focus. If the keyboard shortcuts are handled in the app, they are recognized regardless of focus.
That being said, I'm up for trying a different implementation if you have another idea.
Ah, thanks for the insight @theck13! Haven't tested it but I think the toolbar can implement the mapping and the editor can ask the toolbar to consume the key before trying to consume it itself. So, both will implement the inteception but the editor will just delegate the key. Does that make sense?
Let me know if you'd still like me to test out this PR!
Fix
Add keyboard shortcuts as described in https://github.com/wordpress-mobile/WordPress-Aztec-Android/issues/184. The shortcuts available are displayed in a dialog shown by pressing
Alt
+Ctrl
+H
. The dialog can not be shown by holding the meta key (i.e. Search or Windows or Command) since the operating system overrides that key to launch search. Android also overrides the meta key and/
combination to show system-level shortcuts. TheAlt
+Ctrl
+H
combination was chosen to match Calypso. On the bright side, the standard editor shortcuts (i.e. copy, cut, paste, and select all) were included for free sinceAztecText
extendsEditText
.Test
Alt
+Ctrl
+H
.