IOS:WKWebView中的文本选择(WKSelectionGranularityCharacter) [英] IOS: Text Selection in WKWebView (WKSelectionGranularityCharacter)

查看:354
本文介绍了IOS:WKWebView中的文本选择(WKSelectionGranularityCharacter)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用网络视图的应用程序,可以在其中选择文本.很长的烦恼是您无法在UIWebView中跨块边界选择文本. WKWebView似乎使用其配置的属性来解决此问题:

I've got an app that uses a web view where text can be selected. It's long been an annoyance that you can't select text across a block boundary in UIWebView. WKWebView seems to fix this with a property on its configuration: selectionGranularity. One of the possible values is WKSelectionGranularityCharacter:

选择端点可以放置在任何字符边界上.

Selection endpoints can be placed at any character boundary.

听起来不错!正是我所需要的.除了在Web视图中进行设置外,我经常根本无法选择任何文本.到底是怎么回事?还有什么我需要设置的吗?有人知道了吗?

Sounds great! Exactly what I need. Except that when I set that in my web view, I often can no longer select text at all. What is going on? Is there something else I need to set? Has anyone figured this out?

更新:我发现了以下错误:

  1. 在将selectionGranularity设置为WKSelectionGranularityCharacter的应用程序中有多个WKWebView时,只有要加载的最新WKWebView才能选择文本.我已将其归档为错误18441138.

  1. When there is more than one WKWebView in an app with selectionGranularity set to WKSelectionGranularityCharacter, only the most recent one to load can select text. I've filed this as bug 18441138.

如果在selectionGranularity设置为WKSelectionGranularityCharacter的WKWebView的HTML内容中,在body内的元素上附加了单击处理程序,则无法在该元素内进行文本选择.我已将其归档为错误18440833.

If there is a click handler attached to an element inside the body in the HTML content of a WKWebView whose selectionGranularity is set to WKSelectionGranularityCharacter, text selection doesn't work inside that element. I've filed this as bug 18440833.

在应用程序中其他位置的UITextView上进入编辑模式之后,直到WKWebView重新加载之前,WKWebView中的文本选择失败.我已将其归档为错误18468405.

Text selection fails in the WKWebView after you've entered edit mode on a UITextView somewhere else in the app until the WKWebView reloads. I've filed this as bug 18468405.

有人解决过这些问题吗?

Has anyone worked around any of these?

推荐答案

从iOS 13开始,这些问题和其他问题都已修复.

These and other issues are all fixed as of iOS 13.

这篇关于IOS:WKWebView中的文本选择(WKSelectionGranularityCharacter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆