Add the Lookup (define) menu item to PDF

We removed this to get extra menu space, but users find it useful.
Especially ESL readers.
This commit is contained in:
Jackson Harper
2022-09-12 11:43:15 +08:00
parent da90d93c62
commit 1ada0f02cf

View File

@ -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]()