diff options
| author | Dustin Mierau <dustin@mierau.me> | 2024-05-22 11:40:53 -0700 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2024-05-22 11:40:53 -0700 |
| commit | c7a2970c7f17a1b19a76d9cb6addda8fb877a63a (patch) | |
| tree | 20f52495dd9e599d7b3942ba8357c79bc394822d /Hotline/macOS/MessageBoardView.swift | |
| parent | 39255f49250e3b0ccbd42661614a7c8a3e0d4fb7 (diff) | |
Redesign of Message Board post sheet. Tweaks to NewsEditor. Disable smart quotes in message board and news editor text view. Hide news section on older servers.
Diffstat (limited to 'Hotline/macOS/MessageBoardView.swift')
| -rw-r--r-- | Hotline/macOS/MessageBoardView.swift | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/Hotline/macOS/MessageBoardView.swift b/Hotline/macOS/MessageBoardView.swift index 2bd3713..ba9968b 100644 --- a/Hotline/macOS/MessageBoardView.swift +++ b/Hotline/macOS/MessageBoardView.swift @@ -3,9 +3,8 @@ import SwiftUI struct MessageBoardView: View { @Environment(Hotline.self) private var model: Hotline - @State private var initialLoadComplete = false - @State private var composerDisplayed = false - @State private var composerText = "" + @State private var composerDisplayed: Bool = false + @State private var composerText: String = "" var body: some View { NavigationStack { @@ -54,31 +53,36 @@ struct MessageBoardView: View { } } .sheet(isPresented: $composerDisplayed) { - TextEditor(text: $composerText) - .padding() - .font(.system(size: 13)) - .lineSpacing(4) - .background(Color(nsColor: .textBackgroundColor)) + MessageBoardEditorView() + .frame(maxWidth: .infinity, maxHeight: .infinity) .frame(idealWidth: 450, idealHeight: 350) - .toolbar { - ToolbarItem(placement: .cancellationAction) { - Button("Cancel") { - composerDisplayed.toggle() - } - } - - ToolbarItem(placement: .primaryAction) { - Button("Post") { - composerDisplayed.toggle() - let text = composerText - composerText = "" - model.postToMessageBoard(text: text) - Task { - await model.getMessageBoard() - } - } - } - } +// RichTextEditor(text: $composerText) +// .richEditorFont(NSFont.systemFont(ofSize: 16.0)) +// .richEditorAutomaticDashSubstitution(false) +// .richEditorAutomaticQuoteSubstitution(false) +// .richEditorAutomaticSpellingCorrection(false) +// .background(Color(nsColor: .textBackgroundColor)) +// .frame(maxWidth: .infinity, maxHeight: .infinity) +// .frame(idealWidth: 450, idealHeight: 350) +// .toolbar { +// ToolbarItem(placement: .cancellationAction) { +// Button("Cancel") { +// composerDisplayed.toggle() +// } +// } +// +// ToolbarItem(placement: .primaryAction) { +// Button("Post") { +// composerDisplayed.toggle() +// let text = composerText +// composerText = "" +// model.postToMessageBoard(text: text) +// Task { +// await model.getMessageBoard() +// } +// } +// } +// } } .toolbar { ToolbarItem(placement:.primaryAction) { |