rajdeep / proton

Purely native and extensible rich text editor for iOS and macOS Catalyst apps
Other
1.25k stars 81 forks source link

Editor shouldHandleKey not being called #277

Closed easiwriter closed 5 months ago

easiwriter commented 5 months ago

in the following code in RichTextEditorContext:

if text == "\n" {
            richTextView.richTextViewDelegate?.richTextView(richTextView, shouldHandle: .enter, modifierFlags: [], at: range, handled: &handled)

            guard handled == false else {
                return false
            }
            richTextView.richTextViewDelegate?.richTextView(richTextView, didReceive: .enter, modifierFlags: [], at: range)
        }

My shouldHandle method is not being called whereas the didReceive method is called. My code contains:

        func editor(_ editor: EditorView, didReceiveKey key: EditorKey, at range: NSRange) {
            if key == .enter {
                enterCount += 1
            }
        }

        func editor(_ editor: EditorView, shouldHandle key: EditorKey, at range: NSRange, handled: inout Bool) {
            if key == .enter {
                enterCount += 1
            }
        }

I haven't worked on this for a long time and when I last did I'm sure shouldHandle was called (I just added didReceiveKey to see if that was being called).

Have you changed this?

rajdeep commented 5 months ago

This callback internally maps to:

func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool 

and I have verified this to confirm that it is working as expected. The callback is bubbled up via EditorViewDelegate from editor.delegate or editor.context.delegate. Are you sure you have at least one of this set correctly?

easiwriter commented 5 months ago

I’m sure it is ok. It calls the other method I mentioned which is on the same path. I am using SwiftUI which I suspect has a hand in this. Event handling is very weird. Anyway, I have decided to give up on the project. I am 78 and well past my sell by date. I think 56 years building software is enough. BestKeithSent from my iPhoneOn Feb 19, 2024, at 3:34 AM, Rajdeep Kwatra @.***> wrote: This callback internally maps to: func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool

and I have verified this to confirm that it is working as expected. The callback is bubbled up via EditorViewDelegate from editor.delegate or editor.context.delegate. Are you sure you have at least one of this set correctly?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

rajdeep commented 5 months ago

Well, you have been developing software for more than the days I have seen in my life :) I really wish I could be more useful. For now, I am closing this issue. If you ever feel like getting back, and still have something that I could help with, I'll be more than happy to.

All the very best.

easiwriter commented 4 months ago

As you will have noticed from the issues list I have decided not to give up. Having worked on the app on and off for three years I realise it would be a stupid waste of my time to stop now. Plus I’ve had some ideas about some novel new features that will hopefully improve its USP.

Best Keith

On 21 Feb 2024, at 04:26, Rajdeep Kwatra @.***> wrote:

Well, you have been developing software for more than the days I have seen in my life :) I really wish I could be more useful. For now, I am closing this issue. If you ever feel like getting back, and still have something that I could help with, I'll be more than happy to.

All the very best.

— Reply to this email directly, view it on GitHub https://github.com/rajdeep/proton/issues/277#issuecomment-1955867370, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEUXIAYQC7UEUR7POHA2XJTYUVZO3AVCNFSM6AAAAABDNHDAECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJVHA3DOMZXGA. You are receiving this because you authored the thread.

rajdeep commented 4 months ago

Happy to see you again 🙂. I'll try to get back to you by tomorrow on the issues you've raised today and earlier.

On a side note, I'd be interested to see your app and how you've been using Proton. Any thing you can link here for me to see?

easiwriter commented 4 months ago

Thanks. I’ll let you have a copy of the app on TestFlight as soon as I’ve knocked it back into shape. Let me have an email address to use for you in TestFlight. BestKeithSent from my iPhoneOn Feb 28, 2024, at 10:04 AM, Rajdeep Kwatra @.***> wrote: Happy to see you again 🙂. I'll try to get back to you by tomorrow on the issues you've raised today and earlier. On a side note, I'd be interested to see your app and how you've been using Proton. Any thing you can link here for me to see?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

rajdeep commented 4 months ago

@easiwriter, you may use vicky_ice @ yahoo.com for TestFlight invite. Thank you.