readest/apps/readest-app/src-tauri/gen
Kel 5da26ee82a
Import pasted text into the library (#6992)
* feat(library): import pasted text from Add menu

Add a titled text editor with a user-initiated clipboard read and manual paste fallback. Import the generated TXT through the existing library path and retain the draft on failure.

Baseline: the Add-menu regression failed on unchanged upstream because From Pasted Text was absent; the failed-import regression failed before the draft-retention fix. Verified: 15 focused tests, lint/type checking, changed-file Biome, diff check, production web build, and Chromium desktop/narrow/e-ink import checks. Full suite: 13,980 passed, 16 skipped, 2 failures in unchanged tts-paragraph-boundary.test.ts.

Reported by sojudu on GitHub. Fixes #6747.

* fix(library): rework the pasted-text dialog to the design system (#6747)

The dialog now opens with a one-line description (DESIGN.md 2.9), puts
Paste beside the Text label as a flat action, keeps the error above the
action row, and uses ghost Cancel + btn-contrast Import like Import Web
Novel. The book title is optional: a blank title falls back to the
text's first line (shown as the placeholder), so 40 pasted articles
don't all import as "Pasted Text". "From Pasted Text" moves below
"From Directory" so the local entries stay together.

Title-to-filename handling moves to createTextBookFile in utils/txt so
the iOS share path can use it too. "Briefing: today" becomes
"Briefing - today" instead of "Briefing- today".

Verified: text-book-file.test.ts and the new placeholder/first-line
dialog tests fail without the change (createTextBookFile is not a
function; placeholder expected 'Morning briefing'); all pass with it.
On the iOS 26.3 simulator (debug build): Add menu -> From Pasted Text,
Paste (iOS paste prompt) filled the text, the title placeholder showed
the first line, Import added the book. Checked light and dark mode;
e-ink mode was not checked on iOS.

Reported by emceesenior-code on GitHub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(ios): accept shared text in the share sheet (#6747)

Readest didn't appear in the iOS share sheet for text (an AI reply, a
selection): the extension only activated for web URLs and pages. It
can't use NSExtensionActivationSupportsText, because a .txt shared from
Files is public.plain-text too and that hung the share sheet. On the
iOS 26.3 simulator a Files .txt carries public.plain-text AND
public.file-url, while shared text carries public.plain-text alone, so
the rule is now a predicate that accepts web URLs (not file URLs),
Safari pages (the JS preprocessing plist) and plain text that is not a
file.

The extension previews the text (first line as title), writes it to
App Group SharedClips/ as .txt and queues a textFile save. The host
reads it with the existing read_share_clip_html command and imports it
as a TXT book through the shared ingest path, keeping the picked
group. Text counts as a URL only when it is nothing but one.

The htmlFile ingress test now gives convertToEpubWithWorker a book; it
returned undefined before, so the hook fell back to clip_url and the
"not called" check passed only by microtask timing.

Verified on the iOS 26.3 simulator (debug build): a Safari selection
shows Readest in the share sheet (it didn't before), Save opens
Readest and adds the text book; a Safari page share still captures the
DOM (htmlFile queued) and imports; a Files .txt share shows a single
Readest entry that goes through the document import and opens the
book. The new ingress test fails without the hook change (ingestFile
called 0 times) and the activation-rule tests fail on the old
project.yml.

Requested by sojudu on GitHub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(i18n): translate pasted and shared text strings

Extracted with i18n:extract; all 34 locales filled, none left untranslated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(library): keep the pasted-text draft through a slow paste or dismiss

From the CodeRabbit review on #6992:
- A clipboard read that resolves after the user typed, or after the dialog
  was reopened, no longer replaces the newer draft.
- Escape, the backdrop and swipe-to-dismiss do nothing while an import is
  running, so its completion can't close a reopened dialog.

Verified: import-pasted-text-dialog.test.tsx. Without the fix, "keeps text
typed while the clipboard read was pending" fails (textarea value is the
clipboard text) and "cannot be dismissed while an import is running" fails
(onClose called once).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Kel <1563599+kelvinalfaro@users.noreply.github.com>
Co-authored-by: Huang Xin <chrox.huang@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:13:47 +02:00
..
android/app feat(library): add .rbooks collection bundle export and import (#6945) 2026-10-23 07:49:55 +02:00
apple Import pasted text into the library (#6992) 2026-10-23 18:13:47 +02:00