diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index b8792b689..5a6014ade 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -709,6 +709,7 @@ internal struct FindInArticleState: Codable { } extension WebViewController { + func searchText(_ searchText: String, completionHandler: @escaping (FindInArticleState) -> Void) { guard let json = try? JSONEncoder().encode(FindInArticleOptions(text: searchText)) else { return diff --git a/iOS/Resources/main_ios.js b/iOS/Resources/main_ios.js index e19200d3d..6f02ba28f 100644 --- a/iOS/Resources/main_ios.js +++ b/iOS/Resources/main_ios.js @@ -429,6 +429,11 @@ updateFind = withEncodedArg(options => { // TODO Introduce slight delay, cap the number of results, and report results asynchronously let newFindState; + if (!options || !options.text) { + clearHighlightRects(); + return + } + try { newFindState = new FindState(options); } catch (err) {