-
Notifications
You must be signed in to change notification settings - Fork 83
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
Editor shouldHandleKey not being called (again) #285
Comments
Also shouldHandle is called twice in:
What is editorContextDelegate? Also handled isn't changed. |
@easiwriter, unfortunately the ReadMe is not updated for all the samples. I'd recommend using API Reference found here which I try to keep uptodate: https://rajdeep.github.io/proton/ in regards to
|
Thanks for this.
The Editor is injected into a UIViewRepresentable. This creates a class called Coordinator that does all the work. I’ve set this to inherit from EditorViewDelegate to handle all the events. I tried inheriting from EditorViewContext but it won’t compile because the class is not marked as Open as opposed to Public (it says: Cannot inherit from non-open class 'EditorViewContext' outside of its defining module).
Best
Keith
… On 29 Feb 2024, at 06:15, Rajdeep Kwatra ***@***.***> wrote:
@easiwriter <https://github.com/easiwriter>, unfortunately the ReadMe is not updated for all the samples. I'd recommend using API Reference found here which I try to keep uptodate: https://rajdeep.github.io/proton/
in regards to EditorViewContext: basically you can create Attachments that contains EditorView in itself. Checkout Panel/Expand in CommandsExampleViewController to see an example. You can also read more about EditorViewContext here: https://rajdeep.github.io/proton/Classes/EditorViewContext.html
editorContextDelegate is the delegate that you can set on the context of the editor. If the delegate is set on Editor, the callbacks are received only for that editor. If the delegate is set on EditorViewContext instead, then the same callback will be received for all the Editors sharing the same context.
—
Reply to this email directly, view it on GitHub <#285 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AEUXIA43C6B57MV7S4KVPNLYV3DQ7AVCNFSM6AAAAABDYWLXP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQGQ3TQOJYHA>.
You are receiving this because you were mentioned.
|
I've done more digging and discovered that Proton calls
func editor(_ editor: EditorView, shouldHandle key: EditorKey, modifierFlags: UIKeyModifierFlags, at range: NSRange, handled: inout Bool) { }
This does nothing, because it has not been overridden.
Whereas the documentation has this, which is what my code calls:
func editor(_ editor: EditorView, shouldHandle key: EditorKey, at range: NSRange, handled: inout Bool)
This possibly explains why Proton doesn't call it.
I added the modifierFlags to my call and it works, so it looks like there could either be a documentation error, or I didn't see it in the documentation.
The text was updated successfully, but these errors were encountered: