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

har*_*823 1 webkit objective-c ios wkwebview ios13

在此处输入图片说明

我正在尝试将本地可编辑html文件加载到上WKWebviewWKWebview成功加载html文件。但是,当我开始在可编辑html文件中键入内容时,键入的文本周围会出现类似黑色边框的视图。在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>
Run Code Online (Sandbox Code Playgroud)

har*_*823 5

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

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

    </body>
</html>

Run Code Online (Sandbox Code Playgroud)

在div标签中添加outline:none即可解决此问题。