It was not necessary to debug the WKWebView, as it seems when the BC (aka the WKWebView) loses focus the editing range is lost. The editing in the TextField causes the loss of focus, of course. It is reasonable, so although this issue is not encountered in the CN1 simulator, it is better to manage the selection range that corresponds to the caret position (in both cases that a text-selection is made or not) using a global JS variable to have the range when it will be needed.
Regards Il giorno venerdì 9 luglio 2021 alle 05:19:57 UTC+2 Shai Almog ha scritto: > I'm guessing there's an exception in the JavaScript side. Ideally you > would connect to the iOS webkit debugger on the device to see that. Haven't > tried this: > https://stackoverflow.com/questions/25871586/how-to-debug-javascript-code-inside-a-wkwebview > > On Thursday, July 8, 2021 at 1:21:47 PM UTC+3 P5music wrote: > >> My app features a BrowserComponent where text is edited and it is also >> possible that material icons are displayed as images inside the BC. >> >> The images are created as base64 data and injected as IMG tags. >> It works, but there is something very strange happening. >> >> The user experience is the following (iOS simulator, iOS 14, iOS 12): >> >> -entering the editable area inside the BC >> -clicking one button outside the BC to inject the image at the caret >> position >> -the button has a listener, and when the method is executed the some >> javascript is executed >> -the javascript detects the caret position and calls a callback.success >> method that opens a dialog (it's a special class CommandDialog) with >> confirmation buttons and a TextField. >> >> now >> two possible scenarios are experienced: >> 1-the user hits the OK button and the image is correctly injected with >> another javascript command >> >> 2-the user edits the TextField or just enters it (click inside) and the >> image is not injected, so I think the javascript command is uneffective, or >> the selection range is lost (the care position is in that range javascript >> object) >> >> When entering the textfield I see that something happens in the layout, >> maybe it is recalculated, I notice slight movement of some buttons. >> >> Are you aware or guessing of some problems that the TextField can cause >> to the described workflow? What disturbance is made to the BC, just when >> the TextField is entered? >> >> This issue is not present when testing on the CN1 simulator. Images are >> always correctly injected despite even editing the TextField. >> >> Thanks in advance >> > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/1f3572b9-c02d-4c31-b225-1618ee52fb17n%40googlegroups.com.
