diff --git a/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift b/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift index db2f20a0b6..655e9651b1 100644 --- a/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift +++ b/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift @@ -57,9 +57,7 @@ public class InvisibleInkDustNode: ASDisplayNode { private let emitterMaskNode: ASDisplayNode private let emitterSpotNode: ASImageNode private let emitterMaskFillNode: ASDisplayNode - - public var isRevealedUpdated: (Bool) -> Void = { _ in } - + public var isRevealed = false public init(textNode: TextNode?) { @@ -232,7 +230,7 @@ public class InvisibleInkDustNode: ASDisplayNode { square += Float(rect.width * rect.height) } - self.emitter?.birthRate = square * 0.4 + self.emitter?.birthRate = min(100000, square * 0.33) } public func update(size: CGSize, color: UIColor, rects: [CGRect], wordRects: [CGRect]) { diff --git a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift index d6900ef29b..2c629d71cd 100644 --- a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift @@ -2260,7 +2260,33 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { } } else if action == #selector(self.formatAttributesBold(_:)) || action == #selector(self.formatAttributesItalic(_:)) || action == #selector(self.formatAttributesMonospace(_:)) || action == #selector(self.formatAttributesLink(_:)) || action == #selector(self.formatAttributesStrikethrough(_:)) || action == #selector(self.formatAttributesUnderline(_:)) || action == #selector(self.formatAttributesSpoiler(_:)) { if case .format = self.inputMenu.state { - return ASEditableTextNodeTargetForAction(target: self) + if action == #selector(self.formatAttributesSpoiler(_:)), let selectedRange = self.textInputNode?.selectedRange { + var intersectsMonospace = false + self.inputTextState.inputText.enumerateAttributes(in: selectedRange, options: [], using: { attributes, _, _ in + if let _ = attributes[ChatTextInputAttributes.monospace] { + intersectsMonospace = true + } + }) + if !intersectsMonospace { + return ASEditableTextNodeTargetForAction(target: self) + } else { + return ASEditableTextNodeTargetForAction(target: nil) + } + } else if action == #selector(self.formatAttributesMonospace(_:)), let selectedRange = self.textInputNode?.selectedRange { + var intersectsSpoiler = false + self.inputTextState.inputText.enumerateAttributes(in: selectedRange, options: [], using: { attributes, _, _ in + if let _ = attributes[ChatTextInputAttributes.spoiler] { + intersectsSpoiler = true + } + }) + if !intersectsSpoiler { + return ASEditableTextNodeTargetForAction(target: self) + } else { + return ASEditableTextNodeTargetForAction(target: nil) + } + } else { + return ASEditableTextNodeTargetForAction(target: self) + } } else { return ASEditableTextNodeTargetForAction(target: nil) }