Improve JSON editor for iOS

This commit is contained in:
世界
2025-11-26 22:25:52 +08:00
parent 264c37218c
commit 3f1c716a0a
18 changed files with 3129 additions and 17 deletions
@@ -29,26 +29,30 @@
}
}
} else {
viewBuilder {
if readOnly {
TextEditor(text: .constant(viewModel.profileContent))
} else {
TextEditor(text: $viewModel.profileContent)
}
}
.font(Font.system(.caption2, design: .monospaced))
.autocorrectionDisabled(true)
.textContentType(.init(rawValue: ""))
#if os(iOS)
.keyboardType(.asciiCapable)
.textInputAutocapitalization(.none)
.background(Color(UIColor.secondarySystemGroupedBackground))
#elseif os(macOS)
.padding()
#endif
RunestoneTextView(
text: readOnly ? .constant(viewModel.profileContent) : $viewModel.profileContent,
isEditable: !readOnly
)
.onChangeCompat(of: viewModel.profileContent) {
viewModel.markAsChanged()
}
#elseif os(macOS)
viewBuilder {
if readOnly {
TextEditor(text: .constant(viewModel.profileContent))
} else {
TextEditor(text: $viewModel.profileContent)
}
}
.font(Font.system(.caption2, design: .monospaced))
.autocorrectionDisabled(true)
.textContentType(.init(rawValue: ""))
.padding()
.onChangeCompat(of: viewModel.profileContent) {
viewModel.markAsChanged()
}
#endif
}
}
.alertBinding($viewModel.alert)