Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ module.exports = {
title: "BaseNode",
path: "references/document-sandbox/document-apis/classes/BaseNode.md",
},
{
title: "BitmapImage",
path: "references/document-sandbox/document-apis/classes/BitmapImage.md",
},
{
title: "ColorUtils",
path: "references/document-sandbox/document-apis/classes/ColorUtils.md",
Expand All @@ -166,10 +170,22 @@ module.exports = {
title: "EllipseNode",
path: "references/document-sandbox/document-apis/classes/EllipseNode.md",
},
{
title: "ExpressContext",
path: "references/document-sandbox/document-apis/classes/ExpressContext.md",
},
{
title: "ExpressEditor",
path: "references/document-sandbox/document-apis/classes/ExpressEditor.md",
},
{
title: "ExpressRootNode",
path: "references/document-sandbox/document-apis/classes/ExpressRootNode.md",
},
{
title: "ExpressViewport",
path: "references/document-sandbox/document-apis/classes/ExpressViewport.md",
},
{
title: "FillableNode",
path: "references/document-sandbox/document-apis/classes/FillableNode.md",
Expand Down Expand Up @@ -242,6 +258,10 @@ module.exports = {
title: "SolidColorShapeNode",
path: "references/document-sandbox/document-apis/classes/SolidColorShapeNode.md",
},
{
title: "StandaloneTextContentModel",
path: "references/document-sandbox/document-apis/classes/StandaloneTextContentModel.md",
},
{
title: "StandaloneTextNode",
path: "references/document-sandbox/document-apis/classes/StandaloneTextNode.md",
Expand All @@ -262,6 +282,14 @@ module.exports = {
title: "TextNode",
path: "references/document-sandbox/document-apis/classes/TextNode.md",
},
{
title: "TextNodeContentModel",
path: "references/document-sandbox/document-apis/classes/TextNodeContentModel.md",
},
{
title: "ThreadedTextContentModel",
path: "references/document-sandbox/document-apis/classes/ThreadedTextContentModel.md",
},
{
title: "ThreadedTextNode",
path: "references/document-sandbox/document-apis/classes/ThreadedTextNode.md",
Expand All @@ -278,10 +306,6 @@ module.exports = {
title: "UnknownNode",
path: "references/document-sandbox/document-apis/classes/UnknownNode.md",
},
{
title: "Viewport",
path: "references/document-sandbox/document-apis/classes/Viewport.md",
},
{
title: "VisualNode",
path: "references/document-sandbox/document-apis/classes/VisualNode.md",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,19 @@ Original width of the bitmap in pixels.
#### Returns

`number`

## Methods

### data()

• **data**(): `Promise`<`Blob`\>

<InlineAlert slots="text" variant="warning"/>

**IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.

Fetches the bitmap data as a Blob. This will wait for the bitmap to be available if necessary.

#### Returns

`Promise`<`Blob`\>
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@

Contains the user's current selection state, indicating the content they are focused on.

## Accessors

### currentPage

• `get` **currentPage**(): [`PageNode`](PageNode.md)

#### Returns

[`PageNode`](PageNode.md)
## Extended by

The currently viewed page.
To change the current page, call [Viewport.bringIntoView](Viewport.md#bringintoview) with an artboard or other content on that page.
- [`ExpressContext`](ExpressContext.md)

---
## Accessors

### hasSelection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

Entry point for APIs that read or modify the document's content.

## Extended by

- [`ExpressEditor`](ExpressEditor.md)

## Accessors

### context
Expand All @@ -20,11 +24,11 @@ User's current selection context

### documentRoot

• `get` **documentRoot**(): [`ExpressRootNode`](ExpressRootNode.md)
• `get` **documentRoot**(): [`BaseNode`](BaseNode.md)

#### Returns

[`ExpressRootNode`](ExpressRootNode.md)
[`BaseNode`](BaseNode.md)

the root of the document.

Expand Down Expand Up @@ -69,7 +73,7 @@ This local client will act as having unsaved changes until the upload has finish

#### Parameters

• **bitmapData**: `BitmapImage`
• **bitmapData**: [`BitmapImage`](BitmapImage.md)

BitmapImage resource (e.g. returned from [loadBitmapImage](Editor.md#loadbitmapimage)).

Expand Down Expand Up @@ -187,7 +191,7 @@ insertion parent. Recommend using `setPositionInParent` over `translation` to se

### loadBitmapImage()

• **loadBitmapImage**(`bitmapData`): `Promise`<`BitmapImage`\>
• **loadBitmapImage**(`bitmapData`): `Promise`<[`BitmapImage`](BitmapImage.md)\>

Creates a bitmap image resource in the document, which can be displayed in the scenegraph by passing it to [createImageContainer](Editor.md#createimagecontainer)
to create a MediaContainerNode. The same BitmapImage can be used to create multiple MediaContainerNodes.
Expand All @@ -207,7 +211,7 @@ Encoded image data in PNG or JPEG format.

#### Returns

`Promise`<`BitmapImage`\>
`Promise`<[`BitmapImage`](BitmapImage.md)\>

---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
[@express-document-sdk](../overview.md) / ExpressContext

# Class: ExpressContext

Contains The Express specific APIs related to the current selection state.

## Extends

- [`Context`](Context.md)

## Accessors

### currentPage

• `get` **currentPage**(): [`PageNode`](PageNode.md)

#### Returns

[`PageNode`](PageNode.md)

The currently viewed page.
To change the current page, call [ExpressViewport.bringIntoView](ExpressViewport.md#bringintoview) with an artboard or other content on that page.

---

### hasSelection

• `get` **hasSelection**(): `boolean`

#### Returns

`boolean`

false if the current editable selection does not contain any nodes, otherwise true.

---

### insertionParent

• `get` **insertionParent**(): [`ContainerNode`](../interfaces/ContainerNode.md)

#### Returns

[`ContainerNode`](../interfaces/ContainerNode.md)

the preferred parent to insert newly added content into (i.e., the location content would get inserted if a
user were to Paste or use the Shapes panel in the UI). This will vary depending on the user's current selection and
other UI state.

---

### selection

• `get` **selection**(): readonly [`Node`](Node.md)[]

• `set` **selection**(`nodes`): `void`

Sets the current selection to an array of [Node](Node.md).
Accepts a single node as a shortcut for a length-1 array `[node]` or
`undefined` as a shortcut for `[]`, which clears the selection.

Only node(s) that meet the following criteria can be selected:

- Nodes must be within the current artboard (nodes outside the active artboard are filtered out).
- A node cannot be selected if its ancestor is also selected (descendants are filtered out).
- Locked nodes are filtered out (but will still be included in selectionIncludingNonEditable).

#### Parameters

• **nodes**: `undefined` \| [`Node`](Node.md) \| readonly [`Node`](Node.md)[]

#### Returns

readonly [`Node`](Node.md)[]

the current selection. Nodes that are locked or otherwise non-editable are never included in the regular
selection (see [selectionIncludingNonEditable](Context.md#selectionincludingnoneditable) to get any locked nodes the user may have clicked).

---

### selectionIncludingNonEditable

• `get` **selectionIncludingNonEditable**(): readonly [`Node`](Node.md)[]

#### Returns

readonly [`Node`](Node.md)[]

the current selection _and_ any locked nodes the user has attempted to select at the same time. This can
happen for example if the user clicks on a locked node or if the user drags a selection marquee that overlaps
locked nodes in addition to regular unlocked nodes.

## Methods

### off()

• **off**(`eventName`, `handlerId`): `void`

Unregisters handlers for editor events like selection change.

#### Parameters

• **eventName**: [`selectionChange`](../enumerations/EditorEvent.md#selectionchange)

an editor event name.

• **handlerId**: `string`

a unique ID returned by `editor.context.on` API.
Callback that was previously registered will be removed and will no more be invoked when the event occurs.

#### Returns

`void`

#### Inherited from

[`Context`](Context.md).[`off`](Context.md#off)

---

### on()

• **on**(`eventName`, `callback`): `string`

Registers a handler for editor events such as selection change.
The registered callback will be invoked when the specified event occurs.
<InlineAlert slots="text" variant="info"/>
Note: Do not attempt to make changes to the document in response to a selection change callback because it may destabilize the application.

#### Parameters

• **eventName**: [`selectionChange`](../enumerations/EditorEvent.md#selectionchange)

an editor event name.

• **callback**: [`EditorEventHandler`](../type-aliases/EditorEventHandler.md)

a callback to be registered for an editor event.

#### Returns

`string`

a unique ID for the registered event handler.

#### Inherited from

[`Context`](Context.md).[`on`](Context.md#on)
Loading
Loading