Skip to content

Commit

Permalink
Button for switching to Runestone editor
Browse files Browse the repository at this point in the history
  • Loading branch information
bummoblizard committed Jun 7, 2024
1 parent 30736f9 commit 7b2c665
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CodeApp/Localization/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@
"file.upload" = "Hochladen";

"actions.new_window" = "Neues Fenster";
"actions.switch_to_monaco_editor" = "Zu Monaco-Editor wechseln";
"actions.switch_to_runestone_editor" = "Zu Runestone-Editor wechseln";

"remote.connecting" = "Verbindung zum Host herstellen";
"remote.connected" = "Erfolgreich verbunden";
Expand Down
2 changes: 2 additions & 0 deletions CodeApp/Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ are licensed under [BSD-3-Clause License](https://en.wikipedia.org/wiki/BSD_lice
"file.upload" = "Upload";

"actions.new_window" = "New Window";
"actions.switch_to_monaco_editor" = "Switch to Monaco Editor";
"actions.switch_to_runestone_editor" = "Switch to Runestone Editor";

"remote.connecting" = "Connecting to Host";
"remote.connected" = "Connected successfully";
Expand Down
2 changes: 2 additions & 0 deletions CodeApp/Localization/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@
"file.upload" = "アップロード";

"actions.new_window" = "新しいウィンドウ";
"actions.switch_to_monaco_editor" = "Monaco エディターに切り替える";
"actions.switch_to_runestone_editor" = "Runestone エディターに切り替える";

"remote.connecting" = "ホストに接続中";
"remote.connected" = "正常に接続されました";
Expand Down
2 changes: 2 additions & 0 deletions CodeApp/Localization/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@
"file.upload" = "업로드";

"actions.new_window" = "새창";
"actions.switch_to_monaco_editor" = "Monaco 편집기로 전환";
"actions.switch_to_runestone_editor" = "Runestone 편집기로 전환";

"remote.connecting" = "호스트에 연결";
"remote.connected" = "성공적으로 연결됨";
Expand Down
2 changes: 2 additions & 0 deletions CodeApp/Localization/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@
"file.upload" = "上传";

"actions.new_window" = "新窗口";
"actions.switch_to_monaco_editor" = "切换到 Monaco 编辑器";
"actions.switch_to_runestone_editor" = "切换到 Runestone 编辑器";

"remote.connecting" = "正在连接到主机";
"remote.connected" = "连接成功";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@ extension RunestoneImplementation: EditorImplementation {
}

func setModel(url: String) async {
if let state = states[url] {
await setState(state: state)
await MainActor.run {
if let state = states[url] {
setState(state: state)
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions CodeApp/Views/TopBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TopBar: View {

@SceneStorage("sidebar.visible") var isSideBarExpanded: Bool = DefaultUIState.SIDEBAR_VISIBLE
@SceneStorage("panel.visible") var isPanelVisible: Bool = DefaultUIState.PANEL_IS_VISIBLE
@AppStorage("runeStoneEditorEnabled") var runeStoneEditorEnabled: Bool = false

@Environment(\.horizontalSizeClass) var horizontalSizeClass
let openConsolePanel: () -> Void
Expand Down Expand Up @@ -110,6 +111,17 @@ struct TopBar: View {
}
}
Divider()
Section {
Button(action: {
runeStoneEditorEnabled.toggle()
App.setUpEditorInstance()
}) {
Label(
runeStoneEditorEnabled
? "actions.switch_to_monaco_editor" : "actions.switch_to_runestone_editor",
systemImage: "arrow.left.arrow.right")
}
}
Section {
Button(action: {
App.showWelcomeMessage()
Expand Down

0 comments on commit 7b2c665

Please sign in to comment.