OneupNetwork / SQRichTextEditor

A rich text WYSIWYG editor for iOS, which is based on Squire using HTML5 and javascript.
MIT License
90 stars 29 forks source link

Custom inputAccessoryView of SQTextEditorView? #4

Open Borko4vp opened 3 years ago

Borko4vp commented 3 years ago

Is there a way to override inputAccessoryView property of SQTextEditorView? I did manage to accomplish this by subclassing WKWebView and overriding/exposing inputAccessoryView in it, and replacing webView property of the SQTextEditorView with subclass instance.

But still i don't like this approach much since i had to make changes to the pod code? Any better solution?

Thanks.

RahulFate commented 3 years ago

Is there a way to override inputAccessoryView property of SQTextEditorView? I did manage to accomplish this by subclassing WKWebView and overriding/exposing inputAccessoryView in it, and replacing webView property of the SQTextEditorView with subclass instance.

But still i don't like this approach much since i had to make changes to the pod code? Any better solution?

Thanks.

Hi @Borko4vp , I would like to implement this in my project. But I am facing same issue. I would like to show all options of editing on keyboard tool bar instead of collection view. Can you please suggest me, how can we achieve this ?

subashparajuli007 commented 3 years ago

Hello @RahulFate did you solve this issue?

RahulFate commented 3 years ago

@subashparajuli007 not yet.

RahulFate commented 3 years ago

If you have solution for this then please share

subashparajuli007 commented 3 years ago

Make a custom web view like this:

public class RichEditorWebView: WKWebView { public var accessoryView: UIView? public override var inputAccessoryView: UIView? { // remove/replace the default accessory view return accessoryView } }

subclass the web view in SQEditorTextView like this: public lazy var webView: RichEditorWebView

finally add accessory view to your SQTextEditorView like this: editorView.webView.accessoryView = bar