ios - 在 iOS13 上编辑加载到 WKWebview 上的 HTML 文件时围绕 html 内容的边框

标签 ios objective-c webkit wkwebview ios13

enter image description here

我正在尝试加载本地可编辑 html文件到 WKWebview . WKWebview成功加载html文件。但是,当我开始输入可编辑的 html文件中,键入的文本周围会出现一个类似 View 的黑色边框。此问题在 iOS12 上无法重现。

(void)viewDidLoad
{
    [super viewDidLoad];
    NSBundle *bundle = [NSBundle mainBundle];
    NSURL *indexFileURL = [bundle URLForResource:@"index" withExtension:@"html"];
    [self.wkWebView loadRequest:[NSURLRequest requestWithURL:indexFileURL]];
}

index.html:

<html>
    <body>
        <div id="content" contenteditable="true" style="font-family: Helvetica"> Type here </div>
    </body>
<html>

最佳答案

<html>
    <head>
    <style type="text/css">
        div {
        outline: none
            }
            </style>
    </head>
    <body >

    <div contenteditable="true">Type here</div>

    </body>
</html>


将 outline:none 添加到 div 标签可以解决问题。

关于ios - 在 iOS13 上编辑加载到 WKWebview 上的 HTML 文件时围绕 html 内容的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57456490/

相关文章:

objective-c - 在 Objective-C 中使用类别覆盖方法

objective-c - 使用 mailcore2 从 IMAP 帐户详细信息中获取完整的电子邮件地址

c++ - 在 WebKit 中禁用滚动条(平面框架模式)

html - chrome (webkit) 上输入类型 ='range' 的对齐问题

ios - 与 xib 中隐藏的导航栏相关的自动布局无效

ios - iOS上的正弦波绘图

ios - 与不这样做相比,为 UITableView 调用 beginUpdates/endUpdates 有什么好处?

ios - 当 Sprite 到达路径末端时,如何从 SpriteKit 重复 Action 中获得回调?

ios - 当我 'po' lldb 中的核心数据对象时,x-coredata 路径是什么意思?

html - 图例标签和 Chrome