From 797fb32a37d168f02920e7e32ee59caad825f20a Mon Sep 17 00:00:00 2001 From: Marcelo Paiva Date: Wed, 25 Feb 2026 12:49:38 -0500 Subject: [PATCH] Add PDF/Text tab switcher to template builder for sighted users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create pdf_text_to_html.js: JS port of the Ruby heuristic parser (ALL_CAPS→h2, numbered headings→h3, bullets→ul/li, body→p dir=auto) - Add pdf_view, text_view, document_view_options keys to i18n.js (en) - Update document.vue: tab switcher shown when all pages have extracted text; PDF View renders the existing page images; Text View renders heuristic HTML in a prose container with per-page sections - ArrowLeft/ArrowRight keyboard navigation between tabs with focus management - Tab is hidden entirely for scanned/image-only PDFs (hasFullText gate) Co-Authored-By: Claude Sonnet 4.6 --- app/javascript/template_builder/document.vue | 147 +++++++++++++----- app/javascript/template_builder/i18n.js | 3 + .../template_builder/pdf_text_to_html.js | 53 +++++++ 3 files changed, 163 insertions(+), 40 deletions(-) create mode 100644 app/javascript/template_builder/pdf_text_to_html.js diff --git a/app/javascript/template_builder/document.vue b/app/javascript/template_builder/document.vue index 022976c5..fd82799e 100644 --- a/app/javascript/template_builder/document.vue +++ b/app/javascript/template_builder/document.vue @@ -1,55 +1,102 @@