-
Notifications
You must be signed in to change notification settings - Fork 811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: customizable character and space shortcut events #2228
Conversation
…ngWithSingleCharacter()
lib/src/editor/raw_editor/config/events/format/format_single_character_handler.dart
Outdated
Show resolved
Hide resolved
lib/src/editor/raw_editor/config/events/space_shortcut_events.dart
Outdated
Show resolved
Hide resolved
lib/src/editor/raw_editor/config/events/space_shortcut_events.dart
Outdated
Show resolved
Hide resolved
lib/src/editor/raw_editor/config/events/character_shortcuts_events.dart
Outdated
Show resolved
Hide resolved
lib/src/editor/raw_editor/config/events/character_shortcuts_events.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is cleaning up a lot of complex code and enabling a lot of potential for customization. Without trying the code, the only thing that worries me is typing in the following:
Multiplication example: 2 * 3 = 6, whereas the product of 3 * 4 = 12
Would that appear as:
Multiplication example: 2 3 = 6, whereas the product of 3 4 = 12
where the text is converted to italic when it should not be.
Is there a way of saying not to apply the conversion - I really want an asterisk here.
Asterisk is also used as a superscript to refer to a footnote. Would that also trigger the conversion?
On desktops, it is easier to just use control+i (windows, or mac Cmd+i? linux?) to turn on/off italic so it would never occur to me to use markdown syntax. For mobile, the reverse would be true!
There will always be one condition for
If you use the default implementations, yeah. That's a limitation. I know it may seem a bit confusing, because it is new and probably requires more documentation, but in this case of asterisks the handler could be bypassed if we put the asterisk on the right first and then the one on the left. However, if in your case, at least you want this type of text block to be ignored, you can always create your own handler to ignore any asterisk that is between numbers. Note By default, there are not implemented any |
Description
A new possibility to add real-time shortcuts has been created using
CharacterShortcutEvent
andSpaceShorcutEvent
. Both are executed when_onKeyEvent
is called, however, checks are made to not execute everything at the same time first (this could be subject to change in order to improve the performance of the operations).CharacterShorcutEvent
is a class that is called in a general way every time the user types something inside the editor (these events are ignored and the key is space, tab, or a new line).SpaceShorcutEvent
is a class that is only called (as its name says) when the space key is pressed.Example
Without shorcuts implemented
With shorcuts implemented
showcases.mp4