feat: improve note formatting shortcuts and code styling

This commit is contained in:
2026-10-22 09:35:51 +02:00
parent 5065ba59bd
commit 665691ddee
5 changed files with 87 additions and 22 deletions
+4
View File
@@ -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
}