prevent slack cache from overwriting text (#1129)

This commit is contained in:
Ryan Nystrom
2017-12-02 16:14:14 -05:00
committed by GitHub
parent b04ffc1ac7
commit 73f07de338
2 changed files with 4 additions and 3 deletions

View File

@@ -74,7 +74,7 @@ final class TextActionsController: NSObject,
// MARK: ImageUploadDelegate
func imageUploaded(link: String, altText: String) {
textView?.replace(left: "![\(altText)](\(link))", right: nil, atLineStart: true)
textView?.replace(left: "![\(altText)](\(link))", right: nil, atLineStart: false)
}
}

View File

@@ -1904,8 +1904,9 @@ CGFloat const SLKAutoCompletionViewDefaultHeight = 140.0;
cachedAttributedText = [NSKeyedUnarchiver unarchiveObjectWithData:obj];
}
}
if (self.textView.attributedText.length == 0 || cachedAttributedText.length > 0) {
// only update the text if it is empty on the first load
if (self.textView.attributedText.length == 0 && cachedAttributedText.length > 0) {
self.textView.attributedText = cachedAttributedText;
}
}