Skip to content

Commit 19f85da

Browse files
committed
Doc updates
- New Express classes ExpressContext, ExpressEditor, ExpressViewport - New Classes StandaloneTextContentModel, ThreadedTextContentModel - ImageRectangleNode.fetchBitmapImage() experimental API - BitmapImage.data() experimental API
1 parent a0fe074 commit 19f85da

18 files changed

+1336
-58
lines changed

gatsby-config.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ module.exports = {
146146
title: "BaseNode",
147147
path: "references/document-sandbox/document-apis/classes/BaseNode.md",
148148
},
149+
{
150+
title: "BitmapImage",
151+
path: "references/document-sandbox/document-apis/classes/BitmapImage.md",
152+
},
149153
{
150154
title: "ColorUtils",
151155
path: "references/document-sandbox/document-apis/classes/ColorUtils.md",
@@ -166,10 +170,22 @@ module.exports = {
166170
title: "EllipseNode",
167171
path: "references/document-sandbox/document-apis/classes/EllipseNode.md",
168172
},
173+
{
174+
title: "ExpressContext",
175+
path: "references/document-sandbox/document-apis/classes/ExpressContext.md",
176+
},
177+
{
178+
title: "ExpressEditor",
179+
path: "references/document-sandbox/document-apis/classes/ExpressEditor.md",
180+
},
169181
{
170182
title: "ExpressRootNode",
171183
path: "references/document-sandbox/document-apis/classes/ExpressRootNode.md",
172184
},
185+
{
186+
title: "ExpressViewport",
187+
path: "references/document-sandbox/document-apis/classes/ExpressViewport.md",
188+
},
173189
{
174190
title: "FillableNode",
175191
path: "references/document-sandbox/document-apis/classes/FillableNode.md",
@@ -242,6 +258,10 @@ module.exports = {
242258
title: "SolidColorShapeNode",
243259
path: "references/document-sandbox/document-apis/classes/SolidColorShapeNode.md",
244260
},
261+
{
262+
title: "StandaloneTextContentModel",
263+
path: "references/document-sandbox/document-apis/classes/StandaloneTextContentModel.md",
264+
},
245265
{
246266
title: "StandaloneTextNode",
247267
path: "references/document-sandbox/document-apis/classes/StandaloneTextNode.md",
@@ -262,6 +282,14 @@ module.exports = {
262282
title: "TextNode",
263283
path: "references/document-sandbox/document-apis/classes/TextNode.md",
264284
},
285+
{
286+
title: "TextNodeContentModel",
287+
path: "references/document-sandbox/document-apis/classes/TextNodeContentModel.md",
288+
},
289+
{
290+
title: "ThreadedTextContentModel",
291+
path: "references/document-sandbox/document-apis/classes/ThreadedTextContentModel.md",
292+
},
265293
{
266294
title: "ThreadedTextNode",
267295
path: "references/document-sandbox/document-apis/classes/ThreadedTextNode.md",
@@ -278,10 +306,6 @@ module.exports = {
278306
title: "UnknownNode",
279307
path: "references/document-sandbox/document-apis/classes/UnknownNode.md",
280308
},
281-
{
282-
title: "Viewport",
283-
path: "references/document-sandbox/document-apis/classes/Viewport.md",
284-
},
285309
{
286310
title: "VisualNode",
287311
path: "references/document-sandbox/document-apis/classes/VisualNode.md",

src/pages/references/document-sandbox/document-apis/classes/BitmapImage.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,19 @@ Original width of the bitmap in pixels.
2727
#### Returns
2828

2929
`number`
30+
31+
## Methods
32+
33+
### data()
34+
35+
**data**(): `Promise`<`Blob`\>
36+
37+
<InlineAlert slots="text" variant="warning"/>
38+
39+
**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`.
40+
41+
Fetches the bitmap data as a Blob. This will wait for the bitmap to be available if necessary.
42+
43+
#### Returns
44+
45+
`Promise`<`Blob`\>

src/pages/references/document-sandbox/document-apis/classes/Context.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,11 @@
44

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

7-
## Accessors
8-
9-
### currentPage
10-
11-
`get` **currentPage**(): [`PageNode`](PageNode.md)
12-
13-
#### Returns
14-
15-
[`PageNode`](PageNode.md)
7+
## Extended by
168

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

20-
---
11+
## Accessors
2112

2213
### hasSelection
2314

src/pages/references/document-sandbox/document-apis/classes/Editor.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

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

7+
## Extended by
8+
9+
- [`ExpressEditor`](ExpressEditor.md)
10+
711
## Accessors
812

913
### context
@@ -20,11 +24,11 @@ User's current selection context
2024

2125
### documentRoot
2226

23-
`get` **documentRoot**(): [`ExpressRootNode`](ExpressRootNode.md)
27+
`get` **documentRoot**(): [`BaseNode`](BaseNode.md)
2428

2529
#### Returns
2630

27-
[`ExpressRootNode`](ExpressRootNode.md)
31+
[`BaseNode`](BaseNode.md)
2832

2933
the root of the document.
3034

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

7074
#### Parameters
7175

72-
**bitmapData**: `BitmapImage`
76+
**bitmapData**: [`BitmapImage`](BitmapImage.md)
7377

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

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

188192
### loadBitmapImage()
189193

190-
**loadBitmapImage**(`bitmapData`): `Promise`<`BitmapImage`\>
194+
**loadBitmapImage**(`bitmapData`): `Promise`<[`BitmapImage`](BitmapImage.md)\>
191195

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

208212
#### Returns
209213

210-
`Promise`<`BitmapImage`\>
214+
`Promise`<[`BitmapImage`](BitmapImage.md)\>
211215

212216
---
213217

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
[@express-document-sdk](../overview.md) / ExpressContext
2+
3+
# Class: ExpressContext
4+
5+
Contains The Express specific APIs related to the current selection state.
6+
7+
## Extends
8+
9+
- [`Context`](Context.md)
10+
11+
## Accessors
12+
13+
### currentPage
14+
15+
`get` **currentPage**(): [`PageNode`](PageNode.md)
16+
17+
#### Returns
18+
19+
[`PageNode`](PageNode.md)
20+
21+
The currently viewed page.
22+
To change the current page, call [ExpressViewport.bringIntoView](ExpressViewport.md#bringintoview) with an artboard or other content on that page.
23+
24+
---
25+
26+
### hasSelection
27+
28+
`get` **hasSelection**(): `boolean`
29+
30+
#### Returns
31+
32+
`boolean`
33+
34+
false if the current editable selection does not contain any nodes, otherwise true.
35+
36+
---
37+
38+
### insertionParent
39+
40+
`get` **insertionParent**(): [`ContainerNode`](../interfaces/ContainerNode.md)
41+
42+
#### Returns
43+
44+
[`ContainerNode`](../interfaces/ContainerNode.md)
45+
46+
the preferred parent to insert newly added content into (i.e., the location content would get inserted if a
47+
user were to Paste or use the Shapes panel in the UI). This will vary depending on the user's current selection and
48+
other UI state.
49+
50+
---
51+
52+
### selection
53+
54+
`get` **selection**(): readonly [`Node`](Node.md)[]
55+
56+
`set` **selection**(`nodes`): `void`
57+
58+
Sets the current selection to an array of [Node](Node.md).
59+
Accepts a single node as a shortcut for a length-1 array `[node]` or
60+
`undefined` as a shortcut for `[]`, which clears the selection.
61+
62+
Only node(s) that meet the following criteria can be selected:
63+
64+
- Nodes must be within the current artboard (nodes outside the active artboard are filtered out).
65+
- A node cannot be selected if its ancestor is also selected (descendants are filtered out).
66+
- Locked nodes are filtered out (but will still be included in selectionIncludingNonEditable).
67+
68+
#### Parameters
69+
70+
**nodes**: `undefined` \| [`Node`](Node.md) \| readonly [`Node`](Node.md)[]
71+
72+
#### Returns
73+
74+
readonly [`Node`](Node.md)[]
75+
76+
the current selection. Nodes that are locked or otherwise non-editable are never included in the regular
77+
selection (see [selectionIncludingNonEditable](Context.md#selectionincludingnoneditable) to get any locked nodes the user may have clicked).
78+
79+
---
80+
81+
### selectionIncludingNonEditable
82+
83+
`get` **selectionIncludingNonEditable**(): readonly [`Node`](Node.md)[]
84+
85+
#### Returns
86+
87+
readonly [`Node`](Node.md)[]
88+
89+
the current selection *and* any locked nodes the user has attempted to select at the same time. This can
90+
happen for example if the user clicks on a locked node or if the user drags a selection marquee that overlaps
91+
locked nodes in addition to regular unlocked nodes.
92+
93+
## Methods
94+
95+
### off()
96+
97+
**off**(`eventName`, `handlerId`): `void`
98+
99+
Unregisters handlers for editor events like selection change.
100+
101+
#### Parameters
102+
103+
**eventName**: [`selectionChange`](../enumerations/EditorEvent.md#selectionchange)
104+
105+
an editor event name.
106+
107+
**handlerId**: `string`
108+
109+
a unique ID returned by `editor.context.on` API.
110+
Callback that was previously registered will be removed and will no more be invoked when the event occurs.
111+
112+
#### Returns
113+
114+
`void`
115+
116+
#### Inherited from
117+
118+
[`Context`](Context.md).[`off`](Context.md#off)
119+
120+
---
121+
122+
### on()
123+
124+
**on**(`eventName`, `callback`): `string`
125+
126+
Registers a handler for editor events such as selection change.
127+
The registered callback will be invoked when the specified event occurs.
128+
<InlineAlert slots="text" variant="info"/>
129+
Note: Do not attempt to make changes to the document in response to a selection change callback because it may destabilize the application.
130+
131+
#### Parameters
132+
133+
**eventName**: [`selectionChange`](../enumerations/EditorEvent.md#selectionchange)
134+
135+
an editor event name.
136+
137+
**callback**: [`EditorEventHandler`](../type-aliases/EditorEventHandler.md)
138+
139+
a callback to be registered for an editor event.
140+
141+
#### Returns
142+
143+
`string`
144+
145+
a unique ID for the registered event handler.
146+
147+
#### Inherited from
148+
149+
[`Context`](Context.md).[`on`](Context.md#on)

0 commit comments

Comments
 (0)