我正在尝试加载本地可编辑 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/