Commit Graph
8 Commits
Author SHA1 Message Date
dotCooCoo 46c3e4bcff Scripts: text and thread tests read frames topmost first, as pageItems lists them 2026-11-26 00:43:17 -08:00
dotCooCoo e4992df1ef Merge feat/scripts-api-d4-text into feat/scripts-api-d4c-threads-stories 2026-11-26 00:06:20 -08:00
dotCooCoo 1a21617e73 Scripts: text ranges take a number as contents, a new length and paragraph attributes
- `contents` on a text frame or text range takes a number and writes it as
  `String(number)` gives it; other values still throw.
- Setting a text range's `length` moves its end and leaves the text as it
  is (https://ai-scripting.docsforadobe.dev/jsobjref/TextRange/ lists it as
  read/write). A value that is not a whole number from 0 to the units left
  in the frame throws. Each read of a member that gives a range gives a new
  object, so setting one range's length leaves the others alone.
- A text range has the paragraph attributes as well as the character
  attributes, so `range.justification` reads and sets the paragraphs the
  range touches.
- `characters`, `words` and `paragraphs` have `add(contents,
  relativeObject?, insertionLocation?)` and `addBefore(contents)`
  (https://ai-scripting.docsforadobe.dev/jsobjref/Words/), which insert the
  text as one `text.editRange` and give its range. An added word is kept
  apart from its neighbors by a space and an added paragraph by a
  paragraph break; an empty string runs no command.
- `app.textFonts.getByName` also finds a bundled face by its PostScript
  name.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-23 11:25:06 -08:00
dotCooCoo a5690d2d35 Scripts: stories of one thread share their text index, and a deleted story's missing members say Stale story
Stories read from different frames of one thread share one index of the
story's text while the document is unchanged, instead of each keeping its
own copy. A frame listed in two threads shares only with a story whose
frames match. Story.lines, insertionPoints, textRanges and textSelection
check the story first, so a story whose frame was deleted throws Stale
story.

The cross-document baseFrame test passes a rectangle of the other document
and checks the error and that the rectangle stays a path. docs/mcp.md no
longer says baseFrame and postFix throw, the text-frame entry in
docs/target-app-parity.md no longer lists stories and threading as missing,
and the M13 row in docs/roadmap.md lists text frames and stories.
2026-11-21 22:08:05 -08:00
dotCooCoo d82fe4e8d9 Scripts: nextFrame, previousFrame, story and document.stories for threaded type
Text frames get nextFrame, previousFrame and story, and documents get stories, a
Stories collection with one story for each thread and each type object in no
thread. Assigning nextFrame or previousFrame links the last frame of one story
to the first frame of another, and null breaks the link with each frame keeping
its text; loops, links to the frame itself or into the middle of a story, point
type, frames of another document and hidden or locked frames are refused with
nothing changed. A story of two or more frames reads and writes its text across
its frames in UTF-16 units, and areaText and pathText take baseFrame and
postFix to thread the new frame to an existing one.

The new command text.thread.setNeighbor {id, side, neighbor} links or breaks
by id without a selection, for MCP, the CLI and vc.run.
2026-11-21 18:54:45 -08:00
dotCooCoo b7893282ba Scripts: text ranges made before File > Revert go stale
A text range kept working after file.revert when the file read back held the same text, because the frame's record compared only the text. The record now keeps the document's revert count, and a range made before a revert throws Stale text range.
2026-11-21 17:28:30 -08:00
dotCooCoo c691279f72 Scripts: covered text ranges hold the new text, and text members report stale ranges
- An edit over the end of a text range takes that end to the end of the
  edit's new text, so a range the edit covers holds the new text instead
  of becoming empty.
- The edit record keeps the frame's last 100,000 edits and drops only the
  oldest one past that.
- A numeric leading set on characters with auto leading turns auto
  leading off even when it equals the auto value.
- typename of a stale text range, its collections and attribute objects
  throws Stale text range, as the other members do; TextFrames and
  TextFont check their document and run first.
- createOutline() gives null when the type has nothing to outline,
  instead of throwing after the command removed the frame.
- New frames, outlines and conversions read the new id from the
  command's JSON result, so ids above 2^53 stay exact.
- Character attribute reads look up only the first style of the range.
- The font assignment test picks a font that draws "abc".

Docs: docs/mcp.md, docs/gaps.md (G6).
2026-11-21 14:50:30 -08:00
dotCooCoo 7c9b2a85a2 Scripts: text frames, text ranges and fonts for scripts
document.textFrames lists the document's type and makes point type, area
type and type on a path. A TextFrame gives its kind, contents, text range,
characters, words and paragraphs, outlines, and point and area conversion.
A TextRange gives its contents, offsets, sub-collections, character
attributes (size, leading, tracking, baseline shift, scales, rotation,
underline, strikethrough, font) and paragraph attributes (alignment,
indents, space before and after). app.textFonts lists the fonts.

Offsets count UTF-16 code units. A range follows edits made through these
objects and throws Stale text range after the frame's text changes
another way. Each change runs an existing text command inside the run's
transaction, and a value a range already has runs no command.
2026-11-21 13:55:18 -08:00