Skip to content

Commit

Permalink
Use CodeEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Sep 9, 2023
1 parent 1d61504 commit 10e6a49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/apps/SettingsWindow/project-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ packages:
Sparkle:
url: https://github.com/sparkle-project/Sparkle
from: 2.4.2
CodeEditor:
url: https://github.com/ZeeZide/CodeEditor
from: 1.2.2

targets:
Karabiner-Elements:
Expand Down Expand Up @@ -46,3 +49,4 @@ targets:
- '*.icns'
dependencies:
- sdk: libc++.tbd
- package: CodeEditor
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import CodeEditor
import SwiftUI

struct ComplexModificationsEditView: View {
Expand All @@ -8,6 +9,7 @@ struct ComplexModificationsEditView: View {
@State private var jsonString = ""
@State private var errorMessage: String?
@ObservedObject private var settings = LibKrbn.Settings.shared
@Environment(\.colorScheme) var colorScheme

var body: some View {
VStack(alignment: .leading, spacing: 12.0) {
Expand Down Expand Up @@ -60,7 +62,10 @@ struct ComplexModificationsEditView: View {
.background(Color.errorBackground)
}

TextEditor(text: $jsonString)
CodeEditor(
source: $jsonString, language: .json,
theme: CodeEditor.ThemeName(
rawValue: colorScheme == .dark ? "qtcreator_dark" : "qtcreator_light"))
}

Spacer()
Expand Down

0 comments on commit 10e6a49

Please sign in to comment.