From 49dde3f1029b9d25e7596ddbed66145ba93d1d1d Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 21 Mar 2024 13:03:33 +0800 Subject: [PATCH] Dont show menu when in auto highlight mode, better spacing for youtube sticky player --- .../Sources/App/Views/WebReader/WebReaderContent.swift | 4 ++++ .../Sources/Views/Article/OmnivoreWebView.swift | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift index c5a996ea2..326dd246e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift @@ -60,6 +60,10 @@ struct WebReaderContent { body { -webkit-text-size-adjust: 100%; } + .is-sticky { + right: 15px !important; + bottom: 40px !important; + } diff --git a/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift b/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift index e6794a45a..af128dd9b 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/OmnivoreWebView.swift @@ -377,6 +377,14 @@ public final class OmnivoreWebView: WKWebView { let items: [UIMenuElement] if currentMenu == .defaultMenu { + let autoHighlightEnabled = UserDefaults.standard.value(forKey: UserDefaultKey.enableHighlightOnRelease.rawValue) + if let autoHighlightEnabled = autoHighlightEnabled as? Bool, autoHighlightEnabled { + builder.remove(menu: .standardEdit) + builder.remove(menu: .lookup) + builder.remove(menu: .find) + super.buildMenu(with: builder) + return + } let highlight = UICommand(title: LocalText.genericHighlight, action: #selector(highlightSelection)) items = [highlight, annotate] } else {