Ind.ie is now Small Technology Foundation.
Commit 40d61bc3 authored by Aral Balkan's avatar Aral Balkan

Links in messages that you’re composing no longer crash Heartbeat. Fixes #106....

Links in messages that you’re composing no longer crash Heartbeat. Fixes #106. Also turned on spelling correction, etc. on the compose field.
parent a70c5152
......@@ -2330,7 +2330,7 @@ DQ
<rect key="frame" x="1" y="1" width="223" height="133"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView continuousSpellChecking="YES" allowsUndo="YES" allowsImageEditing="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" linkDetection="YES" dashSubstitution="YES" smartInsertDelete="YES" id="vxW-jJ-Z6f" customClass="IndieGrowingTextView" customModule="Heartbeat" customModuleProvider="target">
<textView continuousSpellChecking="YES" allowsUndo="YES" allowsImageEditing="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" linkDetection="YES" dashSubstitution="YES" textReplacement="YES" spellingCorrection="YES" grammarChecking="YES" smartInsertDelete="YES" id="vxW-jJ-Z6f" customClass="IndieGrowingTextView" customModule="Heartbeat" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="223" height="133"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......
......@@ -76,6 +76,7 @@ class MessageEditorViewController: NSViewController, NSTextViewDelegate, NSTextS
{
/* as */ notification in
var x:AnyObject? = (notification.userInfo as Dictionary!)["height"]
var contentHeight:CGFloat = x as! CGFloat
......@@ -196,32 +197,33 @@ class MessageEditorViewController: NSViewController, NSTextViewDelegate, NSTextS
// return ["These", "Are", "Completions"]
// }
func textView(textView: NSTextView, shouldChangeTextInRange affectedCharRange: NSRange, replacementString: String) -> Bool {
func textView(textView: NSTextView!, shouldChangeTextInRange affectedCharRange: NSRange, replacementString: String!) -> Bool {
// println("Message text view should change text in range: \(affectedCharRange) to: >\(replacementString)<")
// println(">\(textView.string)<")
return true
}
// MARK: - NSTextStorageDelegate methods
func textStorageWillProcessEditing(notification: NSNotification) {
// println("TEXT STORAGE:\n \(notification.name)")
let textStorage = notification.object as? NSTextStorage
// println("Edited range: \(textStorage?.editedRange)")
// println("Edited mask: \(textStorage?.editedMask)")
let attributedString:NSAttributedString = textStorage!.attributedSubstringFromRange(textStorage!.editedRange)
// println("Length: \(attributedString.length)")
attributedString.enumerateAttribute("NSAttachment", inRange: NSMakeRange(0, attributedString.length), options: NSAttributedStringEnumerationOptions.allZeros) { (x:AnyObject!, y:NSRange, z:UnsafeMutablePointer<ObjCBool>) -> Void in
// println(">>> \(x)")
// let image = x as NSTextAttachment
// println("\(image.debugDescription)")
}
}
// func textStorageWillProcessEditing(notification: NSNotification) {
// println("TEXT STORAGE:\n \(notification.object)")
//
// let textStorage = notification.object as? NSTextStorage
//
// println("Edited range: \(textStorage?.editedRange)")
// println("Edited mask: \(textStorage?.editedMask)")
// let attributedString:NSAttributedString = textStorage!.attributedSubstringFromRange(textStorage!.editedRange)
// // println("Length: \(attributedString.length)")
// attributedString.enumerateAttribute("NSAttachment", inRange: NSMakeRange(0, attributedString.length), options: NSAttributedStringEnumerationOptions.allZeros) { (x:AnyObject!, y:NSRange, z:UnsafeMutablePointer<ObjCBool>) -> Void in
//
//// println(">>> \(x)")
//// let image = x as NSTextAttachment
//// println("\(image.debugDescription)")
//
// }
//
//
// }
// MARK: - Actions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment