-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement blockquotes with paragraph style #168
Implement blockquotes with paragraph style #168
Conversation
…h_style # Conflicts: # Aztec/Classes/TextKit/ParagraphStyle.swift
|
||
override init() { | ||
textList = nil | ||
blockquote = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionals are nil by default. You don't really need these two lines
super.init() | ||
} | ||
|
||
public required init?(coder aDecoder: NSCoder) { | ||
textList = nil | ||
blockquote = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
/// - Parameters: | ||
/// - text: the text being added | ||
/// - range: the range of the insertion of the new text | ||
private func refreshListAfterDeletionOf(text deletedText: NSAttributedString, atRange range:NSRange) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing //
between the last doc's line and the method signature
/// | ||
/// - Parameters: | ||
/// - text: the text being added | ||
/// - range: the range of the insertion of the new text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
/// - Parameters: | ||
/// - text: the text being added | ||
/// - range: the range of the insertion of the new text | ||
private func refreshBlockquoteAfterInsertionOf(text:String, range:NSRange) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaand same as above!
if aDecoder.containsValue(forKey: String(describing: TextList.self)) { | ||
let styleRaw = aDecoder.decodeInteger(forKey: String(describing: TextList.self)) | ||
if let style = TextList.Style(rawValue:styleRaw) { | ||
textList = TextList(style: style) | ||
} | ||
} | ||
if aDecoder.containsValue(forKey: String(describing:Blockquote.self)) { | ||
blockquote = aDecoder.decodeObject(forKey: String(describing:Blockquote.self)) as? Blockquote | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between describing:
and the class kind
@@ -26,11 +32,16 @@ open class ParagraphStyle: NSMutableParagraphStyle { | |||
if let textListSet = textList { | |||
aCoder.encode(textListSet.style.rawValue, forKey: String(describing: TextList.self)) | |||
} | |||
|
|||
if let blockquote = self.blockquote { | |||
aCoder.encode(blockquote, forKey: String(describing:Blockquote.self)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
||
let isBegginingOfListItem = storage.isStartOfNewLine(atLocation: range.location) | ||
|
||
if text == "\n" && beforeString == "\n" && afterString == "\n" && isBegginingOfListItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this could be refactored (anyhow) using CharacterSet.newlines
?
@SergioEstevao added a couple comments (100% of them are style / cosmetic ones, and please, by all means, feel free to disregard). This PR works beautifully, nice job sir!! |
Fix #76 #145
This PR implements blockquotes using a custom paragraph style
How to test:
Notes: