Main gave every class member a reflect type and page item handles a revert
count. The type classes now declare a type for each member, their members
that are not available yet use the unavailable form, TextFrame takes main's
contentVariable, and a text range looks its frame up at the document's
current revert count.
Review fixes:
- A text range length that ends inside a surrogate pair moves its end out
to the end of the character.
- textFrames.removeAll() refuses type on a locked artboard, as
pageItems.removeAll() does.
- Joining a story's text across its frames counts toward the run's data
limit.
- A test shows a script that catches a refused link goes on with the links
unchanged.
Assigning a DocumentPreset setting stored any value until the run ended,
and the value was checked only when addDocument read it. A script could
keep gigabytes of strings in presets that no addDocument would accept.
The setter now checks the value before storing it: a value of the
setting's enumeration, a finite number, a title of at most 4096 bytes,
true or false for documentBleedLink, or four finite numbers for
documentBleedOffsetRect. undefined unsets any setting, and the three
settings addDocument does not apply yet also take null. A value of
another kind throws a TypeError, a longer title throws a RangeError, and
the setting keeps its old value. addDocument still checks the ranges.
The indexer hands a key that is the text of a number to the collection as
a number, so pageItems["-1"] and documents["1.5"] read as positions and gave
undefined, and "-1" in pageItems was false, even when getByName("-1") found
the object. pageItems and documents now take only array indices as
positions and look up any other number by its text as a name, giving
undefined when nothing has it. index(key) still takes a number as a
position.
The global `documents` has only a getter. The docs and the module and
test comments said only that assigning it keeps its value. They now say
that the assignment is ignored outside strict mode and throws a
TypeError in strict mode code or with `#strict on`, and the test also
checks the `#strict on` case.
A script's documents[0] was the first tab, not the active document, so
scripts that read app.documents[0] as the document in front acted on
another one. The scripting guide says documents[0] is always the active
document:
https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/
Each open document now records when it last became the current one.
documents lists the current document first and then the others from the
one current most recently to the one current longest ago (VectorCraft's
own rule). documents["name"] and getByName search in the same order. A
change a script makes to a document in the back switches to it and back,
and that switch no longer moves the document in the list.
Three tests that read documents[0] as the first tab with two documents
open now read documents[1].