                 if let result = result {
                     let textAttributes: [String: AnyObject] = [
                         NSForegroundColorAttributeName: self.mentionForegroundColor,
+                        ChatTextStorage.detectionTypeName: DetectionType.Mention.rawValue,
                     ]
 
                     self.addAttributes(textAttributes, range: result.range )


    @objc private func linkTapped(sender: UITapGestureRecognizer) {
        println("linkTapped")
    }

    // MARK: 点击链接 hack


class ChatTextStorage: NSTextStorage {

    static let detectionTypeName = "ChatTextStorage.detectionTypeName"

    enum DetectionType: String {
        case Mention
    }

    private var backingStore: NSMutableAttributedString = NSMutableAttributedString()

    var mentionRanges = [NSRange]()
    var mentionForegroundColor: UIColor = UIColor.redColor()


    override var string: String {
        return backingStore.string
