feat: improve note formatting shortcuts and code styling
This commit is contained in:
@@ -74,6 +74,7 @@ final class NotesTextView: NSTextView, @MainActor NSLayoutManagerDelegate {
|
||||
private static func serialize(_ contents: NSAttributedString, keepingMetadata: Bool = false) -> NSAttributedString {
|
||||
let result = NSMutableAttributedString(attributedString: contents)
|
||||
restoreListLayout(in: result)
|
||||
MarkdownHighlighting.removeCodeBackground(from: result)
|
||||
result.removeAttribute(MarkdownHighlighting.hiddenMarkup, range: NSRange(location: 0, length: result.length))
|
||||
var replacements: [(NSRange, ListAttachment)] = []
|
||||
contents.enumerateAttribute(.attachment, in: NSRange(location: 0, length: contents.length)) { value, range, _ in
|
||||
@@ -210,6 +211,9 @@ final class NotesTextView: NSTextView, @MainActor NSLayoutManagerDelegate {
|
||||
}
|
||||
attributes.removeValue(forKey: listWhitespace)
|
||||
attributes.removeValue(forKey: MarkdownHighlighting.hiddenMarkup)
|
||||
if attributes.removeValue(forKey: MarkdownHighlighting.codeBackground) as? Bool == true {
|
||||
attributes.removeValue(forKey: .backgroundColor)
|
||||
}
|
||||
return attributes
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user