diff --git a/Example/Podfile b/Example/Podfile index 3e2d6e9a6..f7b784c7c 100755 --- a/Example/Podfile +++ b/Example/Podfile @@ -9,7 +9,7 @@ end def testing_pods pod 'Quick', '0.9.2' - pod 'Nimble' + pod 'Nimble', '~> 4.1.0' end target 'Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 66dc718de..55d4cd2f7 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -13,22 +13,22 @@ PODS: - MenuItemKit (1.1.3) - Nimble (4.1.0) - Quick (0.9.2) - - Realm (1.0.2): - - Realm/Headers (= 1.0.2) - - Realm/Headers (1.0.2) - - RealmSwift (1.0.2): - - Realm (= 1.0.2) + - Realm (1.1.0): + - Realm/Headers (= 1.1.0) + - Realm/Headers (1.1.0) + - RealmSwift (1.1.0): + - Realm (= 1.1.0) - SSZipArchive (1.5) - ZFDragableModalTransition (0.6) DEPENDENCIES: - FolioReaderKit (from `../`) - - Nimble + - Nimble (~> 4.1.0) - Quick (= 0.9.2) EXTERNAL SOURCES: FolioReaderKit: - :path: "../" + :path: ../ SPEC CHECKSUMS: AEXML: 716fb0a8decba4a3517324a71fee3685b30233d2 @@ -38,11 +38,11 @@ SPEC CHECKSUMS: MenuItemKit: 11c448d9172936ee79ebb78f36dffd396020a9e5 Nimble: 97a0a4cae5124c117115634b2d055d8c97d0af19 Quick: 18d057bc66451eedd5d1c8dc99ba2a5db6e60226 - Realm: 9d5c46a4d7d27958530a8dfc58f63a99e5c2cba3 - RealmSwift: 82f3ac5e24530143dddfde2033acc0d308f27d96 + Realm: ceecf1a4540c4ce9efe196fe73fa9855bce05bd8 + RealmSwift: 838058b2db95b12cb86bd0cf209df642c33fb60a SSZipArchive: 29daace2bccb90a47de2837744da397728ff9207 ZFDragableModalTransition: 0d294eaaba6edfcb9839595de765f9ca06a4b524 -PODFILE CHECKSUM: 019ed1399429245758bdf9b0c090c4b685a25030 +PODFILE CHECKSUM: 617d506c4ff6fef0fcf4032d9acdc7ee8ad208e9 COCOAPODS: 1.0.1 diff --git a/Source/FolioReaderConfig.swift b/Source/FolioReaderConfig.swift index da335b967..f076adcde 100755 --- a/Source/FolioReaderConfig.swift +++ b/Source/FolioReaderConfig.swift @@ -164,7 +164,10 @@ public class FolioReaderConfig: NSObject { /// Localizes Content title public var localizedContentsTitle = NSLocalizedString("Contents", comment: "") - + + /// Use the readers `UIMenuController` which enables the highlighting etc. The default is `true`. If set to false it's possible to modify the shared `UIMenuController` for yourself. Note: This doesn't disable the text selection in the web view. + public var useReaderMenuController = true + /// Localizes Highlight date format. This is a `dateFormat` from `NSDateFormatter`, so be careful 🤔 public var localizedHighlightsDateFormat = "MMM dd, YYYY | HH:mm" public var localizedHighlightMenu = NSLocalizedString("Highlight", comment: "") diff --git a/Source/FolioReaderPage.swift b/Source/FolioReaderPage.swift index 72ff0c2d8..038c19f43 100755 --- a/Source/FolioReaderPage.swift +++ b/Source/FolioReaderPage.swift @@ -441,7 +441,7 @@ public class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGesture // MARK: UIMenu visibility override public func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool { - if UIMenuController.sharedMenuController().menuItems?.count == 0 { + if UIMenuController.sharedMenuController().menuItems?.count == 0 { webView.isColors = false webView.createMenu(options: false) } diff --git a/Source/FolioReaderWebView.swift b/Source/FolioReaderWebView.swift index 04413e3ee..036db78fd 100644 --- a/Source/FolioReaderWebView.swift +++ b/Source/FolioReaderWebView.swift @@ -8,7 +8,7 @@ import UIKit -class FolioReaderWebView: UIWebView { +public class FolioReaderWebView: UIWebView { var isColors = false var isShare = false @@ -17,7 +17,7 @@ class FolioReaderWebView: UIWebView { // MARK: - UIMenuController public override func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool { - guard readerConfig != nil else { + guard readerConfig != nil && readerConfig.useReaderMenuController == true else { return super.canPerformAction(action, withSender: sender) } @@ -177,6 +177,10 @@ class FolioReaderWebView: UIWebView { // MARK: - Create and show menu func createMenu(options options: Bool) { + guard readerConfig.useReaderMenuController else { + return + } + isShare = options let colors = UIImage(readerImageNamed: "colors-marker")