-
Notifications
You must be signed in to change notification settings - Fork 59
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
How to set caret at specific location #28
Comments
Yes I believe it is possible. In Resources/editor/rich_editor.js, you can create a new Assuming we already know the position of the text, you can 1) focus in on the window (this might be run via another Swift command that calls In other words, if you can figure out how to do it via JavaScript like on any normal HTML website, you can do it here as well. Hope that helps |
Thanks @Andrew-Chen-Wang for pointing me to the right direction. I was able to focus the web view and set the cursor at the beginning of the document by adding the code in viewDidAppear of relevant view controller:
and adding to
and also adding to
however the problem I'm facing is that whole tableView is scrolled to bottom. So the But this problem with scrolling... do you have a suggestion on how to prevent the UITableView from scrolling to bottom when RichTextView is focused? |
I'm not sure which thing is scrolling to the bottom, but regardless, there is a JS event listener for focus that allows you to set clientX back to the top. If the table view is scrolling to the bottom, you can add a callback to Swift. I believe there is a callback that you can create using RE.callback that'll let you send back any data type. Then in Swift, you can adjust the scroll. |
Btw focusing for me worked on simulator but not on device (iPhone Mini 12, iOS 16.3.1). What fixed it was this thread. In viewDidAppear:
and WKWebView extension:
|
I want to support email-compose kind of view so that when you forward or reply on existing email, it shows previous content bellow, setting the cursor at the top of the RichEditorView.
However, I'm not sure how to achieve that. Is it possible to set a caret cursor at specified location in RichEditorView?
The text was updated successfully, but these errors were encountered: