Make rich messages editable via InstantPage↔markdown round-trip

Reconstruct markdown source from a stored InstantPage to populate the edit
field, then re-classify on save (the inverse of the send path). Adds the
InstantPageToMarkdown converter, edit-field population and save-time
re-classification in ChatControllerLoadDisplayNode, and a shared InstantPage
previewText surfaced through MessageContentKind for reply/pinned/forward
previews. Documented in CLAUDE.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
isaac 2026-05-26 23:10:48 +02:00
parent e1b48665a8
commit a9f8b0d067
6 changed files with 483 additions and 181 deletions

View file

@ -309,6 +309,11 @@ public func messageContentKind(contentSettings: ContentSettings, message: Engine
return kind
}
}
for attribute in message.attributes {
if let attribute = attribute as? RichTextMessageAttribute {
return .text(NSAttributedString(string: attribute.instantPage.previewText()))
}
}
return .text(messageTextWithAttributes(message: message))
}