Skip to content

Commit

Permalink
Update Markdown View.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf committed Jan 4, 2024
1 parent f6f27df commit 18e88b8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Mlem/Views/Shared/Markdown View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ struct MarkdownBlock: Identifiable {
}

struct MarkdownView: View {
@State private var text: String
@State private var blocks: [MarkdownBlock]
private let text: String
private let blocks: [MarkdownBlock]

private let isNsfw: Bool
private let replaceImagesWithEmoji: Bool
Expand All @@ -235,13 +235,12 @@ struct MarkdownView: View {
isInline: Bool = false,
alignment: TextAlignment = .leading
) {
let text: String = isInline ? MarkdownView.prepareInlineMarkdown(text: text) : text
_text = .init(wrappedValue: text)
self.text = isInline ? MarkdownView.prepareInlineMarkdown(text: text) : text
self.isNsfw = isNsfw
self.replaceImagesWithEmoji = replaceImagesWithEmoji
self.isInline = isInline
self.alignment = alignment
_blocks = .init(wrappedValue: MarkdownView.parseMarkdownForImages(text: text))
self.blocks = MarkdownView.parseMarkdownForImages(text: text)
}

var body: some View {
Expand Down

0 comments on commit 18e88b8

Please sign in to comment.