diff --git a/README.md b/README.md index b9e791e..a266b34 100644 --- a/README.md +++ b/README.md @@ -195,8 +195,9 @@ appears in every open shell. `↑/↓` or `j/k` navigate · `enter` open · `n` new post · `1-5` switch view (posts/media/templates/scripts/tags) · `r` refresh · in the editor: -`ctrl+s` save, `ctrl+p` publish, `ctrl+t` title, `ctrl+l` language, -`ctrl+g` AI suggestions (airplane-mode gated), `esc` back · `ctrl+q` quit. +`ctrl+s` save, `ctrl+p` publish, `ctrl+e` word-wrapped preview, +`ctrl+t` title, `ctrl+l` language, `ctrl+g` AI suggestions +(airplane-mode gated), `esc` back · `ctrl+q` quit. Images preview inline via the terminal image protocol. The UI language is the server-side setting shared by every client. diff --git a/lib/bds/tui.ex b/lib/bds/tui.ex index 88e3bf1..956c9a1 100644 --- a/lib/bds/tui.ex +++ b/lib/bds/tui.ex @@ -12,9 +12,10 @@ defmodule BDS.TUI do Sidebar focus: `↑/↓`/`j/k` navigate, `enter` open, `n` new post, `1..5` switch view (posts/media/templates/scripts/tags), `r` refresh. Editor focus: text keys edit, `ctrl+s` save, `ctrl+p` publish, - `ctrl+t` edit title, `ctrl+l` cycle language, `ctrl+g` AI suggestions, - `esc` back to sidebar. `ctrl+q` quits, `esc` also closes a media - preview. The UI locale is the server-side UI language setting. + `ctrl+e` word-wrapped preview, `ctrl+t` edit title, `ctrl+l` cycle + language, `ctrl+g` AI suggestions, `esc` back to sidebar. `ctrl+q` + quits, `esc` also closes a media preview. The UI locale is the + server-side UI language setting. """ use ExRatatui.App @@ -30,7 +31,7 @@ defmodule BDS.TUI do alias ExRatatui.Layout alias ExRatatui.Layout.Rect alias ExRatatui.Style - alias ExRatatui.Widgets.{Block, List, Paragraph, Tabs, Textarea} + alias ExRatatui.Widgets.{Block, List, Markdown, Paragraph, Tabs, Textarea} @views ~w(posts media templates scripts tags) @@ -135,8 +136,14 @@ defmodule BDS.TUI do defp editor_key(%{code: "esc"}, %{editor: %{editing_title?: true}} = state), do: {:noreply, put_in(state.editor.editing_title?, false)} + defp editor_key(%{code: "esc"}, %{editor: %{preview?: true}} = state), + do: {:noreply, put_in(state.editor.preview?, false)} + defp editor_key(%{code: "esc"}, state), do: {:noreply, %{state | focus: :sidebar}} + defp editor_key(%{code: "e", modifiers: ["ctrl"]}, state), + do: {:noreply, update_in(state.editor.preview?, &(not &1))} + defp editor_key(%{code: "s", modifiers: ["ctrl"]}, state), do: {:noreply, persist(state, :save)} defp editor_key(%{code: "p", modifiers: ["ctrl"]}, state), @@ -153,6 +160,9 @@ defmodule BDS.TUI do defp editor_key(key, %{editor: %{editing_title?: true}} = state), do: {:noreply, title_key(key, state)} + # While previewing, text keys must not edit the (invisible) textarea. + defp editor_key(_key, %{editor: %{preview?: true}} = state), do: {:noreply, state} + defp editor_key(%{code: code, modifiers: modifiers}, %{editor: editor} = state) do :ok = ExRatatui.textarea_handle_key(editor.textarea, code, modifiers) dirty = editor.dirty or code not in ~w(up down left right home end pageup pagedown) @@ -316,22 +326,38 @@ defmodule BDS.TUI do if(editor.editing_title?, do: %Style{fg: :yellow}, else: %Style{}) }, title_rect} + [title_widget, body_widget(state, editor, body_rect)] + end + + # The editing textarea cannot soft-wrap (upstream ratatui-textarea + # limitation), so ctrl+e flips to a word-wrapped read-only Markdown + # preview of the current draft. Wrap moves into the editor itself with + # the planned MarkdownEditor custom widget. + defp body_widget(_state, %{preview?: true} = editor, body_rect) do + preview_title = + "#{dgettext("ui", "Preview (ctrl+e to edit)")} [#{editor.language}]" + + {%Markdown{ + content: ExRatatui.textarea_get_value(editor.textarea), + wrap: true, + block: %Block{title: preview_title, borders: [:all]} + }, body_rect} + end + + defp body_widget(state, editor, body_rect) do body_title = "#{dgettext("ui", "Content")} [#{editor.language}]" <> if(editor.dirty, do: " •", else: "") - body_widget = - {%Textarea{ - state: editor.textarea, - block: %Block{title: body_title, borders: [:all]}, - cursor_style: - if(state.focus == :editor and not editor.editing_title?, - do: %Style{bg: :cyan}, - else: %Style{} - ) - }, body_rect} - - [title_widget, body_widget] + {%Textarea{ + state: editor.textarea, + block: %Block{title: body_title, borders: [:all]}, + cursor_style: + if(state.focus == :editor and not editor.editing_title?, + do: %Style{bg: :cyan}, + else: %Style{} + ) + }, body_rect} end defp status_widgets(state, rect) do @@ -375,7 +401,7 @@ defmodule BDS.TUI do do: dgettext( "ui", - "ctrl+s save · ctrl+p publish · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" + "ctrl+s save · ctrl+p publish · ctrl+e preview · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" ) # ── Sidebar data ───────────────────────────────────────────────────────── @@ -493,6 +519,7 @@ defmodule BDS.TUI do title: form["title"] || "", textarea: textarea, editing_title?: false, + preview?: false, dirty: false } end diff --git a/priv/gettext/de/LC_MESSAGES/ui.po b/priv/gettext/de/LC_MESSAGES/ui.po index 395be08..20b2391 100644 --- a/priv/gettext/de/LC_MESSAGES/ui.po +++ b/priv/gettext/de/LC_MESSAGES/ui.po @@ -81,11 +81,11 @@ msgstr "KI-Einstellungen" #: lib/bds/desktop/shell_live/overlay_manager.ex:72 #: lib/bds/desktop/shell_live/post_editor.ex:920 #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:43 -#: lib/bds/tui.ex:203 -#: lib/bds/tui.ex:206 -#: lib/bds/tui.ex:209 -#: lib/bds/tui.ex:217 -#: lib/bds/tui.ex:537 +#: lib/bds/tui.ex:224 +#: lib/bds/tui.ex:227 +#: lib/bds/tui.ex:230 +#: lib/bds/tui.ex:238 +#: lib/bds/tui.ex:575 #, elixir-autogen, elixir-format msgid "AI Suggestions" msgstr "KI-Vorschlaege" @@ -589,7 +589,7 @@ msgstr "Bestaetigen" #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:375 #: lib/bds/desktop/shell_live/script_editor_html/script_editor.html.heex:34 #: lib/bds/desktop/shell_live/template_editor_html/template_editor.html.heex:32 -#: lib/bds/tui.ex:308 +#: lib/bds/tui.ex:348 #: lib/bds/ui/sidebar.ex:764 #, elixir-autogen, elixir-format msgid "Content" @@ -1385,9 +1385,9 @@ msgstr "Maximale Beiträge pro Seite" #: lib/bds/desktop/shell_live/misc_editor.ex:762 #: lib/bds/desktop/shell_live/sidebar_components.ex:654 #: lib/bds/desktop/shell_live/sidebar_delete.ex:175 -#: lib/bds/tui.ex:452 -#: lib/bds/tui.ex:581 -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:489 +#: lib/bds/tui.ex:619 +#: lib/bds/tui.ex:622 #: lib/bds/ui/registry.ex:30 #: lib/bds/ui/registry.ex:100 #: lib/bds/ui/sidebar.ex:558 @@ -1475,7 +1475,7 @@ msgstr "Neue Seite" #: lib/bds/desktop/menu_bar.ex:214 #: lib/bds/desktop/shell_live/sidebar_create.ex:41 -#: lib/bds/tui.ex:103 +#: lib/bds/tui.ex:115 #, elixir-autogen, elixir-format msgid "New Post" msgstr "Neuer Beitrag" @@ -1911,8 +1911,8 @@ msgstr "Beitrag gespeichert" #: lib/bds/desktop/menu_bar.ex:233 #: lib/bds/desktop/shell_live/misc_editor.ex:664 #: lib/bds/desktop/shell_live/misc_editor.ex:761 -#: lib/bds/tui.ex:451 -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:488 +#: lib/bds/tui.ex:499 #: lib/bds/ui/registry.ex:14 #: lib/bds/ui/sidebar.ex:271 #, elixir-autogen, elixir-format @@ -2294,7 +2294,7 @@ msgstr "Scripting-Funktionen werden in der Neufassung auf Anwendungsebene konfig #: lib/bds/desktop/shell_live/script_editor.ex:216 #: lib/bds/desktop/shell_live/script_editor.ex:219 #: lib/bds/desktop/shell_live/script_editor.ex:234 -#: lib/bds/tui.ex:454 +#: lib/bds/tui.ex:491 #: lib/bds/ui/registry.ex:38 #: lib/bds/ui/sidebar.ex:63 #: lib/bds/ui/sidebar.ex:115 @@ -2542,7 +2542,7 @@ msgstr "Schlagwortname" #: lib/bds/desktop/shell_live/tags_editor.ex:222 #: lib/bds/desktop/shell_live/tags_editor.ex:253 #: lib/bds/desktop/shell_live/tags_editor_html/tags_editor.html.heex:11 -#: lib/bds/tui.ex:455 +#: lib/bds/tui.ex:492 #: lib/bds/ui/registry.ex:54 #: lib/bds/ui/registry.ex:103 #: lib/bds/ui/sidebar.ex:289 @@ -2598,7 +2598,7 @@ msgstr "Template-Syntax ist gültig" #: lib/bds/desktop/shell_live/template_editor.ex:171 #: lib/bds/desktop/shell_live/template_editor.ex:176 #: lib/bds/desktop/shell_live/template_editor.ex:191 -#: lib/bds/tui.ex:453 +#: lib/bds/tui.ex:490 #: lib/bds/ui/registry.ex:46 #: lib/bds/ui/sidebar.ex:71 #: lib/bds/ui/sidebar.ex:122 @@ -3613,92 +3613,87 @@ msgstr "OK" msgid "The endpoint returned no models. You can still type a model name manually." msgstr "Der Endpunkt hat keine Modelle zurückgegeben. Sie können einen Modellnamen weiterhin manuell eingeben." -#: lib/bds/tui.ex:538 +#: lib/bds/tui.ex:576 #, elixir-autogen, elixir-format msgid "AI is unavailable in airplane mode without a local endpoint." msgstr "KI ist im Flugmodus ohne lokalen Endpunkt nicht verfügbar." -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:622 #, elixir-autogen, elixir-format msgid "Could not load this file." msgstr "Diese Datei konnte nicht geladen werden." -#: lib/bds/tui.ex:111 +#: lib/bds/tui.ex:123 #, elixir-autogen, elixir-format msgid "Editing this item is not available in the terminal UI yet." msgstr "Die Bearbeitung dieses Eintrags ist in der Terminal-Oberfläche noch nicht verfügbar." -#: lib/bds/tui.ex:206 +#: lib/bds/tui.ex:227 #, elixir-autogen, elixir-format msgid "No suggestions returned." msgstr "Keine Vorschläge erhalten." -#: lib/bds/tui.ex:581 +#: lib/bds/tui.ex:619 #, elixir-autogen, elixir-format msgid "Only images can be previewed." msgstr "Nur Bilder können in der Vorschau angezeigt werden." -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:499 #, elixir-autogen, elixir-format msgid "Post not found." msgstr "Beitrag nicht gefunden." -#: lib/bds/tui.ex:282 +#: lib/bds/tui.ex:303 #, elixir-autogen, elixir-format msgid "Press enter to preview %{name}." msgstr "Drücken Sie Enter, um %{name} in der Vorschau anzuzeigen." -#: lib/bds/tui.ex:508 +#: lib/bds/tui.ex:546 #, elixir-autogen, elixir-format msgid "Published." msgstr "Veröffentlicht." -#: lib/bds/tui.ex:524 +#: lib/bds/tui.ex:562 #, elixir-autogen, elixir-format msgid "Save before switching languages." msgstr "Speichern Sie vor dem Sprachwechsel." -#: lib/bds/tui.ex:509 +#: lib/bds/tui.ex:547 #, elixir-autogen, elixir-format msgid "Saved." msgstr "Gespeichert." -#: lib/bds/tui.ex:285 +#: lib/bds/tui.ex:306 #, elixir-autogen, elixir-format msgid "Select an entry and press enter to open it." msgstr "Wählen Sie einen Eintrag aus und öffnen Sie ihn mit Enter." -#: lib/bds/tui.ex:203 +#: lib/bds/tui.ex:224 #, elixir-autogen, elixir-format msgid "Suggestions applied." msgstr "Vorschläge übernommen." -#: lib/bds/tui.ex:297 +#: lib/bds/tui.ex:318 #, elixir-autogen, elixir-format msgid "Title (ctrl+t to edit)" msgstr "Titel (Strg+T zum Bearbeiten)" -#: lib/bds/tui.ex:296 +#: lib/bds/tui.ex:317 #, elixir-autogen, elixir-format msgid "Title (editing — enter to confirm)" msgstr "Titel (Bearbeitung — Enter zum Bestätigen)" -#: lib/bds/tui.ex:328 +#: lib/bds/tui.ex:365 #, elixir-autogen, elixir-format msgid "Working…" msgstr "Wird bearbeitet…" -#: lib/bds/tui.ex:364 -#, elixir-autogen, elixir-format -msgid "ctrl+s save · ctrl+p publish · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" -msgstr "Strg+S Speichern · Strg+P Veröffentlichen · Strg+T Titel · Strg+L Sprache · Strg+G KI · Esc Zurück" - -#: lib/bds/tui.ex:357 +#: lib/bds/tui.ex:394 #, elixir-autogen, elixir-format msgid "enter open · n new post · 1-5 views · r refresh · ctrl+q quit" msgstr "Enter Öffnen · N Neuer Beitrag · 1-5 Ansichten · R Aktualisieren · Strg+Q Beenden" -#: lib/bds/tui.ex:349 +#: lib/bds/tui.ex:386 #, elixir-autogen, elixir-format msgid "esc to close" msgstr "Esc zum Schließen" @@ -3734,3 +3729,13 @@ msgstr "Serveradresse (user@host oder user@host:port), Public-Key-Authentifizier #, elixir-autogen, elixir-format msgid "Use the form user@host or user@host:port." msgstr "Verwenden Sie das Format user@host oder user@host:port." + +#: lib/bds/tui.ex:337 +#, elixir-autogen, elixir-format +msgid "Preview (ctrl+e to edit)" +msgstr "Vorschau (ctrl+e zum Bearbeiten)" + +#: lib/bds/tui.ex:401 +#, elixir-autogen, elixir-format +msgid "ctrl+s save · ctrl+p publish · ctrl+e preview · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" +msgstr "Strg+S Speichern · Strg+P Veröffentlichen · Strg+E Vorschau · Strg+T Titel · Strg+L Sprache · Strg+G KI · Esc Zurück" diff --git a/priv/gettext/en/LC_MESSAGES/ui.po b/priv/gettext/en/LC_MESSAGES/ui.po index 12149a6..3de942a 100644 --- a/priv/gettext/en/LC_MESSAGES/ui.po +++ b/priv/gettext/en/LC_MESSAGES/ui.po @@ -81,11 +81,11 @@ msgstr "" #: lib/bds/desktop/shell_live/overlay_manager.ex:72 #: lib/bds/desktop/shell_live/post_editor.ex:920 #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:43 -#: lib/bds/tui.ex:203 -#: lib/bds/tui.ex:206 -#: lib/bds/tui.ex:209 -#: lib/bds/tui.ex:217 -#: lib/bds/tui.ex:537 +#: lib/bds/tui.ex:224 +#: lib/bds/tui.ex:227 +#: lib/bds/tui.ex:230 +#: lib/bds/tui.ex:238 +#: lib/bds/tui.ex:575 #, elixir-autogen, elixir-format msgid "AI Suggestions" msgstr "" @@ -589,7 +589,7 @@ msgstr "" #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:375 #: lib/bds/desktop/shell_live/script_editor_html/script_editor.html.heex:34 #: lib/bds/desktop/shell_live/template_editor_html/template_editor.html.heex:32 -#: lib/bds/tui.ex:308 +#: lib/bds/tui.ex:348 #: lib/bds/ui/sidebar.ex:764 #, elixir-autogen, elixir-format msgid "Content" @@ -1385,9 +1385,9 @@ msgstr "" #: lib/bds/desktop/shell_live/misc_editor.ex:762 #: lib/bds/desktop/shell_live/sidebar_components.ex:654 #: lib/bds/desktop/shell_live/sidebar_delete.ex:175 -#: lib/bds/tui.ex:452 -#: lib/bds/tui.ex:581 -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:489 +#: lib/bds/tui.ex:619 +#: lib/bds/tui.ex:622 #: lib/bds/ui/registry.ex:30 #: lib/bds/ui/registry.ex:100 #: lib/bds/ui/sidebar.ex:558 @@ -1475,7 +1475,7 @@ msgstr "" #: lib/bds/desktop/menu_bar.ex:214 #: lib/bds/desktop/shell_live/sidebar_create.ex:41 -#: lib/bds/tui.ex:103 +#: lib/bds/tui.ex:115 #, elixir-autogen, elixir-format msgid "New Post" msgstr "" @@ -1911,8 +1911,8 @@ msgstr "" #: lib/bds/desktop/menu_bar.ex:233 #: lib/bds/desktop/shell_live/misc_editor.ex:664 #: lib/bds/desktop/shell_live/misc_editor.ex:761 -#: lib/bds/tui.ex:451 -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:488 +#: lib/bds/tui.ex:499 #: lib/bds/ui/registry.ex:14 #: lib/bds/ui/sidebar.ex:271 #, elixir-autogen, elixir-format @@ -2294,7 +2294,7 @@ msgstr "" #: lib/bds/desktop/shell_live/script_editor.ex:216 #: lib/bds/desktop/shell_live/script_editor.ex:219 #: lib/bds/desktop/shell_live/script_editor.ex:234 -#: lib/bds/tui.ex:454 +#: lib/bds/tui.ex:491 #: lib/bds/ui/registry.ex:38 #: lib/bds/ui/sidebar.ex:63 #: lib/bds/ui/sidebar.ex:115 @@ -2542,7 +2542,7 @@ msgstr "" #: lib/bds/desktop/shell_live/tags_editor.ex:222 #: lib/bds/desktop/shell_live/tags_editor.ex:253 #: lib/bds/desktop/shell_live/tags_editor_html/tags_editor.html.heex:11 -#: lib/bds/tui.ex:455 +#: lib/bds/tui.ex:492 #: lib/bds/ui/registry.ex:54 #: lib/bds/ui/registry.ex:103 #: lib/bds/ui/sidebar.ex:289 @@ -2598,7 +2598,7 @@ msgstr "" #: lib/bds/desktop/shell_live/template_editor.ex:171 #: lib/bds/desktop/shell_live/template_editor.ex:176 #: lib/bds/desktop/shell_live/template_editor.ex:191 -#: lib/bds/tui.ex:453 +#: lib/bds/tui.ex:490 #: lib/bds/ui/registry.ex:46 #: lib/bds/ui/sidebar.ex:71 #: lib/bds/ui/sidebar.ex:122 @@ -3613,92 +3613,87 @@ msgstr "" msgid "The endpoint returned no models. You can still type a model name manually." msgstr "" -#: lib/bds/tui.ex:538 +#: lib/bds/tui.ex:576 #, elixir-autogen, elixir-format msgid "AI is unavailable in airplane mode without a local endpoint." msgstr "" -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:622 #, elixir-autogen, elixir-format, fuzzy msgid "Could not load this file." msgstr "" -#: lib/bds/tui.ex:111 +#: lib/bds/tui.ex:123 #, elixir-autogen, elixir-format msgid "Editing this item is not available in the terminal UI yet." msgstr "" -#: lib/bds/tui.ex:206 +#: lib/bds/tui.ex:227 #, elixir-autogen, elixir-format msgid "No suggestions returned." msgstr "" -#: lib/bds/tui.ex:581 +#: lib/bds/tui.ex:619 #, elixir-autogen, elixir-format msgid "Only images can be previewed." msgstr "" -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:499 #, elixir-autogen, elixir-format msgid "Post not found." msgstr "" -#: lib/bds/tui.ex:282 +#: lib/bds/tui.ex:303 #, elixir-autogen, elixir-format msgid "Press enter to preview %{name}." msgstr "" -#: lib/bds/tui.ex:508 +#: lib/bds/tui.ex:546 #, elixir-autogen, elixir-format, fuzzy msgid "Published." msgstr "" -#: lib/bds/tui.ex:524 +#: lib/bds/tui.ex:562 #, elixir-autogen, elixir-format msgid "Save before switching languages." msgstr "" -#: lib/bds/tui.ex:509 +#: lib/bds/tui.ex:547 #, elixir-autogen, elixir-format, fuzzy msgid "Saved." msgstr "" -#: lib/bds/tui.ex:285 +#: lib/bds/tui.ex:306 #, elixir-autogen, elixir-format msgid "Select an entry and press enter to open it." msgstr "" -#: lib/bds/tui.ex:203 +#: lib/bds/tui.ex:224 #, elixir-autogen, elixir-format msgid "Suggestions applied." msgstr "" -#: lib/bds/tui.ex:297 +#: lib/bds/tui.ex:318 #, elixir-autogen, elixir-format msgid "Title (ctrl+t to edit)" msgstr "" -#: lib/bds/tui.ex:296 +#: lib/bds/tui.ex:317 #, elixir-autogen, elixir-format msgid "Title (editing — enter to confirm)" msgstr "" -#: lib/bds/tui.ex:328 +#: lib/bds/tui.ex:365 #, elixir-autogen, elixir-format, fuzzy msgid "Working…" msgstr "" -#: lib/bds/tui.ex:364 -#, elixir-autogen, elixir-format -msgid "ctrl+s save · ctrl+p publish · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" -msgstr "" - -#: lib/bds/tui.ex:357 +#: lib/bds/tui.ex:394 #, elixir-autogen, elixir-format msgid "enter open · n new post · 1-5 views · r refresh · ctrl+q quit" msgstr "" -#: lib/bds/tui.ex:349 +#: lib/bds/tui.ex:386 #, elixir-autogen, elixir-format msgid "esc to close" msgstr "" @@ -3734,3 +3729,13 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Use the form user@host or user@host:port." msgstr "" + +#: lib/bds/tui.ex:337 +#, elixir-autogen, elixir-format +msgid "Preview (ctrl+e to edit)" +msgstr "" + +#: lib/bds/tui.ex:401 +#, elixir-autogen, elixir-format, fuzzy +msgid "ctrl+s save · ctrl+p publish · ctrl+e preview · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" +msgstr "" diff --git a/priv/gettext/es/LC_MESSAGES/ui.po b/priv/gettext/es/LC_MESSAGES/ui.po index 8f94bcc..f7148b2 100644 --- a/priv/gettext/es/LC_MESSAGES/ui.po +++ b/priv/gettext/es/LC_MESSAGES/ui.po @@ -81,11 +81,11 @@ msgstr "Configuración de IA" #: lib/bds/desktop/shell_live/overlay_manager.ex:72 #: lib/bds/desktop/shell_live/post_editor.ex:920 #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:43 -#: lib/bds/tui.ex:203 -#: lib/bds/tui.ex:206 -#: lib/bds/tui.ex:209 -#: lib/bds/tui.ex:217 -#: lib/bds/tui.ex:537 +#: lib/bds/tui.ex:224 +#: lib/bds/tui.ex:227 +#: lib/bds/tui.ex:230 +#: lib/bds/tui.ex:238 +#: lib/bds/tui.ex:575 #, elixir-autogen, elixir-format msgid "AI Suggestions" msgstr "Sugerencias de IA" @@ -589,7 +589,7 @@ msgstr "Confirmar" #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:375 #: lib/bds/desktop/shell_live/script_editor_html/script_editor.html.heex:34 #: lib/bds/desktop/shell_live/template_editor_html/template_editor.html.heex:32 -#: lib/bds/tui.ex:308 +#: lib/bds/tui.ex:348 #: lib/bds/ui/sidebar.ex:764 #, elixir-autogen, elixir-format msgid "Content" @@ -1385,9 +1385,9 @@ msgstr "Máximo de publicaciones por página" #: lib/bds/desktop/shell_live/misc_editor.ex:762 #: lib/bds/desktop/shell_live/sidebar_components.ex:654 #: lib/bds/desktop/shell_live/sidebar_delete.ex:175 -#: lib/bds/tui.ex:452 -#: lib/bds/tui.ex:581 -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:489 +#: lib/bds/tui.ex:619 +#: lib/bds/tui.ex:622 #: lib/bds/ui/registry.ex:30 #: lib/bds/ui/registry.ex:100 #: lib/bds/ui/sidebar.ex:558 @@ -1475,7 +1475,7 @@ msgstr "Nueva página" #: lib/bds/desktop/menu_bar.ex:214 #: lib/bds/desktop/shell_live/sidebar_create.ex:41 -#: lib/bds/tui.ex:103 +#: lib/bds/tui.ex:115 #, elixir-autogen, elixir-format msgid "New Post" msgstr "Nueva entrada" @@ -1911,8 +1911,8 @@ msgstr "Artículo guardado" #: lib/bds/desktop/menu_bar.ex:233 #: lib/bds/desktop/shell_live/misc_editor.ex:664 #: lib/bds/desktop/shell_live/misc_editor.ex:761 -#: lib/bds/tui.ex:451 -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:488 +#: lib/bds/tui.ex:499 #: lib/bds/ui/registry.ex:14 #: lib/bds/ui/sidebar.ex:271 #, elixir-autogen, elixir-format @@ -2294,7 +2294,7 @@ msgstr "Las capacidades de scripts se configuran en la capa de aplicación en la #: lib/bds/desktop/shell_live/script_editor.ex:216 #: lib/bds/desktop/shell_live/script_editor.ex:219 #: lib/bds/desktop/shell_live/script_editor.ex:234 -#: lib/bds/tui.ex:454 +#: lib/bds/tui.ex:491 #: lib/bds/ui/registry.ex:38 #: lib/bds/ui/sidebar.ex:63 #: lib/bds/ui/sidebar.ex:115 @@ -2542,7 +2542,7 @@ msgstr "Nombre de la etiqueta" #: lib/bds/desktop/shell_live/tags_editor.ex:222 #: lib/bds/desktop/shell_live/tags_editor.ex:253 #: lib/bds/desktop/shell_live/tags_editor_html/tags_editor.html.heex:11 -#: lib/bds/tui.ex:455 +#: lib/bds/tui.ex:492 #: lib/bds/ui/registry.ex:54 #: lib/bds/ui/registry.ex:103 #: lib/bds/ui/sidebar.ex:289 @@ -2598,7 +2598,7 @@ msgstr "La sintaxis de la plantilla es válida" #: lib/bds/desktop/shell_live/template_editor.ex:171 #: lib/bds/desktop/shell_live/template_editor.ex:176 #: lib/bds/desktop/shell_live/template_editor.ex:191 -#: lib/bds/tui.ex:453 +#: lib/bds/tui.ex:490 #: lib/bds/ui/registry.ex:46 #: lib/bds/ui/sidebar.ex:71 #: lib/bds/ui/sidebar.ex:122 @@ -3613,92 +3613,87 @@ msgstr "OK" msgid "The endpoint returned no models. You can still type a model name manually." msgstr "El endpoint no devolvió ningún modelo. Aún puedes escribir el nombre de un modelo manualmente." -#: lib/bds/tui.ex:538 +#: lib/bds/tui.ex:576 #, elixir-autogen, elixir-format msgid "AI is unavailable in airplane mode without a local endpoint." msgstr "La IA no está disponible en modo avión sin un punto de conexión local." -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:622 #, elixir-autogen, elixir-format msgid "Could not load this file." msgstr "No se pudo cargar este archivo." -#: lib/bds/tui.ex:111 +#: lib/bds/tui.ex:123 #, elixir-autogen, elixir-format msgid "Editing this item is not available in the terminal UI yet." msgstr "La edición de este elemento aún no está disponible en la interfaz de terminal." -#: lib/bds/tui.ex:206 +#: lib/bds/tui.ex:227 #, elixir-autogen, elixir-format msgid "No suggestions returned." msgstr "No se recibieron sugerencias." -#: lib/bds/tui.ex:581 +#: lib/bds/tui.ex:619 #, elixir-autogen, elixir-format msgid "Only images can be previewed." msgstr "Solo se pueden previsualizar imágenes." -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:499 #, elixir-autogen, elixir-format msgid "Post not found." msgstr "Entrada no encontrada." -#: lib/bds/tui.ex:282 +#: lib/bds/tui.ex:303 #, elixir-autogen, elixir-format msgid "Press enter to preview %{name}." msgstr "Pulsa Intro para previsualizar %{name}." -#: lib/bds/tui.ex:508 +#: lib/bds/tui.ex:546 #, elixir-autogen, elixir-format msgid "Published." msgstr "Publicado." -#: lib/bds/tui.ex:524 +#: lib/bds/tui.ex:562 #, elixir-autogen, elixir-format msgid "Save before switching languages." msgstr "Guarda antes de cambiar de idioma." -#: lib/bds/tui.ex:509 +#: lib/bds/tui.ex:547 #, elixir-autogen, elixir-format msgid "Saved." msgstr "Guardado." -#: lib/bds/tui.ex:285 +#: lib/bds/tui.ex:306 #, elixir-autogen, elixir-format msgid "Select an entry and press enter to open it." msgstr "Selecciona una entrada y pulsa Intro para abrirla." -#: lib/bds/tui.ex:203 +#: lib/bds/tui.ex:224 #, elixir-autogen, elixir-format msgid "Suggestions applied." msgstr "Sugerencias aplicadas." -#: lib/bds/tui.ex:297 +#: lib/bds/tui.ex:318 #, elixir-autogen, elixir-format msgid "Title (ctrl+t to edit)" msgstr "Título (ctrl+t para editar)" -#: lib/bds/tui.ex:296 +#: lib/bds/tui.ex:317 #, elixir-autogen, elixir-format msgid "Title (editing — enter to confirm)" msgstr "Título (edición — Intro para confirmar)" -#: lib/bds/tui.ex:328 +#: lib/bds/tui.ex:365 #, elixir-autogen, elixir-format msgid "Working…" msgstr "Procesando…" -#: lib/bds/tui.ex:364 -#, elixir-autogen, elixir-format -msgid "ctrl+s save · ctrl+p publish · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" -msgstr "ctrl+s guardar · ctrl+p publicar · ctrl+t título · ctrl+l idioma · ctrl+g IA · esc volver" - -#: lib/bds/tui.ex:357 +#: lib/bds/tui.ex:394 #, elixir-autogen, elixir-format msgid "enter open · n new post · 1-5 views · r refresh · ctrl+q quit" msgstr "intro abrir · n nueva entrada · 1-5 vistas · r actualizar · ctrl+q salir" -#: lib/bds/tui.ex:349 +#: lib/bds/tui.ex:386 #, elixir-autogen, elixir-format msgid "esc to close" msgstr "esc para cerrar" @@ -3734,3 +3729,13 @@ msgstr "Dirección del servidor (user@host o user@host:port), autenticación de #, elixir-autogen, elixir-format msgid "Use the form user@host or user@host:port." msgstr "Usa el formato user@host o user@host:port." + +#: lib/bds/tui.ex:337 +#, elixir-autogen, elixir-format +msgid "Preview (ctrl+e to edit)" +msgstr "Vista previa (ctrl+e para editar)" + +#: lib/bds/tui.ex:401 +#, elixir-autogen, elixir-format +msgid "ctrl+s save · ctrl+p publish · ctrl+e preview · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" +msgstr "ctrl+s guardar · ctrl+p publicar · ctrl+e vista previa · ctrl+t título · ctrl+l idioma · ctrl+g IA · esc volver" diff --git a/priv/gettext/fr/LC_MESSAGES/ui.po b/priv/gettext/fr/LC_MESSAGES/ui.po index aa04b47..3fe8afe 100644 --- a/priv/gettext/fr/LC_MESSAGES/ui.po +++ b/priv/gettext/fr/LC_MESSAGES/ui.po @@ -81,11 +81,11 @@ msgstr "Paramètres IA" #: lib/bds/desktop/shell_live/overlay_manager.ex:72 #: lib/bds/desktop/shell_live/post_editor.ex:920 #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:43 -#: lib/bds/tui.ex:203 -#: lib/bds/tui.ex:206 -#: lib/bds/tui.ex:209 -#: lib/bds/tui.ex:217 -#: lib/bds/tui.ex:537 +#: lib/bds/tui.ex:224 +#: lib/bds/tui.ex:227 +#: lib/bds/tui.ex:230 +#: lib/bds/tui.ex:238 +#: lib/bds/tui.ex:575 #, elixir-autogen, elixir-format msgid "AI Suggestions" msgstr "Suggestions IA" @@ -589,7 +589,7 @@ msgstr "Confirmer" #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:375 #: lib/bds/desktop/shell_live/script_editor_html/script_editor.html.heex:34 #: lib/bds/desktop/shell_live/template_editor_html/template_editor.html.heex:32 -#: lib/bds/tui.ex:308 +#: lib/bds/tui.ex:348 #: lib/bds/ui/sidebar.ex:764 #, elixir-autogen, elixir-format msgid "Content" @@ -1385,9 +1385,9 @@ msgstr "Nombre maximal d’articles par page" #: lib/bds/desktop/shell_live/misc_editor.ex:762 #: lib/bds/desktop/shell_live/sidebar_components.ex:654 #: lib/bds/desktop/shell_live/sidebar_delete.ex:175 -#: lib/bds/tui.ex:452 -#: lib/bds/tui.ex:581 -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:489 +#: lib/bds/tui.ex:619 +#: lib/bds/tui.ex:622 #: lib/bds/ui/registry.ex:30 #: lib/bds/ui/registry.ex:100 #: lib/bds/ui/sidebar.ex:558 @@ -1475,7 +1475,7 @@ msgstr "Nouvelle page" #: lib/bds/desktop/menu_bar.ex:214 #: lib/bds/desktop/shell_live/sidebar_create.ex:41 -#: lib/bds/tui.ex:103 +#: lib/bds/tui.ex:115 #, elixir-autogen, elixir-format msgid "New Post" msgstr "Nouvel article" @@ -1911,8 +1911,8 @@ msgstr "Article enregistré" #: lib/bds/desktop/menu_bar.ex:233 #: lib/bds/desktop/shell_live/misc_editor.ex:664 #: lib/bds/desktop/shell_live/misc_editor.ex:761 -#: lib/bds/tui.ex:451 -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:488 +#: lib/bds/tui.ex:499 #: lib/bds/ui/registry.ex:14 #: lib/bds/ui/sidebar.ex:271 #, elixir-autogen, elixir-format @@ -2294,7 +2294,7 @@ msgstr "Les capacités de script sont configurées au niveau de l’application #: lib/bds/desktop/shell_live/script_editor.ex:216 #: lib/bds/desktop/shell_live/script_editor.ex:219 #: lib/bds/desktop/shell_live/script_editor.ex:234 -#: lib/bds/tui.ex:454 +#: lib/bds/tui.ex:491 #: lib/bds/ui/registry.ex:38 #: lib/bds/ui/sidebar.ex:63 #: lib/bds/ui/sidebar.ex:115 @@ -2542,7 +2542,7 @@ msgstr "Nom du mot-clé" #: lib/bds/desktop/shell_live/tags_editor.ex:222 #: lib/bds/desktop/shell_live/tags_editor.ex:253 #: lib/bds/desktop/shell_live/tags_editor_html/tags_editor.html.heex:11 -#: lib/bds/tui.ex:455 +#: lib/bds/tui.ex:492 #: lib/bds/ui/registry.ex:54 #: lib/bds/ui/registry.ex:103 #: lib/bds/ui/sidebar.ex:289 @@ -2598,7 +2598,7 @@ msgstr "La syntaxe du template est valide" #: lib/bds/desktop/shell_live/template_editor.ex:171 #: lib/bds/desktop/shell_live/template_editor.ex:176 #: lib/bds/desktop/shell_live/template_editor.ex:191 -#: lib/bds/tui.ex:453 +#: lib/bds/tui.ex:490 #: lib/bds/ui/registry.ex:46 #: lib/bds/ui/sidebar.ex:71 #: lib/bds/ui/sidebar.ex:122 @@ -3613,92 +3613,87 @@ msgstr "OK" msgid "The endpoint returned no models. You can still type a model name manually." msgstr "Le point de terminaison n'a renvoyé aucun modèle. Vous pouvez toujours saisir un nom de modèle manuellement." -#: lib/bds/tui.ex:538 +#: lib/bds/tui.ex:576 #, elixir-autogen, elixir-format msgid "AI is unavailable in airplane mode without a local endpoint." msgstr "L'IA n'est pas disponible en mode avion sans point de terminaison local." -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:622 #, elixir-autogen, elixir-format msgid "Could not load this file." msgstr "Impossible de charger ce fichier." -#: lib/bds/tui.ex:111 +#: lib/bds/tui.ex:123 #, elixir-autogen, elixir-format msgid "Editing this item is not available in the terminal UI yet." msgstr "La modification de cet élément n'est pas encore disponible dans l'interface du terminal." -#: lib/bds/tui.ex:206 +#: lib/bds/tui.ex:227 #, elixir-autogen, elixir-format msgid "No suggestions returned." msgstr "Aucune suggestion reçue." -#: lib/bds/tui.ex:581 +#: lib/bds/tui.ex:619 #, elixir-autogen, elixir-format msgid "Only images can be previewed." msgstr "Seules les images peuvent être prévisualisées." -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:499 #, elixir-autogen, elixir-format msgid "Post not found." msgstr "Article introuvable." -#: lib/bds/tui.ex:282 +#: lib/bds/tui.ex:303 #, elixir-autogen, elixir-format msgid "Press enter to preview %{name}." msgstr "Appuyez sur Entrée pour prévisualiser %{name}." -#: lib/bds/tui.ex:508 +#: lib/bds/tui.ex:546 #, elixir-autogen, elixir-format msgid "Published." msgstr "Publié." -#: lib/bds/tui.ex:524 +#: lib/bds/tui.ex:562 #, elixir-autogen, elixir-format msgid "Save before switching languages." msgstr "Enregistrez avant de changer de langue." -#: lib/bds/tui.ex:509 +#: lib/bds/tui.ex:547 #, elixir-autogen, elixir-format msgid "Saved." msgstr "Enregistré." -#: lib/bds/tui.ex:285 +#: lib/bds/tui.ex:306 #, elixir-autogen, elixir-format msgid "Select an entry and press enter to open it." msgstr "Sélectionnez une entrée et appuyez sur Entrée pour l'ouvrir." -#: lib/bds/tui.ex:203 +#: lib/bds/tui.ex:224 #, elixir-autogen, elixir-format msgid "Suggestions applied." msgstr "Suggestions appliquées." -#: lib/bds/tui.ex:297 +#: lib/bds/tui.ex:318 #, elixir-autogen, elixir-format msgid "Title (ctrl+t to edit)" msgstr "Titre (ctrl+t pour modifier)" -#: lib/bds/tui.ex:296 +#: lib/bds/tui.ex:317 #, elixir-autogen, elixir-format msgid "Title (editing — enter to confirm)" msgstr "Titre (édition — Entrée pour confirmer)" -#: lib/bds/tui.ex:328 +#: lib/bds/tui.ex:365 #, elixir-autogen, elixir-format msgid "Working…" msgstr "Traitement en cours…" -#: lib/bds/tui.ex:364 -#, elixir-autogen, elixir-format -msgid "ctrl+s save · ctrl+p publish · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" -msgstr "ctrl+s enregistrer · ctrl+p publier · ctrl+t titre · ctrl+l langue · ctrl+g IA · échap retour" - -#: lib/bds/tui.ex:357 +#: lib/bds/tui.ex:394 #, elixir-autogen, elixir-format msgid "enter open · n new post · 1-5 views · r refresh · ctrl+q quit" msgstr "entrée ouvrir · n nouvel article · 1-5 vues · r actualiser · ctrl+q quitter" -#: lib/bds/tui.ex:349 +#: lib/bds/tui.ex:386 #, elixir-autogen, elixir-format msgid "esc to close" msgstr "échap pour fermer" @@ -3734,3 +3729,13 @@ msgstr "Adresse du serveur (user@host ou user@host:port), authentification par c #, elixir-autogen, elixir-format msgid "Use the form user@host or user@host:port." msgstr "Utilisez le format user@host ou user@host:port." + +#: lib/bds/tui.ex:337 +#, elixir-autogen, elixir-format +msgid "Preview (ctrl+e to edit)" +msgstr "Aperçu (ctrl+e pour modifier)" + +#: lib/bds/tui.ex:401 +#, elixir-autogen, elixir-format +msgid "ctrl+s save · ctrl+p publish · ctrl+e preview · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" +msgstr "ctrl+s enregistrer · ctrl+p publier · ctrl+e aperçu · ctrl+t titre · ctrl+l langue · ctrl+g IA · échap retour" diff --git a/priv/gettext/it/LC_MESSAGES/ui.po b/priv/gettext/it/LC_MESSAGES/ui.po index 6507e72..66e19db 100644 --- a/priv/gettext/it/LC_MESSAGES/ui.po +++ b/priv/gettext/it/LC_MESSAGES/ui.po @@ -81,11 +81,11 @@ msgstr "Impostazioni IA" #: lib/bds/desktop/shell_live/overlay_manager.ex:72 #: lib/bds/desktop/shell_live/post_editor.ex:920 #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:43 -#: lib/bds/tui.ex:203 -#: lib/bds/tui.ex:206 -#: lib/bds/tui.ex:209 -#: lib/bds/tui.ex:217 -#: lib/bds/tui.ex:537 +#: lib/bds/tui.ex:224 +#: lib/bds/tui.ex:227 +#: lib/bds/tui.ex:230 +#: lib/bds/tui.ex:238 +#: lib/bds/tui.ex:575 #, elixir-autogen, elixir-format msgid "AI Suggestions" msgstr "Suggerimenti IA" @@ -589,7 +589,7 @@ msgstr "Conferma" #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:375 #: lib/bds/desktop/shell_live/script_editor_html/script_editor.html.heex:34 #: lib/bds/desktop/shell_live/template_editor_html/template_editor.html.heex:32 -#: lib/bds/tui.ex:308 +#: lib/bds/tui.ex:348 #: lib/bds/ui/sidebar.ex:764 #, elixir-autogen, elixir-format msgid "Content" @@ -1385,9 +1385,9 @@ msgstr "Numero massimo di post per pagina" #: lib/bds/desktop/shell_live/misc_editor.ex:762 #: lib/bds/desktop/shell_live/sidebar_components.ex:654 #: lib/bds/desktop/shell_live/sidebar_delete.ex:175 -#: lib/bds/tui.ex:452 -#: lib/bds/tui.ex:581 -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:489 +#: lib/bds/tui.ex:619 +#: lib/bds/tui.ex:622 #: lib/bds/ui/registry.ex:30 #: lib/bds/ui/registry.ex:100 #: lib/bds/ui/sidebar.ex:558 @@ -1475,7 +1475,7 @@ msgstr "Nuova pagina" #: lib/bds/desktop/menu_bar.ex:214 #: lib/bds/desktop/shell_live/sidebar_create.ex:41 -#: lib/bds/tui.ex:103 +#: lib/bds/tui.ex:115 #, elixir-autogen, elixir-format msgid "New Post" msgstr "Nuovo post" @@ -1911,8 +1911,8 @@ msgstr "Articolo salvato" #: lib/bds/desktop/menu_bar.ex:233 #: lib/bds/desktop/shell_live/misc_editor.ex:664 #: lib/bds/desktop/shell_live/misc_editor.ex:761 -#: lib/bds/tui.ex:451 -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:488 +#: lib/bds/tui.ex:499 #: lib/bds/ui/registry.ex:14 #: lib/bds/ui/sidebar.ex:271 #, elixir-autogen, elixir-format @@ -2294,7 +2294,7 @@ msgstr "Le capacità di scripting sono configurate a livello applicativo nella r #: lib/bds/desktop/shell_live/script_editor.ex:216 #: lib/bds/desktop/shell_live/script_editor.ex:219 #: lib/bds/desktop/shell_live/script_editor.ex:234 -#: lib/bds/tui.ex:454 +#: lib/bds/tui.ex:491 #: lib/bds/ui/registry.ex:38 #: lib/bds/ui/sidebar.ex:63 #: lib/bds/ui/sidebar.ex:115 @@ -2542,7 +2542,7 @@ msgstr "Nome del tag" #: lib/bds/desktop/shell_live/tags_editor.ex:222 #: lib/bds/desktop/shell_live/tags_editor.ex:253 #: lib/bds/desktop/shell_live/tags_editor_html/tags_editor.html.heex:11 -#: lib/bds/tui.ex:455 +#: lib/bds/tui.ex:492 #: lib/bds/ui/registry.ex:54 #: lib/bds/ui/registry.ex:103 #: lib/bds/ui/sidebar.ex:289 @@ -2598,7 +2598,7 @@ msgstr "La sintassi del template è valida" #: lib/bds/desktop/shell_live/template_editor.ex:171 #: lib/bds/desktop/shell_live/template_editor.ex:176 #: lib/bds/desktop/shell_live/template_editor.ex:191 -#: lib/bds/tui.ex:453 +#: lib/bds/tui.ex:490 #: lib/bds/ui/registry.ex:46 #: lib/bds/ui/sidebar.ex:71 #: lib/bds/ui/sidebar.ex:122 @@ -3613,92 +3613,87 @@ msgstr "OK" msgid "The endpoint returned no models. You can still type a model name manually." msgstr "L'endpoint non ha restituito alcun modello. Puoi comunque digitare manualmente il nome di un modello." -#: lib/bds/tui.ex:538 +#: lib/bds/tui.ex:576 #, elixir-autogen, elixir-format msgid "AI is unavailable in airplane mode without a local endpoint." msgstr "L'IA non è disponibile in modalità aereo senza un endpoint locale." -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:622 #, elixir-autogen, elixir-format msgid "Could not load this file." msgstr "Impossibile caricare questo file." -#: lib/bds/tui.ex:111 +#: lib/bds/tui.ex:123 #, elixir-autogen, elixir-format msgid "Editing this item is not available in the terminal UI yet." msgstr "La modifica di questo elemento non è ancora disponibile nell'interfaccia del terminale." -#: lib/bds/tui.ex:206 +#: lib/bds/tui.ex:227 #, elixir-autogen, elixir-format msgid "No suggestions returned." msgstr "Nessun suggerimento ricevuto." -#: lib/bds/tui.ex:581 +#: lib/bds/tui.ex:619 #, elixir-autogen, elixir-format msgid "Only images can be previewed." msgstr "Solo le immagini possono essere visualizzate in anteprima." -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:499 #, elixir-autogen, elixir-format msgid "Post not found." msgstr "Post non trovato." -#: lib/bds/tui.ex:282 +#: lib/bds/tui.ex:303 #, elixir-autogen, elixir-format msgid "Press enter to preview %{name}." msgstr "Premi Invio per l'anteprima di %{name}." -#: lib/bds/tui.ex:508 +#: lib/bds/tui.ex:546 #, elixir-autogen, elixir-format msgid "Published." msgstr "Pubblicato." -#: lib/bds/tui.ex:524 +#: lib/bds/tui.ex:562 #, elixir-autogen, elixir-format msgid "Save before switching languages." msgstr "Salva prima di cambiare lingua." -#: lib/bds/tui.ex:509 +#: lib/bds/tui.ex:547 #, elixir-autogen, elixir-format msgid "Saved." msgstr "Salvato." -#: lib/bds/tui.ex:285 +#: lib/bds/tui.ex:306 #, elixir-autogen, elixir-format msgid "Select an entry and press enter to open it." msgstr "Seleziona una voce e premi Invio per aprirla." -#: lib/bds/tui.ex:203 +#: lib/bds/tui.ex:224 #, elixir-autogen, elixir-format msgid "Suggestions applied." msgstr "Suggerimenti applicati." -#: lib/bds/tui.ex:297 +#: lib/bds/tui.ex:318 #, elixir-autogen, elixir-format msgid "Title (ctrl+t to edit)" msgstr "Titolo (ctrl+t per modificare)" -#: lib/bds/tui.ex:296 +#: lib/bds/tui.ex:317 #, elixir-autogen, elixir-format msgid "Title (editing — enter to confirm)" msgstr "Titolo (modifica — Invio per confermare)" -#: lib/bds/tui.ex:328 +#: lib/bds/tui.ex:365 #, elixir-autogen, elixir-format msgid "Working…" msgstr "Elaborazione…" -#: lib/bds/tui.ex:364 -#, elixir-autogen, elixir-format -msgid "ctrl+s save · ctrl+p publish · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" -msgstr "ctrl+s salva · ctrl+p pubblica · ctrl+t titolo · ctrl+l lingua · ctrl+g IA · esc indietro" - -#: lib/bds/tui.ex:357 +#: lib/bds/tui.ex:394 #, elixir-autogen, elixir-format msgid "enter open · n new post · 1-5 views · r refresh · ctrl+q quit" msgstr "invio apri · n nuovo post · 1-5 viste · r aggiorna · ctrl+q esci" -#: lib/bds/tui.ex:349 +#: lib/bds/tui.ex:386 #, elixir-autogen, elixir-format msgid "esc to close" msgstr "esc per chiudere" @@ -3734,3 +3729,13 @@ msgstr "Indirizzo del server (user@host o user@host:port), autenticazione a chia #, elixir-autogen, elixir-format msgid "Use the form user@host or user@host:port." msgstr "Usa il formato user@host o user@host:port." + +#: lib/bds/tui.ex:337 +#, elixir-autogen, elixir-format +msgid "Preview (ctrl+e to edit)" +msgstr "Anteprima (ctrl+e per modificare)" + +#: lib/bds/tui.ex:401 +#, elixir-autogen, elixir-format +msgid "ctrl+s save · ctrl+p publish · ctrl+e preview · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" +msgstr "ctrl+s salva · ctrl+p pubblica · ctrl+e anteprima · ctrl+t titolo · ctrl+l lingua · ctrl+g IA · esc indietro" diff --git a/priv/gettext/ui.pot b/priv/gettext/ui.pot index 9bf9251..1338eee 100644 --- a/priv/gettext/ui.pot +++ b/priv/gettext/ui.pot @@ -94,11 +94,11 @@ msgstr "" #: lib/bds/desktop/shell_live/overlay_manager.ex:72 #: lib/bds/desktop/shell_live/post_editor.ex:920 #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:43 -#: lib/bds/tui.ex:203 -#: lib/bds/tui.ex:206 -#: lib/bds/tui.ex:209 -#: lib/bds/tui.ex:217 -#: lib/bds/tui.ex:537 +#: lib/bds/tui.ex:224 +#: lib/bds/tui.ex:227 +#: lib/bds/tui.ex:230 +#: lib/bds/tui.ex:238 +#: lib/bds/tui.ex:575 #, elixir-autogen, elixir-format msgid "AI Suggestions" msgstr "" @@ -602,7 +602,7 @@ msgstr "" #: lib/bds/desktop/shell_live/post_editor_html/post_editor.html.heex:375 #: lib/bds/desktop/shell_live/script_editor_html/script_editor.html.heex:34 #: lib/bds/desktop/shell_live/template_editor_html/template_editor.html.heex:32 -#: lib/bds/tui.ex:308 +#: lib/bds/tui.ex:348 #: lib/bds/ui/sidebar.ex:764 #, elixir-autogen, elixir-format msgid "Content" @@ -1398,9 +1398,9 @@ msgstr "" #: lib/bds/desktop/shell_live/misc_editor.ex:762 #: lib/bds/desktop/shell_live/sidebar_components.ex:654 #: lib/bds/desktop/shell_live/sidebar_delete.ex:175 -#: lib/bds/tui.ex:452 -#: lib/bds/tui.ex:581 -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:489 +#: lib/bds/tui.ex:619 +#: lib/bds/tui.ex:622 #: lib/bds/ui/registry.ex:30 #: lib/bds/ui/registry.ex:100 #: lib/bds/ui/sidebar.ex:558 @@ -1488,7 +1488,7 @@ msgstr "" #: lib/bds/desktop/menu_bar.ex:214 #: lib/bds/desktop/shell_live/sidebar_create.ex:41 -#: lib/bds/tui.ex:103 +#: lib/bds/tui.ex:115 #, elixir-autogen, elixir-format msgid "New Post" msgstr "" @@ -1924,8 +1924,8 @@ msgstr "" #: lib/bds/desktop/menu_bar.ex:233 #: lib/bds/desktop/shell_live/misc_editor.ex:664 #: lib/bds/desktop/shell_live/misc_editor.ex:761 -#: lib/bds/tui.ex:451 -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:488 +#: lib/bds/tui.ex:499 #: lib/bds/ui/registry.ex:14 #: lib/bds/ui/sidebar.ex:271 #, elixir-autogen, elixir-format @@ -2307,7 +2307,7 @@ msgstr "" #: lib/bds/desktop/shell_live/script_editor.ex:216 #: lib/bds/desktop/shell_live/script_editor.ex:219 #: lib/bds/desktop/shell_live/script_editor.ex:234 -#: lib/bds/tui.ex:454 +#: lib/bds/tui.ex:491 #: lib/bds/ui/registry.ex:38 #: lib/bds/ui/sidebar.ex:63 #: lib/bds/ui/sidebar.ex:115 @@ -2555,7 +2555,7 @@ msgstr "" #: lib/bds/desktop/shell_live/tags_editor.ex:222 #: lib/bds/desktop/shell_live/tags_editor.ex:253 #: lib/bds/desktop/shell_live/tags_editor_html/tags_editor.html.heex:11 -#: lib/bds/tui.ex:455 +#: lib/bds/tui.ex:492 #: lib/bds/ui/registry.ex:54 #: lib/bds/ui/registry.ex:103 #: lib/bds/ui/sidebar.ex:289 @@ -2611,7 +2611,7 @@ msgstr "" #: lib/bds/desktop/shell_live/template_editor.ex:171 #: lib/bds/desktop/shell_live/template_editor.ex:176 #: lib/bds/desktop/shell_live/template_editor.ex:191 -#: lib/bds/tui.ex:453 +#: lib/bds/tui.ex:490 #: lib/bds/ui/registry.ex:46 #: lib/bds/ui/sidebar.ex:71 #: lib/bds/ui/sidebar.ex:122 @@ -3626,92 +3626,87 @@ msgstr "" msgid "The endpoint returned no models. You can still type a model name manually." msgstr "" -#: lib/bds/tui.ex:538 +#: lib/bds/tui.ex:576 #, elixir-autogen, elixir-format msgid "AI is unavailable in airplane mode without a local endpoint." msgstr "" -#: lib/bds/tui.ex:584 +#: lib/bds/tui.ex:622 #, elixir-autogen, elixir-format msgid "Could not load this file." msgstr "" -#: lib/bds/tui.ex:111 +#: lib/bds/tui.ex:123 #, elixir-autogen, elixir-format msgid "Editing this item is not available in the terminal UI yet." msgstr "" -#: lib/bds/tui.ex:206 +#: lib/bds/tui.ex:227 #, elixir-autogen, elixir-format msgid "No suggestions returned." msgstr "" -#: lib/bds/tui.ex:581 +#: lib/bds/tui.ex:619 #, elixir-autogen, elixir-format msgid "Only images can be previewed." msgstr "" -#: lib/bds/tui.ex:462 +#: lib/bds/tui.ex:499 #, elixir-autogen, elixir-format msgid "Post not found." msgstr "" -#: lib/bds/tui.ex:282 +#: lib/bds/tui.ex:303 #, elixir-autogen, elixir-format msgid "Press enter to preview %{name}." msgstr "" -#: lib/bds/tui.ex:508 +#: lib/bds/tui.ex:546 #, elixir-autogen, elixir-format msgid "Published." msgstr "" -#: lib/bds/tui.ex:524 +#: lib/bds/tui.ex:562 #, elixir-autogen, elixir-format msgid "Save before switching languages." msgstr "" -#: lib/bds/tui.ex:509 +#: lib/bds/tui.ex:547 #, elixir-autogen, elixir-format msgid "Saved." msgstr "" -#: lib/bds/tui.ex:285 +#: lib/bds/tui.ex:306 #, elixir-autogen, elixir-format msgid "Select an entry and press enter to open it." msgstr "" -#: lib/bds/tui.ex:203 +#: lib/bds/tui.ex:224 #, elixir-autogen, elixir-format msgid "Suggestions applied." msgstr "" -#: lib/bds/tui.ex:297 +#: lib/bds/tui.ex:318 #, elixir-autogen, elixir-format msgid "Title (ctrl+t to edit)" msgstr "" -#: lib/bds/tui.ex:296 +#: lib/bds/tui.ex:317 #, elixir-autogen, elixir-format msgid "Title (editing — enter to confirm)" msgstr "" -#: lib/bds/tui.ex:328 +#: lib/bds/tui.ex:365 #, elixir-autogen, elixir-format msgid "Working…" msgstr "" -#: lib/bds/tui.ex:364 -#, elixir-autogen, elixir-format -msgid "ctrl+s save · ctrl+p publish · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" -msgstr "" - -#: lib/bds/tui.ex:357 +#: lib/bds/tui.ex:394 #, elixir-autogen, elixir-format msgid "enter open · n new post · 1-5 views · r refresh · ctrl+q quit" msgstr "" -#: lib/bds/tui.ex:349 +#: lib/bds/tui.ex:386 #, elixir-autogen, elixir-format msgid "esc to close" msgstr "" @@ -3747,3 +3742,13 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Use the form user@host or user@host:port." msgstr "" + +#: lib/bds/tui.ex:337 +#, elixir-autogen, elixir-format +msgid "Preview (ctrl+e to edit)" +msgstr "" + +#: lib/bds/tui.ex:401 +#, elixir-autogen, elixir-format +msgid "ctrl+s save · ctrl+p publish · ctrl+e preview · ctrl+t title · ctrl+l language · ctrl+g AI · esc back" +msgstr "" diff --git a/specs/tui.allium b/specs/tui.allium index 58ca55e..3604726 100644 --- a/specs/tui.allium +++ b/specs/tui.allium @@ -46,6 +46,14 @@ rule SaveAndPublish { ensures: PostPersisted() } +rule WrappedPreview { + when: TuiKeyPressed(code: "e", modifiers: "ctrl") + -- The editing textarea cannot soft-wrap (upstream ratatui-textarea + -- limitation), so ctrl+e toggles a read-only word-wrapped Markdown + -- preview of the current draft; keys in preview never edit content. + ensures: PreviewToggled() +} + rule AiQuickAction { when: TuiKeyPressed(code: "g", modifiers: "ctrl") -- One-shot AI post analysis (title/excerpt suggestions). Gated by diff --git a/test/bds/tui_test.exs b/test/bds/tui_test.exs index 00409f3..fb9d608 100644 --- a/test/bds/tui_test.exs +++ b/test/bds/tui_test.exs @@ -109,6 +109,37 @@ defmodule BDS.TUITest do assert state.focus == :sidebar end + test "ctrl+e toggles a word-wrapped preview of the draft", %{post: post} do + long_line = String.duplicate("lorem ipsum dolor sit amet ", 8) <> "FINALWORD" + {:ok, _} = BDS.Posts.update_post(post.id, %{content: long_line}) + + state = mount!() |> press("enter") |> press("e", ["ctrl"]) + assert state.editor.preview? + + # The textarea cannot soft-wrap, so the tail of a long line is off-screen + # there; the preview renders through the Markdown widget, which wraps. + assert screen_text(state, 80, 32) =~ "FINALWORD" + + state = press(state, "e", ["ctrl"]) + refute state.editor.preview? + end + + test "keys in preview mode do not edit the content" do + state = mount!() |> press("enter") |> press("e", ["ctrl"]) + before = ExRatatui.textarea_get_value(state.editor.textarea) + + state = press(state, "x") + assert ExRatatui.textarea_get_value(state.editor.textarea) == before + refute state.editor.dirty + end + + test "esc in preview returns to editing, not to the sidebar" do + state = mount!() |> press("enter") |> press("e", ["ctrl"]) |> press("esc") + + refute state.editor.preview? + assert state.focus == :editor + end + test "entity_changed refreshes the sidebar", %{project: project} do state = mount!()