updates plak menu item
This commit is contained in:
@@ -103,6 +103,14 @@ extension WorkspaceModel {
|
||||
readAloud.read(text)
|
||||
case let .readAloudFile(path):
|
||||
readAloudFile(path)
|
||||
case let .readAloudTerminalSelection(kind):
|
||||
let text = terminal.selection(kind)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
let prose = MarkdownSpeech.plainText(MarkdownParser.parse(text))
|
||||
if !readAloud.read(prose.isEmpty ? text : prose) { toasts.show("Nothing to read") }
|
||||
case let .plak(text):
|
||||
sendToPlak(text)
|
||||
case let .plakTerminalSelection(kind):
|
||||
sendToPlak(terminal.selection(kind) ?? "")
|
||||
case let .newFile(directory):
|
||||
overlay.present(.namePrompt(NamePromptRequest(purpose: .newFile(inDirectory: directory), anchor: anchor)))
|
||||
case let .newFolder(directory):
|
||||
@@ -137,6 +145,11 @@ extension WorkspaceModel {
|
||||
}
|
||||
}
|
||||
|
||||
private func sendToPlak(_ text: String) {
|
||||
let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
if trimmed.isEmpty { toasts.show("Nothing to send") } else { app.system.sendToPlak(trimmed) }
|
||||
}
|
||||
|
||||
/// The open file is read from its buffer, unsaved edits included; any other file from disk.
|
||||
private func readAloudFile(_ path: String) {
|
||||
let live = editor.flatMap { $0.activePath == path && $0.isLoaded(path) ? $0.text(for: path) : nil }
|
||||
|
||||
Reference in New Issue
Block a user