From 57a8f4ea926377ebe5b467124712b0c1a9e0b4c6 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Thu, 18 Jul 2024 21:08:55 +0200 Subject: [PATCH] Fix Find in page availability --- App/CompactViewController.swift | 2 +- Views/BrowserTab.swift | 2 +- Views/BuildingBlocks/ContentSearchButton.swift | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/App/CompactViewController.swift b/App/CompactViewController.swift index 3a7472df..83856046 100644 --- a/App/CompactViewController.swift +++ b/App/CompactViewController.swift @@ -212,7 +212,7 @@ private struct Content: View { systemImage: "die.face.5", action: { browser.loadRandomArticle() }) .disabled(zimFiles.isEmpty) - ContentSearchButton(webView: browser.webView) + ContentSearchButton() } } } diff --git a/Views/BrowserTab.swift b/Views/BrowserTab.swift index e268ea51..bb81bccc 100644 --- a/Views/BrowserTab.swift +++ b/Views/BrowserTab.swift @@ -43,7 +43,7 @@ struct BrowserTab: View { #endif BookmarkButton() #if os(iOS) - ContentSearchButton(webView: browser.webView) + ContentSearchButton() #endif ArticleShortcutButtons(displayMode: .mainAndRandomArticle) } diff --git a/Views/BuildingBlocks/ContentSearchButton.swift b/Views/BuildingBlocks/ContentSearchButton.swift index be0aee7d..db08c573 100644 --- a/Views/BuildingBlocks/ContentSearchButton.swift +++ b/Views/BuildingBlocks/ContentSearchButton.swift @@ -19,16 +19,16 @@ import WebKit struct ContentSearchButton: View { - let webView: WKWebView + @EnvironmentObject private var browser: BrowserViewModel var body: some View { Button("common.search".localized, systemImage: "text.magnifyingglass", action: { - webView.isFindInteractionEnabled = true - webView.findInteraction?.presentFindNavigator(showingReplace: false) + browser.webView.isFindInteractionEnabled = true + browser.webView.findInteraction?.presentFindNavigator(showingReplace: false) } - ).disabled(webView.url == nil) + ).disabled(browser.url == nil) } } #endif