CXTDT-352289 - disabled clipboard actions

This commit is contained in:
Krishna Kishore Bandaru 2022-11-28 14:57:53 +05:30
parent 6449d68f4f
commit dce172bb64
3 changed files with 17 additions and 1 deletions

View File

@ -338,6 +338,7 @@ import UIKit
placeholder = model.placeholder
textField.shouldMaskWhileRecording = model.shouldMaskRecordedView ?? true
textField.enableClipboardActions = model.enableClipboardActions
switch model.type {
case .password, .secure:

View File

@ -37,6 +37,7 @@
public var clearTextOnTap: Bool = false
public var displayFormat: String?
public var displayMask: String?
public var enableClipboardActions: Bool = true
//--------------------------------------------------
// MARK: - Initializers
@ -112,6 +113,7 @@
case clearTextOnTap
case displayFormat
case displayMask
case enableClipboardActions
}
//--------------------------------------------------
@ -143,6 +145,10 @@
if let textAlignment = try typeContainer.decodeIfPresent(NSTextAlignment.self, forKey: .textAlignment) {
self.textAlignment = textAlignment
}
if let enableClipboardActions = try typeContainer.decodeIfPresent(Bool.self, forKey: .enableClipboardActions) {
self.enableClipboardActions = enableClipboardActions
}
}
open override func encode(to encoder: Encoder) throws {
@ -157,5 +163,6 @@
try container.encode(enabledTextColor, forKey: .enabledTextColor)
try container.encode(disabledTextColor, forKey: .disabledTextColor)
try container.encode(clearTextOnTap, forKey: .clearTextOnTap)
try container.encode(enableClipboardActions, forKey: .enableClipboardActions)
}
}

View File

@ -23,7 +23,7 @@ public protocol TextInputDidDeleteProtocol: AnyObject {
/// Set to true to hide the blinking textField cursor.
public var hideBlinkingCaret = false
public var enableClipboardActions: Bool = true
public var shouldMaskWhileRecording: Bool = true
//--------------------------------------------------
@ -74,6 +74,14 @@ public protocol TextInputDidDeleteProtocol: AnyObject {
super.deleteBackward()
didDeleteDelegate?.textInputDidDelete()
}
open override func buildMenu(with builder: UIMenuBuilder) {
defer { super.buildMenu(with: builder) }
guard !enableClipboardActions else { return }
builder.remove(menu: .lookup)
}
open override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { enableClipboardActions }
}
/// MARK:- MVMCoreViewProtocol