Fix poll text limits

This commit is contained in:
Isaac
2024-04-26 19:14:48 +04:00
parent c5165b03ac
commit 53f37cd043
3 changed files with 57 additions and 23 deletions

View File

@@ -75,6 +75,7 @@ public final class ListComposePollOptionComponent: Component {
public let resetText: ResetText?
public let assumeIsEditing: Bool
public let characterLimit: Int?
public let emptyLineHandling: TextFieldComponent.EmptyLineHandling
public let returnKeyAction: (() -> Void)?
public let backspaceKeyAction: (() -> Void)?
public let selection: Selection?
@@ -90,6 +91,7 @@ public final class ListComposePollOptionComponent: Component {
resetText: ResetText? = nil,
assumeIsEditing: Bool = false,
characterLimit: Int,
emptyLineHandling: TextFieldComponent.EmptyLineHandling,
returnKeyAction: (() -> Void)?,
backspaceKeyAction: (() -> Void)?,
selection: Selection?,
@@ -104,6 +106,7 @@ public final class ListComposePollOptionComponent: Component {
self.resetText = resetText
self.assumeIsEditing = assumeIsEditing
self.characterLimit = characterLimit
self.emptyLineHandling = emptyLineHandling
self.returnKeyAction = returnKeyAction
self.backspaceKeyAction = backspaceKeyAction
self.selection = selection
@@ -134,6 +137,9 @@ public final class ListComposePollOptionComponent: Component {
if lhs.characterLimit != rhs.characterLimit {
return false
}
if lhs.emptyLineHandling != rhs.emptyLineHandling {
return false
}
if lhs.selection != rhs.selection {
return false
}
@@ -325,7 +331,7 @@ public final class ListComposePollOptionComponent: Component {
},
isOneLineWhenUnfocused: false,
characterLimit: component.characterLimit,
emptyLineHandling: .notAllowed,
emptyLineHandling: component.emptyLineHandling,
formatMenuAvailability: .none,
returnKeyType: .next,
lockedFormatAction: {