lucid-extension-sdk 0.0.173 → 0.0.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commandtypes.d.ts +16 -0
- package/commandtypes.js +1 -0
- package/core/linkimporter/linkimporter.d.ts +16 -0
- package/core/linkimporter/linkimporter.js +2 -0
- package/editorclient.d.ts +6 -0
- package/editorclient.js +14 -0
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export declare const enum CommandName {
|
|
|
98
98
|
OffsetItems = "oi",
|
|
99
99
|
PatchDataItems = "pdi",
|
|
100
100
|
Prompt = "p",
|
|
101
|
+
RegisterLinkImporter = "rli",
|
|
101
102
|
RegisterPanel = "rp",
|
|
102
103
|
RegisterUnfurl = "ru",
|
|
103
104
|
ReloadExtension = "r",
|
|
@@ -449,6 +450,10 @@ export declare type CommandArgs = {
|
|
|
449
450
|
query: PromptQuery;
|
|
450
451
|
result: PromptResult;
|
|
451
452
|
};
|
|
453
|
+
[CommandName.RegisterLinkImporter]: {
|
|
454
|
+
query: RegisterLinkImporterQuery;
|
|
455
|
+
result: RegisterLinkImporterResult;
|
|
456
|
+
};
|
|
452
457
|
[CommandName.RegisterPanel]: {
|
|
453
458
|
query: RegisterPanelQuery;
|
|
454
459
|
result: RegisterPanelResult;
|
|
@@ -1127,6 +1132,17 @@ export declare type PromptQuery = {
|
|
|
1127
1132
|
'b': string;
|
|
1128
1133
|
};
|
|
1129
1134
|
export declare type PromptResult = Promise<string | undefined>;
|
|
1135
|
+
export declare type RegisterLinkImporterQuery = {
|
|
1136
|
+
/** ID of the link importer*/
|
|
1137
|
+
'id': string;
|
|
1138
|
+
/** Action to call to get links for bulk import */
|
|
1139
|
+
'a': string;
|
|
1140
|
+
/** Label for the menu item */
|
|
1141
|
+
'l': string;
|
|
1142
|
+
/** Icon URL of the menu item, preferably a base64-encoded URL */
|
|
1143
|
+
'i': string;
|
|
1144
|
+
};
|
|
1145
|
+
export declare type RegisterLinkImporterResult = void;
|
|
1130
1146
|
export declare type RegisterPanelQuery = {
|
|
1131
1147
|
/** Name of the panel's action for receiving events; generated automatically by Panel base class */
|
|
1132
1148
|
'n': string;
|
package/commandtypes.js
CHANGED
|
@@ -79,6 +79,7 @@ exports.commandTitles = new Map([
|
|
|
79
79
|
["oi" /* CommandName.OffsetItems */, 'OffsetItems'],
|
|
80
80
|
["pdi" /* CommandName.PatchDataItems */, 'PatchDataItems'],
|
|
81
81
|
["p" /* CommandName.Prompt */, 'Prompt'],
|
|
82
|
+
["rli" /* CommandName.RegisterLinkImporter */, 'RegisterLinkImporter'],
|
|
82
83
|
["rp" /* CommandName.RegisterPanel */, 'RegisterPanel'],
|
|
83
84
|
["ru" /* CommandName.RegisterUnfurl */, 'RegisterUnfurl'],
|
|
84
85
|
["r" /* CommandName.ReloadExtension */, 'ReloadExtension'],
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface LinkImporter {
|
|
2
|
+
/** The id for this link importer */
|
|
3
|
+
id: string;
|
|
4
|
+
/** The text to display on the menu item */
|
|
5
|
+
label: string;
|
|
6
|
+
/** The icon to display on the menu item.
|
|
7
|
+
* A URL (a data URI is fine) pointing to an icon representing the integration.
|
|
8
|
+
* This will be displayed at up to 32x32 CSS pixels in size. */
|
|
9
|
+
iconUrl: string;
|
|
10
|
+
/** A method for getting URLs that will be imported onto the canvas as link unfurl blocks.
|
|
11
|
+
* For example, this method could display a file picker, and return URLs for all of the selected files
|
|
12
|
+
*
|
|
13
|
+
* @return an array of urls for import
|
|
14
|
+
* */
|
|
15
|
+
getLinksForBulkImport: () => Promise<string[]>;
|
|
16
|
+
}
|
package/editorclient.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommandArgs, CommandName, HashAlgorithmEnum, TriggerAuthFlowResult, UnionToIntersection } from './commandtypes';
|
|
2
2
|
import { JsonSerializable } from './core/jsonserializable';
|
|
3
|
+
import { LinkImporter } from './core/linkimporter/linkimporter';
|
|
3
4
|
import { UnfurlCallbacks } from './core/unfurl/unfurlcallbacks';
|
|
4
5
|
import { BinaryXHRResponse, OAuthXHRRequest, TextXHRResponse, XHRRequest, XHRResponse } from './core/xhr';
|
|
5
6
|
import { CollectionProxy } from './data/collectionproxy';
|
|
@@ -179,6 +180,11 @@ export declare class EditorClient {
|
|
|
179
180
|
* @param callbacks The callbacks to call when a link matching the domain is pasted.
|
|
180
181
|
*/
|
|
181
182
|
registerUnfurlHandler(domain: string, callbacks: UnfurlCallbacks): void;
|
|
183
|
+
/**
|
|
184
|
+
* Registers a menu item for bulk importing links.
|
|
185
|
+
* @param linkImporter The importer for getting URLs that will be imported onto the canvas as link unfurl blocks
|
|
186
|
+
*/
|
|
187
|
+
registerLinkImporter(linkImporter: LinkImporter): void;
|
|
182
188
|
/**
|
|
183
189
|
* @ignore
|
|
184
190
|
* @deprecated Use registerUnfurlHandler instead.
|
package/editorclient.js
CHANGED
|
@@ -305,6 +305,20 @@ class EditorClient {
|
|
|
305
305
|
});
|
|
306
306
|
this.sendCommand("ru" /* CommandName.RegisterUnfurl */, { 'd': domain, 'a': action });
|
|
307
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Registers a menu item for bulk importing links.
|
|
310
|
+
* @param linkImporter The importer for getting URLs that will be imported onto the canvas as link unfurl blocks
|
|
311
|
+
*/
|
|
312
|
+
registerLinkImporter(linkImporter) {
|
|
313
|
+
const action = this.getUniqueActionName();
|
|
314
|
+
this.registerAction(action, async () => { var _a; return (_a = (await linkImporter.getLinksForBulkImport())) !== null && _a !== void 0 ? _a : []; });
|
|
315
|
+
this.sendCommand("rli" /* CommandName.RegisterLinkImporter */, {
|
|
316
|
+
'id': linkImporter.id,
|
|
317
|
+
'a': action,
|
|
318
|
+
'l': linkImporter.label,
|
|
319
|
+
'i': linkImporter.iconUrl,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
308
322
|
/**
|
|
309
323
|
* @ignore
|
|
310
324
|
* @deprecated Use registerUnfurlHandler instead.
|