Class: StandaloneTextContentModel
StandaloneTextContentModel represents a complete piece of text content contained within a single StandaloneTextNode.
Extends
Constructors
Constructor
new StandaloneTextContentModel(): StandaloneTextContentModel;
Returns
StandaloneTextContentModel
Inherited from
TextNodeContentModel.constructor
Accessors
allTextNodes
Get Signature
get allTextNodes(): Readonly<Iterable<StandaloneTextNode>>;
Get ordered list of all TextNodes that display this text content in the scenegraph. This might be a single StandaloneTextNode or a list of one or more ThreadedTextNodes. In the case of threaded text, the text content starts in the first ThreadedTextNode "frame", and then flows into the second node once it has filled the first one. The ending of the text content may not be visible at all, if the last "frame" is not large enough to accommodate it.
All linked ThreadedTextNodes that share a single TextContentModel must remain together within the same artboard.
Returns
Readonly<Iterable<StandaloneTextNode>>
Overrides
TextNodeContentModel.allTextNodes
id
Get Signature
get id(): string;
Experimental
data-slots=text
data-variant=warning
experimentalApis flag to true in the requirements section of the manifest.json.A unique identifier for this node that stays the same when the file is closed & reopened, or if the node is moved to a different part of the document.
To determine if two TextNodes are connected to the same TextContentModel, check if both models have the same id. Comparing two models using === will always fail.
Returns
string
Inherited from
text
Get Signature
get text(): string;
The complete text string, which may span multiple ThreadedTextNode "frames" in the scenegraph.
Throws
The setter throws if the existing text contains fonts unavailable to the current user. See hasUnavailableFonts.
Returns
string
Set Signature
set text(textContent): void;
Parameters
textContentstringReturns
void
Inherited from
characterStyleRanges
Get Signature
get characterStyleRanges(): readonly CharacterStylesRange[];
The character styles that are applied to different ranges of this text content. Each range starts immediately after the previous one: they are always contiguous, and never overlap.
When setting character styles, any style properties that are not provided are reset to their defaults (contrast to applyCharacterStyles which preserves the text's existing styles for any fields not specified). If the ranges do not cover the full length of the text, the last range is extended to cover all the remaining text. When getting styles, all fields are always provided.
Note: existing fonts used in the document, returned by this getter, are not guaranteed to be ones the current user has rights to edit with. The setter only accepts the AvailableFont type which has been verified to be usable.
Returns
readonly CharacterStylesRange[]
Set Signature
set characterStyleRanges(styles): void;
Parameters
stylesCharacterStylesRangeInput[]Returns
void
Inherited from
TextNodeContentModel.characterStyleRanges
paragraphStyleRanges
Get Signature
get paragraphStyleRanges(): readonly ParagraphStylesRange[];
The styles applied to different paragraphs of this text content.
Returns
readonly ParagraphStylesRange[]
Set Signature
set paragraphStyleRanges(styles): void;
Apply styles to different paragraphs of this text content. Any style properties that are not provided are reset to their defaults. When getting styles, all properties are always provided.
Paragraphs are separated by newline characters (\n). The ranges specified here should align with those boundaries. If multiple ranges provided overlap a single paragraph, the first one to overlap is applied to the entire paragraph.
Throws
if applying an ordered-list style when the text contains fonts that are unavailable to the current user.
Parameters
stylesParagraphStylesRangeInput[]Returns
void
Inherited from
TextNodeContentModel.paragraphStyleRanges
Methods
appendText()
appendText(newText): void;
Experimental
data-slots=text
data-variant=warning
experimentalApis flag to true in the requirements section of the manifest.json.Appends a new text string to the end of the text content.
Parameters
newTextstringReturns
void
Throws
if the existing text contains fonts unavailable to the current user. See hasUnavailableFonts.
Inherited from
TextNodeContentModel.appendText
insertText()
insertText(
newText,
index,
style?): void;
Experimental
data-slots=text
data-variant=warning
experimentalApis flag to true in the requirements section of the manifest.json.Inserts a new text string into the text content at the specified index.
Parameters
newTextstringindexnumberstyle?beforeInsertionPoint.Returns
void
Throws
if the existing text contains fonts unavailable to the current user. See hasUnavailableFonts.
Inherited from
TextNodeContentModel.insertText
replaceText()
replaceText(
newText,
replaceRange,
style?): void;
Experimental
data-slots=text
data-variant=warning
experimentalApis flag to true in the requirements section of the manifest.json.Replaces a range of text with a new text string.
Parameters
newTextstringstyle?firstReplacedCharacter.Returns
void
Throws
if the existing text contains fonts unavailable to the current user. See hasUnavailableFonts.
Inherited from
TextNodeContentModel.replaceText
deleteText()
deleteText(range): void;
Experimental
data-slots=text
data-variant=warning
experimentalApis flag to true in the requirements section of the manifest.json.Deletes a range of text from the content.
Parameters
Returns
void
Throws
if the existing text contains fonts unavailable to the current user. See hasUnavailableFonts.
Inherited from
TextNodeContentModel.deleteText
applyCharacterStyles()
applyCharacterStyles(styles, range?): void;
Apply one or more styles to the characters in the given range, leaving any style properties that were not specified unchanged. Does not modify any styles in the text outside this range. Contrast to the characterStyleRanges setter, which specifies new style range(s) for the entire text at once, and resets any unspecified properties back to default styles.
Explicitly specifying link: "" will remove any hyperlinks present in the existing text. If the link style property is not specified at all, existing links are preserved.
Parameters
range?Returns
void
Inherited from
TextNodeContentModel.applyCharacterStyles
applyParagraphStyles()
applyParagraphStyles(styles, range?): void;
Apply one or more styles to the paragraphs in the given range, leaving any style properties that were not specified unchanged. Does not modify any styles in the text outside this range. Contrast to the paragraphStyleRanges setter, which specifies new style range(s) for the entire text at once, and resets any unspecified properties back to default styles.
Parameters
range?Returns
void
Throws
if applying an ordered-list style when the text contains fonts that are unavailable to the current user.
Inherited from
TextNodeContentModel.applyParagraphStyles
hasUnavailableFonts()
hasUnavailableFonts(): boolean;
Experimental
data-slots=text
data-variant=warning
experimentalApis flag to true in the requirements section of the manifest.json.Returns true if this text contains any fonts unavailable to the current user. Currently, if any unavailable fonts are present, the text content cannot be modified and certain styling changes are limited as well. To remove these restrictions, you must modify the character styles to use only AvailableFonts.
Returns
boolean