From acc433805e5e05e436afd45fb35a4bb70feb6ade Mon Sep 17 00:00:00 2001 From: Local Dev Date: Wed, 23 Sep 2026 00:51:45 +0200 Subject: [PATCH] feat(pdf-editor): the dock opens the editor, and the editor offers more than one way in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clicking the dock raised a native file browser, which was the right answer while the editor had exactly one thing to offer an empty tab. It is the wrong answer now: a file browser can only ask which PDF, and the answer is sometimes none of them. So the dock opens the editor, and the empty editor says what it can do. The drop zone stays, and learns to read what it is given — pictures become pages, several PDFs become one document. Beside it sit the three ways in as buttons. Not included: compress, which cannot be done honestly without re-encoding the images, and split, which is the page rail plus Save a copy. A document built from pictures or joins has never been on disk, so it is marked unsaved from the moment it opens — otherwise closing the tab would bin it without asking. An empty editor also stops claiming to hold a file called document.pdf. --- bundled-addons/pdf-editor/addon.json | 6 +- bundled-addons/pdf-editor/editor.css | 19 +++- bundled-addons/pdf-editor/editor.html | 55 +++++++++- bundled-addons/pdf-editor/editor.js | 118 +++++++++++++++++++-- bundled-addons/pdf-editor/index.js | 52 ++------- bundled-addons/pdf-editor/lib/create.js | 133 ++++++++++++++++++++++++ bundled-addons/pdf-editor/lib/model.js | 4 + 7 files changed, 333 insertions(+), 54 deletions(-) create mode 100644 bundled-addons/pdf-editor/lib/create.js diff --git a/bundled-addons/pdf-editor/addon.json b/bundled-addons/pdf-editor/addon.json index af2dbb9..8b88ad5 100644 --- a/bundled-addons/pdf-editor/addon.json +++ b/bundled-addons/pdf-editor/addon.json @@ -1,8 +1,8 @@ { "id": "pdf-editor", "name": "PDF Editor", - "version": "0.3.1", - "description": "Open a PDF in a full tab: read it, mark it up with highlight, underline, strike-through, pen, shapes, arrows, text and a drawn signature, then move, resize, restyle or delete anything you placed. Reorder, rotate or drop pages, fill in form fields, redact for real, and save a new copy. Marks are written into the saved file as real PDF content. The original is never touched.", + "version": "0.4.0", + "description": "Open a PDF in a full tab: read it, mark it up with highlight, underline, strike-through, pen, shapes, arrows, text and a drawn signature, then move, resize, restyle or delete anything you placed. Reorder, rotate or drop pages, fill in form fields, redact for real, and save a new copy. Build a PDF from pictures, one page each, or join several PDFs into one. Marks are written into the saved file as real PDF content. The original is never touched.", "author": "Silent Mode", "icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYgMmg4bDYgNnYxMmEyIDIgMCAwIDEtMiAySDZhMiAyIDAgMCAxLTItMlY0YTIgMiAwIDAgMSAyLTJ6IiBmaWxsPSIjZGMyNjI2Ii8+PHBhdGggZD0iTTE0IDJ2Nmg2eiIgZmlsbD0iIzk5MWIxYiIvPjx0ZXh0IHg9IjEyIiB5PSIxNyIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9InN5c3RlbS11aSwtYXBwbGUtc3lzdGVtLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iNS41IiBmb250LXdlaWdodD0iODAwIiBmaWxsPSIjZmZmIj5QREY8L3RleHQ+PC9zdmc+", "main": "index.js", @@ -11,7 +11,7 @@ "title": "PDF Editor", "icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYgMmg4bDYgNnYxMmEyIDIgMCAwIDEtMiAySDZhMiAyIDAgMCAxLTItMlY0YTIgMiAwIDAgMSAyLTJ6IiBmaWxsPSIjZGMyNjI2Ii8+PHBhdGggZD0iTTE0IDJ2Nmg2eiIgZmlsbD0iIzk5MWIxYiIvPjx0ZXh0IHg9IjEyIiB5PSIxNyIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9InN5c3RlbS11aSwtYXBwbGUtc3lzdGVtLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iNS41IiBmb250LXdlaWdodD0iODAwIiBmaWxsPSIjZmZmIj5QREY8L3RleHQ+PC9zdmc+", "items": [ - { "id": "open", "label": "Open a PDF…" } + { "id": "open", "label": "Open the editor" } ] }, "context-menu-items": [ diff --git a/bundled-addons/pdf-editor/editor.css b/bundled-addons/pdf-editor/editor.css index 79e1e57..aee789a 100644 --- a/bundled-addons/pdf-editor/editor.css +++ b/bundled-addons/pdf-editor/editor.css @@ -139,7 +139,24 @@ body[data-dragover="1"] .dropzone { display: flex; pointer-events: none; body[data-dragover="1"] .dz-inner { border-color: rgb(from var(--acid) r g b / .8); color: var(--ink); } .dz-inner svg { width: 48px; height: 48px; margin-bottom: 10px; } .dz-title { font-size: 15px; color: var(--ink); font-weight: 600; } -.dz-sub { margin-top: 5px; } +.dz-sub { margin-top: 5px; max-width: 42ch; margin-left: auto; margin-right: auto; } + +/* Start-screen tiles. Hidden while a drag is in flight: during a drop the + drop zone is the whole target, and a row of buttons under the cursor + reads as somewhere to aim, which it is not. */ +.dz-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: center; + flex-wrap: wrap; } +body[data-dragover="1"] .dz-actions { visibility: hidden; } +.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; + width: 176px; padding: 13px 14px; text-align: left; cursor: pointer; + background: var(--bg); color: var(--ink); border: 1px solid var(--line); + border-radius: 10px; font: inherit; } +.tile:hover { border-color: rgb(from var(--acid) r g b / .55); + background: rgb(from var(--acid) r g b / .06); } +.tile:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; } +.tile svg { width: 22px; height: 22px; margin: 0 0 5px; color: var(--acid); } +.tile-t { font-weight: 600; font-size: 13px; } +.tile-s { font-size: 11.5px; color: var(--dim); line-height: 1.35; } .linkish { background: none; border: none; padding: 0; font: inherit; cursor: pointer; color: var(--acid); text-decoration: underline; } diff --git a/bundled-addons/pdf-editor/editor.html b/bundled-addons/pdf-editor/editor.html index 3ca06fc..dafbde7 100644 --- a/bundled-addons/pdf-editor/editor.html +++ b/bundled-addons/pdf-editor/editor.html @@ -141,7 +141,31 @@
Drop a PDF here
-
or
+
Drop pictures instead and they become the pages. Drop several PDFs and they join up.
+
+ + + +
@@ -232,6 +256,33 @@ + +