Commit 3191c129ca
Verified · cmc
Changed files (5)
Sources/OrgstarMobile/EditorScreen.swift +16 −9 · view
| @@ -23,8 +23,8 @@ struct EditorScreen: View { | |||
| 23 | var isFocused = true | 23 | var isFocused = true |
| 24 | /// Focus came to this screen's pane. | 24 | /// Focus came to this screen's pane. |
| 25 | var onFocus: () -> Void = {} | 25 | var onFocus: () -> Void = {} |
| 26 | /// The pane commands (`app.split-right` …), which the split runs. | 26 | /// The pane commands (`app.split-right` …), which the split runs; returns why one did nothing. |
| 27 | var onPaneCommand: ((String) -> Void)? = nil | 27 | var onPaneCommand: ((String) -> String?)? = nil |
| 28 | @State private var editor: MobileEditor? | 28 | @State private var editor: MobileEditor? |
| 29 | /// This screen's view of the editor. | 29 | /// This screen's view of the editor. |
| 30 | @State private var textView: UITextView? | 30 | @State private var textView: UITextView? |
| @@ -133,7 +133,14 @@ struct EditorScreen: View { | |||
| 133 | if pane?.conflict != nil { | 133 | if pane?.conflict != nil { |
| 134 | Button("Conflict", systemImage: "exclamationmark.triangle") { sheet = .conflict } | 134 | Button("Conflict", systemImage: "exclamationmark.triangle") { sheet = .conflict } |
| 135 | } | 135 | } |
| 136 | Button("Undo", systemImage: "arrow.uturn.backward") { editor?.run("edit.undo") } | 136 | // Redo on a long press, as the system's back buttons offer history. |
| 137 | Menu { | ||
| 138 | Button("Redo", systemImage: "arrow.uturn.forward") { editor?.run("edit.redo") } | ||
| 139 | } label: { | ||
| 140 | Label("Undo", systemImage: "arrow.uturn.backward") | ||
| 141 | } primaryAction: { | ||
| 142 | editor?.run("edit.undo") | ||
| 143 | } | ||
| 137 | Menu("More", systemImage: "ellipsis.circle") { | 144 | Menu("More", systemImage: "ellipsis.circle") { |
| 138 | Button("Commands", systemImage: "command") { sheet = .palette } | 145 | Button("Commands", systemImage: "command") { sheet = .palette } |
| 139 | Button("Word Count", systemImage: "textformat.123") { message = wordCount() } | 146 | Button("Word Count", systemImage: "textformat.123") { message = wordCount() } |
| @@ -196,12 +203,12 @@ struct EditorScreen: View { | |||
| 196 | Button("Recovered Versions", systemImage: "clock.arrow.circlepath") { sheet = .recovery } | 203 | Button("Recovered Versions", systemImage: "clock.arrow.circlepath") { sheet = .recovery } |
| 197 | if onPaneCommand != nil, sizeClass == .regular { | 204 | if onPaneCommand != nil, sizeClass == .regular { |
| 198 | Menu("Panes", systemImage: "rectangle.split.2x1") { | 205 | Menu("Panes", systemImage: "rectangle.split.2x1") { |
| 199 | Button("Split Pane Right", systemImage: "rectangle.split.2x1") { onPaneCommand?("app.split-right") } | 206 | Button("Split Pane Right", systemImage: "rectangle.split.2x1") { _ = onPaneCommand?("app.split-right") } |
| 200 | Button("Split Pane Below", systemImage: "rectangle.split.1x2") { onPaneCommand?("app.split-below") } | 207 | Button("Split Pane Below", systemImage: "rectangle.split.1x2") { _ = onPaneCommand?("app.split-below") } |
| 201 | if inSplit { | 208 | if inSplit { |
| 202 | Button("Next Pane", systemImage: "arrow.right.square") { onPaneCommand?("app.pane-next") } | 209 | Button("Next Pane", systemImage: "arrow.right.square") { _ = onPaneCommand?("app.pane-next") } |
| 203 | Button("Close Pane", systemImage: "xmark.square") { onPaneCommand?("app.pane-close") } | 210 | Button("Close Pane", systemImage: "xmark.square") { _ = onPaneCommand?("app.pane-close") } |
| 204 | Button("Close Other Panes", systemImage: "square") { onPaneCommand?("app.pane-only") } | 211 | Button("Close Other Panes", systemImage: "square") { _ = onPaneCommand?("app.pane-only") } |
| 205 | } | 212 | } |
| 206 | } | 213 | } |
| 207 | } | 214 | } |
| @@ -471,7 +478,7 @@ struct EditorScreen: View { | |||
| 471 | editor.onAppCommand = { id in | 478 | editor.onAppCommand = { id in |
| 472 | if let feature = ProFeature.required(byCommand: id), !ProAccess.shared.allows(feature) { return } | 479 | if let feature = ProFeature.required(byCommand: id), !ProAccess.shared.allows(feature) { return } |
| 473 | if Self.paneCommands.contains(id) { | 480 | if Self.paneCommands.contains(id) { |
| 474 | if let onPaneCommand { onPaneCommand(id) } else { message = MobileEditor.unavailable(command: id) } | 481 | if let onPaneCommand { if let text = onPaneCommand(id) { message = text } } else { message = MobileEditor.unavailable(command: id) } |
| 475 | } else if id == "app.save" { | 482 | } else if id == "app.save" { |
| 476 | _ = session.save(path) | 483 | _ = session.save(path) |
| 477 | } else if id == "app.archive" { | 484 | } else if id == "app.archive" { |
Sources/OrgstarMobile/EditorSplitScreen.swift +3 −3 · view
| @@ -37,7 +37,7 @@ final class EditorSplit { | |||
| 37 | 37 | ||
| 38 | var isSplit: Bool { layout.panes.count > 1 } | 38 | var isSplit: Bool { layout.panes.count > 1 } |
| 39 | 39 | ||
| 40 | /// Runs a pane command; false when it does nothing here. | 40 | /// Runs a pane command; returns why it did nothing, or nil. |
| 41 | func run(_ id: String, session: DocumentSession, store: MobileEditorStore) -> String? { | 41 | func run(_ id: String, session: DocumentSession, store: MobileEditorStore) -> String? { |
| 42 | switch id { | 42 | switch id { |
| 43 | case "app.split-right", "app.split-below": | 43 | case "app.split-right", "app.split-below": |
| @@ -49,7 +49,7 @@ final class EditorSplit { | |||
| 49 | case "app.pane-next": | 49 | case "app.pane-next": |
| 50 | focused = layout.next(after: focused) | 50 | focused = layout.next(after: focused) |
| 51 | case "app.pane-close": | 51 | case "app.pane-close": |
| 52 | guard isSplit else { return "Attempt to delete the only pane" } | 52 | guard isSplit else { return String(localized: "This is the only pane.", comment: "Close Pane with one pane") } |
| 53 | close(focused, session: session, store: store) | 53 | close(focused, session: session, store: store) |
| 54 | case "app.pane-only": | 54 | case "app.pane-only": |
| 55 | for id in layout.panes where id != focused { close(id, session: session, store: store) } | 55 | for id in layout.panes where id != focused { close(id, session: session, store: store) } |
| @@ -105,7 +105,7 @@ struct EditorSplitScreen: View { | |||
| 105 | path: file, offset: id == split.layout.panes.first ? offset : nil, workspace: workspace, session: session, | 105 | path: file, offset: id == split.layout.panes.first ? offset : nil, workspace: workspace, session: session, |
| 106 | givenPane: pane, inSplit: split.isSplit, isFocused: split.focused == id, | 106 | givenPane: pane, inSplit: split.isSplit, isFocused: split.focused == id, |
| 107 | onFocus: { split.focused = id }, | 107 | onFocus: { split.focused = id }, |
| 108 | onPaneCommand: { command in _ = split.run(command, session: session, store: model.editors) } | 108 | onPaneCommand: { split.run($0, session: session, store: model.editors) } |
| 109 | ) | 109 | ) |
| 110 | .id(id) | 110 | .id(id) |
| 111 | .overlay(alignment: .top) { | 111 | .overlay(alignment: .top) { |
Sources/OrgstarMobile/ExportMenu.swift +6 −2 · view
| @@ -197,7 +197,7 @@ struct ExportMenu: View { | |||
| 197 | if let calendars = AgendaCalendars(model: model) { | 197 | if let calendars = AgendaCalendars(model: model) { |
| 198 | Divider() | 198 | Divider() |
| 199 | if OrgExport.Format.icalendar.locked { | 199 | if OrgExport.Format.icalendar.locked { |
| 200 | Button("Agenda Files to iCalendar (orgstar+)") { ProAccess.shared.allows(.export) } | 200 | Button("\(String(localized: "Export Agenda Files to iCalendar")) (orgstar+)", systemImage: "calendar") { ProAccess.shared.allows(.export) } |
| 201 | } else { | 201 | } else { |
| 202 | Button("Export Agenda Files to iCalendar", systemImage: "calendar") { report(calendars.exportEach()) } | 202 | Button("Export Agenda Files to iCalendar", systemImage: "calendar") { report(calendars.exportEach()) } |
| 203 | ShareLink(item: calendars, preview: SharePreview(calendars.fileName)) { | 203 | ShareLink(item: calendars, preview: SharePreview(calendars.fileName)) { |
| @@ -206,7 +206,11 @@ struct ExportMenu: View { | |||
| 206 | } | 206 | } |
| 207 | } | 207 | } |
| 208 | Divider() | 208 | Divider() |
| 209 | Button("Copy as Rich Text", systemImage: "doc.on.doc") { if ProAccess.shared.allows(.export) { report(Self.copy(path: path, text: text, theme: model.theme)) } } | 209 | if ProAccess.shared.isUnlocked { |
| 210 | Button("Copy as Rich Text", systemImage: "doc.on.doc") { report(Self.copy(path: path, text: text, theme: model.theme)) } | ||
| 211 | } else { | ||
| 212 | Button("\(String(localized: "Copy as Rich Text")) (orgstar+)", systemImage: "doc.on.doc") { ProAccess.shared.allows(.export) } | ||
| 213 | } | ||
| 210 | } | 214 | } |
| 211 | } | 215 | } |
| 212 | 216 | ||
docs/manual/guide/14-ios.org +3 −3 · view
| @@ -51,7 +51,7 @@ The editor folds headings, drawers and blocks (tap a fold's =…= to open it, an | |||
| 51 | The toolbar has: | 51 | The toolbar has: |
| 52 | 52 | ||
| 53 | - Conflict :: shown while the file and your edits conflict; opens the conflict sheet. | 53 | - Conflict :: shown while the file and your edits conflict; opens the conflict sheet. |
| 54 | - Undo | 54 | - Undo :: touch and hold it for Redo. |
| 55 | - More :: Commands, Clock In, Show Markup, Recent Entries, Export, Sync Conflict Copies, and Recovered Versions. | 55 | - More :: Commands, Clock In, Show Markup, Recent Entries, Export, Sync Conflict Copies, and Recovered Versions. |
| 56 | 56 | ||
| 57 | Messages from commands show at the top of the editor, and at the bottom of the reader, for a few seconds; tap one to dismiss it. VoiceOver reads each message as it appears. | 57 | Messages from commands show at the top of the editor, and at the bottom of the reader, for a few seconds; tap one to dismiss it. VoiceOver reads each message as it appears. |
| @@ -70,7 +70,7 @@ On iPad, the editor can show a file in several panes, as a Mac window does (see | |||
| 70 | 70 | ||
| 71 | The focused pane has a line along its top and the toolbar acts on it; tap in a pane to focus it. Every pane shows the same buffer: text typed in one shows in the others at once, and folds, narrowing and styles are the buffer's. The caret and scroll position are each pane's own, and so is undo: Undo in a pane undoes what was typed or changed in that pane. A link to another file opens it on its own screen, leaving the panes as they are. | 71 | The focused pane has a line along its top and the toolbar acts on it; tap in a pane to focus it. Every pane shows the same buffer: text typed in one shows in the others at once, and folds, narrowing and styles are the buffer's. The caret and scroll position are each pane's own, and so is undo: Undo in a pane undoes what was typed or changed in that pane. A link to another file opens it on its own screen, leaving the panes as they are. |
| 72 | 72 | ||
| 73 | Each iPad window (scene), opened from the app switcher or by dragging the app from the Dock, has its own tabs, screens and panes over the same open files, so a file edited in one window shows the edit in the others. The pane commands aren't offered on iPhone or in a narrow window. | 73 | Each iPad window (scene), opened from the app switcher or by dragging the app from the Dock, has its own tabs, screens and panes over the same open files, so a file edited in one window shows the edit in the others. The pane commands aren't offered on iPhone or in a narrow window. Close Pane with one pane says "This is the only pane." |
| 74 | 74 | ||
| 75 | ** Saving | 75 | ** Saving |
| 76 | 76 | ||
| @@ -339,7 +339,7 @@ PDF export follows =pdf-margin=, =pdf-font= and =pdf-page-numbers= in =config.to | |||
| 339 | 339 | ||
| 340 | Body Only in the Export menu leaves out the title and the page around the text in HTML, Markdown, LaTeX and Plain Text (ASCII), and is kept for each file; the other formats say they have no body-only export while it is on. Export Subtree…, in the editor's Export menu, shares the subtree at the caret in any of the formats. | 340 | Body Only in the Export menu leaves out the title and the page around the text in HTML, Markdown, LaTeX and Plain Text (ASCII), and is kept for each file; the other formats say they have no body-only export while it is on. Export Subtree…, in the editor's Export menu, shares the subtree at the caret in any of the formats. |
| 341 | 341 | ||
| 342 | The Export menu also has Export Agenda Files to iCalendar, which writes an =.ics= beside each agenda file, and Combine Agenda Files into iCalendar, which shares one calendar of them all. Commands has these, Copy as Rich Text, and Export to HTML and Open, which shows the HTML export in Quick Look. | 342 | The Export menu also has Export Agenda Files to iCalendar, which writes an =.ics= beside each agenda file, and Combine Agenda Files into iCalendar, which shares one calendar of them all. Commands has these, Copy as Rich Text, and Export to HTML and Open, which shows the HTML export in Quick Look. Without orgstar+, the Export menu's items that need it end in "(orgstar+)" and open the orgstar+ screen. |
| 343 | 343 | ||
| 344 | Publishing works from Commands as on the Mac, with the =[[publish]]= projects in =config.toml=. A project that publishes outside your folders asks for a folder the first time, and uses it from then on. See [[file:12-export.org][Export]]. | 344 | Publishing works from Commands as on the Mac, with the =[[publish]]= projects in =config.toml=. A project that publishes outside your folders asks for a folder the first time, and uses it from then on. See [[file:12-export.org][Export]]. |
| 345 | 345 | ||
l10n/Localizable.xcstrings +35 −34 · view
| @@ -3180,40 +3180,6 @@ | |||
| 3180 | } | 3180 | } |
| 3181 | } | 3181 | } |
| 3182 | }, | 3182 | }, |
| 3183 | "Agenda Files to iCalendar (orgstar+)": { | ||
| 3184 | "localizations": { | ||
| 3185 | "de": { | ||
| 3186 | "stringUnit": { | ||
| 3187 | "state": "translated", | ||
| 3188 | "value": "Agenda-Dateien nach iCalendar (orgstar+)" | ||
| 3189 | } | ||
| 3190 | }, | ||
| 3191 | "es": { | ||
| 3192 | "stringUnit": { | ||
| 3193 | "state": "translated", | ||
| 3194 | "value": "Archivos de agenda a iCalendar (orgstar+)" | ||
| 3195 | } | ||
| 3196 | }, | ||
| 3197 | "fr": { | ||
| 3198 | "stringUnit": { | ||
| 3199 | "state": "translated", | ||
| 3200 | "value": "Fichiers d'agenda vers iCalendar (orgstar+)" | ||
| 3201 | } | ||
| 3202 | }, | ||
| 3203 | "ja": { | ||
| 3204 | "stringUnit": { | ||
| 3205 | "state": "translated", | ||
| 3206 | "value": "アジェンダファイルをiCalendarに書き出す(orgstar+)" | ||
| 3207 | } | ||
| 3208 | }, | ||
| 3209 | "pt-BR": { | ||
| 3210 | "stringUnit": { | ||
| 3211 | "state": "translated", | ||
| 3212 | "value": "Arquivos da Agenda para iCalendar (orgstar+)" | ||
| 3213 | } | ||
| 3214 | } | ||
| 3215 | } | ||
| 3216 | }, | ||
| 3217 | "Agenda clear": { | 3183 | "Agenda clear": { |
| 3218 | "localizations": { | 3184 | "localizations": { |
| 3219 | "de": { | 3185 | "de": { |
| @@ -36880,6 +36846,41 @@ | |||
| 36880 | } | 36846 | } |
| 36881 | } | 36847 | } |
| 36882 | }, | 36848 | }, |
| 36849 | "This is the only pane.": { | ||
| 36850 | "comment": "Close Pane with one pane", | ||
| 36851 | "localizations": { | ||
| 36852 | "de": { | ||
| 36853 | "stringUnit": { | ||
| 36854 | "state": "translated", | ||
| 36855 | "value": "Dies ist der einzige Bereich." | ||
| 36856 | } | ||
| 36857 | }, | ||
| 36858 | "es": { | ||
| 36859 | "stringUnit": { | ||
| 36860 | "state": "translated", | ||
| 36861 | "value": "Este es el único panel." | ||
| 36862 | } | ||
| 36863 | }, | ||
| 36864 | "fr": { | ||
| 36865 | "stringUnit": { | ||
| 36866 | "state": "translated", | ||
| 36867 | "value": "C'est le seul volet." | ||
| 36868 | } | ||
| 36869 | }, | ||
| 36870 | "ja": { | ||
| 36871 | "stringUnit": { | ||
| 36872 | "state": "translated", | ||
| 36873 | "value": "ペインはこれだけです。" | ||
| 36874 | } | ||
| 36875 | }, | ||
| 36876 | "pt-BR": { | ||
| 36877 | "stringUnit": { | ||
| 36878 | "state": "translated", | ||
| 36879 | "value": "Este é o único painel." | ||
| 36880 | } | ||
| 36881 | } | ||
| 36882 | } | ||
| 36883 | }, | ||
| 36883 | "This sqlite block can't run here: %@.": { | 36884 | "This sqlite block can't run here: %@.": { |
| 36884 | "comment": "An sqlite block refused before it ran", | 36885 | "comment": "An sqlite block refused before it ran", |
| 36885 | "localizations": { | 36886 | "localizations": { |