From e0f2394fd0816ef03bf4b928ab9fa5a18c32ffda Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 14 Jul 2026 04:10:01 +0200 Subject: Add a toggleable live preview panel to both editors Hidden by default, shares horizontal space with the body editor once opened rather than a separate section, and only requests the iframe's src on first toggle -- no preview traffic at all until someone actually wants to see it. Refreshes automatically on every successful autosave; a separate force-render button re-attempts a save-and- refresh cycle immediately, for when the normal 7-second cycle has been interrupted (a lock-lost error, a transient failure) and waiting for the next tick isn't good enough. --- app/views/nodes/edit.html.erb | 21 +++++++++++++++++++-- app/views/page_translations/edit.html.erb | 24 ++++++++++++++++++++---- 2 files changed, 39 insertions(+), 6 deletions(-) (limited to 'app/views') diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index e0e51d8..9506995 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb @@ -116,10 +116,27 @@
<%= d.text_area :abstract %>
Body
-
<%= d.text_area :body, :class => 'with_editor' %>
+
+ + +
+ +
+
+
<%= d.text_area :body, :class => 'with_editor' %>
+
+ +
+ <% end %> -
+
<%= f.submit 'Save Draft' %> <%= f.submit 'Save + Unlock + Exit' %>
diff --git a/app/views/page_translations/edit.html.erb b/app/views/page_translations/edit.html.erb index 981fb74..0f64d40 100644 --- a/app/views/page_translations/edit.html.erb +++ b/app/views/page_translations/edit.html.erb @@ -20,8 +20,8 @@
- <%= form_with url: node_translation_path(@node, @locale), method: :patch, local: true, id: "translation_edit_form", - data: { autosave_url: autosave_node_translation_path(@node, @locale), show_url: node_path(@node) } do |f| %> + <%= form_with url: node_translation_path(@node, @locale), method: :patch, local: true, id: "translation_edit_form", + data: { autosave_url: autosave_node_translation_path(@node, @locale), show_url: node_path(@node) } do |f| %>
Title
@@ -34,8 +34,24 @@
Body
-
- <%= text_area_tag "page[body]", @translation&.body, :class => 'with_editor' %> +
+ + +
+ +
+
+
+ <%= text_area_tag "page[body]", @translation&.body, :class => 'with_editor' %> +
+
+
<% end %> -- cgit v1.3