textmode.export.js / TextmodeExportAPI
Interface: TextmodeExportAPI
Runtime export helpers that createExportPlugin attaches to the Textmodifier instance.
Properties
| Property | Type | Description |
|---|---|---|
exportOverlay | ExportOverlayController | Controller for managing the export overlay UI visibility at runtime. |
Methods
saveCanvas()
saveCanvas(options?): Promise<void>;Saves the current canvas content to an image file ('png' by default).
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | ImageExportOptions | Export options. |
Returns
Promise<void>
Example
await t.saveCanvas({ format: 'png', filename: 'frame-001' });copyCanvas()
copyCanvas(options?): Promise<void>;Copies the current canvas to the user's clipboard as an image.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | ImageExportOptions | Export options. |
Returns
Promise<void>
Example
await t.copyCanvas({ format: 'png' });saveSVG()
saveSVG(options?): void;Downloads the selected layer as an SVG file.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | SVGExportOptions | Export options. |
Returns
void
Example
t.saveSVG({ filename: 'poster', layer: t.layers.base, includeBackgroundRectangles: true });saveStrings()
saveStrings(options?): void;Downloads the selected layer's text content as a plain-text file.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | TXTExportOptions | Export options. |
Returns
void
Example
t.saveStrings({ filename: 'frame', layer: t.layers.base, preserveTrailingSpaces: true });toSVG()
toSVG(options?): string;Generates SVG markup for the selected layer.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | SVGExportOptions | Export options. |
Returns
string
The SVG content representing the artwork.
Example
const svg = t.toSVG({ layer: t.layers.base, drawMode: 'stroke', strokeWidth: 1.5 });toString()
toString(options?): string;Produces the selected layer's text content as a string.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | TXTExportOptions | Export options. |
Returns
string
The textual representation of the artwork.
Example
const text = t.toString({ layer: t.layers.base, preserveTrailingSpaces: false });toJSON()
toJSON(options?): TextmodeDocumentJSON;Produces the selected layer or layer stack as structured JSON data.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | JSONExportOptions | Export options. |
Returns
The JSON document representing the selected layer or layer stack.
Example
const layer = t.toJSON({ layer: t.layers.base, colorMode: 'hex', includeMetadata: true });
const stack = t.toJSON({ target: 'all' });toJSONString()
toJSONString(options?): string;Produces the selected layer or layer stack as a JSON string.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | JSONExportOptions | Export options. |
Returns
string
Serialized JSON string for the selected layer or layer stack.
Example
const json = t.toJSONString({ layer: t.layers.base, pretty: false, colorMode: 'hex' });
const stackJson = t.toJSONString({ target: 'all' });saveJSON()
saveJSON(options?): void;Downloads the selected layer or layer stack as a JSON file.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | JSONExportOptions | Export options. |
Returns
void
Example
t.saveJSON({ filename: 'frame', layer: t.layers.base, pretty: true });
t.saveJSON({ filename: 'stack', target: 'all' });saveGIF()
saveGIF(options?): Promise<void>;Records an animated GIF and saves it to disk.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | GIFExportOptions | Export options. |
Returns
Promise<void>
Example
await t.saveGIF({ frameCount: 120, frameRate: 30, filename: 'loop' });saveWEBM()
saveWEBM(options?): Promise<void>;Captures a WEBM video and saves it to disk.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | VideoExportOptions | Export options. |
Returns
Promise<void>
Example
await t.saveWEBM({ frameCount: 240, frameRate: 60, filename: 'capture' });