Open linked files in Quick Look from the reader !440

merged merged by cmc on 2026-11-22 02:10 UTC · krz/orgstar:reader-open-files into main

2 files changed, +6 −2

Layout: unified · split

Sources/OrgstarMobile/ReaderScreen.swift +5 −1
@@ -4,6 +4,7 @@ import OrgCore
4import OrgDocument 4import OrgDocument
5import OrgIndex 5import OrgIndex
6import OrgPresentation 6import OrgPresentation
7import QuickLook
7import SwiftUI 8import SwiftUI
8import UIKit 9import UIKit
9 10
@@ -36,6 +37,8 @@ struct ReaderScreen: View {
36 @State private var startup: StartupDisplay? 37 @State private var startup: StartupDisplay?
37 @State private var showingOutline = false 38 @State private var showingOutline = false
38 @State private var message: String? 39 @State private var message: String?
40 /// A file a link opened, shown in Quick Look.
41 @State private var previewed: URL?
39 /// The pane the reader shows its file in, closed with the reader. 42 /// The pane the reader shows its file in, closed with the reader.
40 @State private var holder = PaneHolder() 43 @State private var holder = PaneHolder()
41 @Environment(\.openURL) private var openURL 44 @Environment(\.openURL) private var openURL
@@ -109,6 +112,7 @@ struct ReaderScreen: View {
109 } 112 }
110 } 113 }
111 } 114 }
115 .quickLookPreview($previewed)
112 .sheet(isPresented: $showingOutline) { outlineSheet } 116 .sheet(isPresented: $showingOutline) { outlineSheet }
113 .safeAreaInset(edge: .bottom) { 117 .safeAreaInset(edge: .bottom) {
114 if let message { 118 if let message {
@@ -381,7 +385,7 @@ struct ReaderScreen: View {
381 session.open(path, in: pane) 385 session.open(path, in: pane)
382 model.openRequest = .offset(target, caret) 386 model.openRequest = .offset(target, caret)
383 } 387 }
384 case .openExternally(let target): openURL(target) 388 case .openExternally(let target): if target.isFileURL { previewed = target } else { openURL(target) }
385 case .message(let text): message = text 389 case .message(let text): message = text
386 case .choose(let question, let paths): message = question + paths.map { ($0 as NSString).lastPathComponent }.joined(separator: ", ") 390 case .choose(let question, let paths): message = question + paths.map { ($0 as NSString).lastPathComponent }.joined(separator: ", ")
387 case .elisp: message = "Open the file in the editor to run elisp links." 391 case .elisp: message = "Open the file in the editor to run elisp links."
docs/manual/guide/14-ios.org +1 −1
@@ -39,7 +39,7 @@ Tap a file in Folders or Search, or Open in File in an agenda entry's sheet, to
39- The file opens with the visibility its =#+STARTUP= line asks for, then each heading's =VISIBILITY= property when =#+STARTUP= sets a visibility. Drawers and blocks are folded as =org-cycle-hide-drawer-startup= and =org-cycle-hide-block-startup= say, or as the file's =#+STARTUP= says (=hidedrawers=, =nohideblocks= and the like). Tap a folded drawer's first line or its =…= to open it, and the first line again to fold it. 39- The file opens with the visibility its =#+STARTUP= line asks for, then each heading's =VISIBILITY= property when =#+STARTUP= sets a visibility. Drawers and blocks are folded as =org-cycle-hide-drawer-startup= and =org-cycle-hide-block-startup= say, or as the file's =#+STARTUP= says (=hidedrawers=, =nohideblocks= and the like). Tap a folded drawer's first line or its =…= to open it, and the first line again to fold it.
40- Text is styled as in the editor, in the theme's colours, font, size, line spacing and heading sizes, on the theme's background: TODO keywords, priorities, tags, emphasis, code, timestamps, links, and the code in src blocks. Text can be selected and copied. 40- Text is styled as in the editor, in the theme's colours, font, size, line spacing and heading sizes, on the theme's background: TODO keywords, priorities, tags, emphasis, code, timestamps, links, and the code in src blocks. Text can be selected and copied.
41- The reader follows the editor's display settings (see Themes and display below): Show Markup, hidden emphasis markers, pretty entities, indentation, leading stars, inline images and truncated lines. Tables show at full width, without narrowed columns. 41- The reader follows the editor's display settings (see Themes and display below): Show Markup, hidden emphasis markers, pretty entities, indentation, leading stars, inline images and truncated lines. Tables show at full width, without narrowed columns.
42- Tap a link to follow it. Links to headings and files in your folders open in the reader; web links open in the browser. 42- Tap a link to follow it. Links to headings and files in your folders open in the reader; links to other files, such as an attached PDF or image, open in Quick Look; web links open in the browser.
43- The toolbar has Outline (a list of headings to jump to), Export, and Edit. 43- The toolbar has Outline (a list of headings to jump to), Export, and Edit.
44 44
45* The editor 45* The editor