mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Spoiler fixes
This commit is contained in:
parent
8a5d0ded9f
commit
d5fbab8e56
@ -58,8 +58,6 @@ public class InvisibleInkDustNode: ASDisplayNode {
|
|||||||
private let emitterSpotNode: ASImageNode
|
private let emitterSpotNode: ASImageNode
|
||||||
private let emitterMaskFillNode: ASDisplayNode
|
private let emitterMaskFillNode: ASDisplayNode
|
||||||
|
|
||||||
public var isRevealedUpdated: (Bool) -> Void = { _ in }
|
|
||||||
|
|
||||||
public var isRevealed = false
|
public var isRevealed = false
|
||||||
|
|
||||||
public init(textNode: TextNode?) {
|
public init(textNode: TextNode?) {
|
||||||
@ -232,7 +230,7 @@ public class InvisibleInkDustNode: ASDisplayNode {
|
|||||||
square += Float(rect.width * rect.height)
|
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]) {
|
public func update(size: CGSize, color: UIColor, rects: [CGRect], wordRects: [CGRect]) {
|
||||||
|
@ -2260,10 +2260,36 @@ 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(_:)) {
|
} 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 {
|
if case .format = self.inputMenu.state {
|
||||||
|
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)
|
return ASEditableTextNodeTargetForAction(target: self)
|
||||||
} else {
|
} else {
|
||||||
return ASEditableTextNodeTargetForAction(target: nil)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if case .format = self.inputMenu.state {
|
if case .format = self.inputMenu.state {
|
||||||
return ASEditableTextNodeTargetForAction(target: nil)
|
return ASEditableTextNodeTargetForAction(target: nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user