Open manikandan-gopal opened 4 years ago
After running a few tests on my own JS, it seems to be a webkit bug. Calls to document.queryCommandState ("underline"))
(and others such as strikeout) return true
instead of false
until you move the cursor. (e.g. tap somewhere else or add some additional input)
After a bit more research, it was fixed by the webkit team in May of 2018. (See https://bugs.webkit.org/show_bug.cgi?id=158115) I'm not sure when this will get migrated into the latest iOS/macOS version.
Thanks much for the response @michafaw. I too tested the same, and I agree that it's the issue with webkit engine. Is there any alternative for fixing it?
I haven't found anything yet. For now, we have a half solution. In my own JS callback (not ZSS) I'm ignoring the return values from queryCommandState
right after I press the underline button to turn it off. This will show the correct underline button status (off) unless the user taps a different style button before moving the cursor/adding more input. (Perhaps relevant: I'm running Xcode 10. I haven't checked if this bug is fixed in the Xcode 11 SDK yet.)
Thanks @michafaw.
@michafaw Thanks for point out the problem is webkit bug.
1) Select underline and strikethrough style. 2) type some content 3) give a line break(press enter) 4) styles(underline and strikethrough) are still highlighted.(this is not an issue) 5) now unselect the styles(underline and strikethrough) 6) underline and strikethrough buttons are still highlighted(this is the issue)