From 1ada0f02cfd9aa250fb89305bd3e70a9d4dc5ca8 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 12 Sep 2022 11:43:15 +0800 Subject: [PATCH] Add the Lookup (define) menu item to PDF We removed this to get extra menu space, but users find it useful. Especially ESL readers. --- apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift index 28a8811ff..1316f4dce 100644 --- a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift +++ b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift @@ -88,6 +88,7 @@ import Utils } .onShouldShowMenuItemsForSelectedText(perform: { pageView, menuItems, selectedText in let copy = menuItems.first(where: { $0.identifier == "Copy" }) + let define = menuItems.first(where: { $0.identifier == "Define" }) let highlight = MenuItem(title: "Highlight", block: { _ = coordinator.highlightSelection( pageView: pageView, @@ -101,7 +102,8 @@ import Utils // shareLink = ShareLink(id: UUID(), url: shareURL) // } // }) - return [copy, highlight /* , share */ ].compactMap { $0 } + define?.title = "Lookup" + return [copy, highlight, define].compactMap { $0 } }) .onShouldShowMenuItemsForSelectedAnnotations(perform: { _, menuItems, annotations in var result = [MenuItem]()