lucid-extension-sdk 0.0.88 → 0.0.90
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/package.json +1 -1
- package/sdk/core/unfurl/unfurlcallbacks.d.ts +2 -5
- package/sdk/core/xhr.d.ts +1 -1
- package/sdk/document/blockclasses/blockproxyregistry.js +1 -1
- package/sdk/document/blockclasses/linkunfurlblockproxy.d.ts +11 -15
- package/sdk/document/blockclasses/linkunfurlblockproxy.js +9 -18
- package/sdk/editorclient.d.ts +10 -2
- package/sdk/editorclient.js +18 -6
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinkUnfurlBlockProxy } from '../../document/blockclasses/linkunfurlblockproxy';
|
|
2
2
|
import { UnfurlDetails } from './unfurldetails';
|
|
3
3
|
import { UnfurlRefreshErrorType } from './unfurlrefresherrortype';
|
|
4
4
|
export declare enum UnfurlCallbackType {
|
|
@@ -7,7 +7,6 @@ export declare enum UnfurlCallbackType {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* The callbacks that handle unfurls and refreshing.
|
|
10
|
-
* @ignore
|
|
11
10
|
*/
|
|
12
11
|
export interface UnfurlCallbacks {
|
|
13
12
|
/**
|
|
@@ -20,7 +19,6 @@ export interface UnfurlCallbacks {
|
|
|
20
19
|
*
|
|
21
20
|
* @param url The url to unfurl
|
|
22
21
|
* @return The details of the unfurl or undefined
|
|
23
|
-
* @ignore
|
|
24
22
|
*/
|
|
25
23
|
unfurlCallback: (url: string) => Promise<UnfurlDetails | undefined | UnfurlRefreshErrorType>;
|
|
26
24
|
/**
|
|
@@ -33,7 +31,6 @@ export interface UnfurlCallbacks {
|
|
|
33
31
|
* This callback is also used for refresh to re-fetch the information
|
|
34
32
|
*
|
|
35
33
|
* @param blockProxy The block proxy of the unfurl block
|
|
36
|
-
* @ignore
|
|
37
34
|
*/
|
|
38
|
-
afterUnfurlCallback?: (blockProxy:
|
|
35
|
+
afterUnfurlCallback?: (blockProxy: LinkUnfurlBlockProxy, url: string) => Promise<void>;
|
|
39
36
|
}
|
package/sdk/core/xhr.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface OAuthXHRRequest extends XHRRequest {
|
|
|
27
27
|
* whether the request will be made and forwarded, and not the actual request.
|
|
28
28
|
*
|
|
29
29
|
* Note: There is an allow list which limits where the result can be posted. It is currently only to the result of
|
|
30
|
-
*
|
|
30
|
+
* LinkUnfurlBlockProxy#experimentalStartPDFUpload
|
|
31
31
|
*/
|
|
32
32
|
postResultTo?: string;
|
|
33
33
|
}
|
|
@@ -8,7 +8,7 @@ const linkunfurlblockproxy_1 = require("./linkunfurlblockproxy");
|
|
|
8
8
|
const allProxyClasses = [
|
|
9
9
|
erdblockproxy_1.ERDBlockProxy,
|
|
10
10
|
customblockproxy_1.CustomBlockProxy,
|
|
11
|
-
linkunfurlblockproxy_1.
|
|
11
|
+
linkunfurlblockproxy_1.LinkUnfurlBlockProxy,
|
|
12
12
|
cardblockproxy_1.CardBlockProxy,
|
|
13
13
|
];
|
|
14
14
|
function findProxyClass(className) {
|
|
@@ -2,47 +2,33 @@ import { StartPDFUploadRequestResponse } from '../../commandtypes';
|
|
|
2
2
|
import { UnfurlIframe } from '../../core/unfurl/unfurliframe';
|
|
3
3
|
import { BlockProxy } from '../blockproxy';
|
|
4
4
|
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*
|
|
7
5
|
* This is the kind of block that appears when a link is pasted onto the canvas of a Lucid editor.
|
|
8
6
|
*/
|
|
9
|
-
export declare class
|
|
7
|
+
export declare class LinkUnfurlBlockProxy extends BlockProxy {
|
|
10
8
|
static classNameRegex: RegExp;
|
|
11
9
|
/**
|
|
12
10
|
* Returns the title on the block, which is the main text shown on the block.
|
|
13
|
-
*
|
|
14
|
-
* @ignore
|
|
15
11
|
*/
|
|
16
12
|
getTitle(): string;
|
|
17
13
|
/**
|
|
18
14
|
* Sets the title on the block, which is the main text shown on the block.
|
|
19
|
-
*
|
|
20
|
-
* @ignore
|
|
21
15
|
*/
|
|
22
16
|
setTitle(title: string): void;
|
|
23
17
|
/**
|
|
24
18
|
* Returns the name of the service the link belongs to, such as "Lucid" or "Google", as displayed below the title on
|
|
25
19
|
* the block.
|
|
26
|
-
*
|
|
27
|
-
* @ignore
|
|
28
20
|
*/
|
|
29
21
|
getProviderName(): string;
|
|
30
22
|
/**
|
|
31
23
|
* Sets the URL to be loaded in an iframe when the user clicks the "Expand" action on the block.
|
|
32
|
-
*
|
|
33
|
-
* @ignore
|
|
34
24
|
*/
|
|
35
25
|
setIframe(unfurlIframe: UnfurlIframe): void;
|
|
36
26
|
/**
|
|
37
27
|
* Sets the main thumbnail on the block
|
|
38
|
-
*
|
|
39
|
-
* @ignore
|
|
40
28
|
*/
|
|
41
29
|
setPreviewThumbnailUrl(thumbnailUrl: string): void;
|
|
42
30
|
/**
|
|
43
31
|
* Sets additional thumbnails on the block
|
|
44
|
-
*
|
|
45
|
-
* @ignore
|
|
46
32
|
*/
|
|
47
33
|
setThumbnailUrls(thumbnails: string[]): void;
|
|
48
34
|
/**
|
|
@@ -52,3 +38,13 @@ export declare class ExperimentalLinkUnfurlBlockProxy extends BlockProxy {
|
|
|
52
38
|
*/
|
|
53
39
|
experimentalStartPDFUpload(): Promise<StartPDFUploadRequestResponse>;
|
|
54
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @ignore
|
|
43
|
+
* @deprecated Use LinkUnfurlBlockProxy instead.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ExperimentalLinkUnfurlBlockProxy: typeof LinkUnfurlBlockProxy;
|
|
46
|
+
/**
|
|
47
|
+
* @ignore
|
|
48
|
+
* @deprecated Use LinkUnfurlBlockProxy instead.
|
|
49
|
+
*/
|
|
50
|
+
export declare type ExperimentalLinkUnfurlBlockProxy = LinkUnfurlBlockProxy;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExperimentalLinkUnfurlBlockProxy = void 0;
|
|
3
|
+
exports.ExperimentalLinkUnfurlBlockProxy = exports.LinkUnfurlBlockProxy = void 0;
|
|
4
4
|
const iframeutils_1 = require("../../core/iframe/iframeutils");
|
|
5
5
|
const unfurliframe_1 = require("../../core/unfurl/unfurliframe");
|
|
6
6
|
const blockproxy_1 = require("../blockproxy");
|
|
7
7
|
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*
|
|
10
8
|
* This is the kind of block that appears when a link is pasted onto the canvas of a Lucid editor.
|
|
11
9
|
*/
|
|
12
|
-
class
|
|
10
|
+
class LinkUnfurlBlockProxy extends blockproxy_1.BlockProxy {
|
|
13
11
|
/**
|
|
14
12
|
* Returns the title on the block, which is the main text shown on the block.
|
|
15
|
-
*
|
|
16
|
-
* @ignore
|
|
17
13
|
*/
|
|
18
14
|
getTitle() {
|
|
19
15
|
return this.textAreas.get('t_LinkUnfurlTitle');
|
|
20
16
|
}
|
|
21
17
|
/**
|
|
22
18
|
* Sets the title on the block, which is the main text shown on the block.
|
|
23
|
-
*
|
|
24
|
-
* @ignore
|
|
25
19
|
*/
|
|
26
20
|
setTitle(title) {
|
|
27
21
|
this.textAreas.set('t_LinkUnfurlTitle', title, { force: true });
|
|
@@ -29,16 +23,12 @@ class ExperimentalLinkUnfurlBlockProxy extends blockproxy_1.BlockProxy {
|
|
|
29
23
|
/**
|
|
30
24
|
* Returns the name of the service the link belongs to, such as "Lucid" or "Google", as displayed below the title on
|
|
31
25
|
* the block.
|
|
32
|
-
*
|
|
33
|
-
* @ignore
|
|
34
26
|
*/
|
|
35
27
|
getProviderName() {
|
|
36
28
|
return this.textAreas.get('t_LinkUnfurlProviderName');
|
|
37
29
|
}
|
|
38
30
|
/**
|
|
39
31
|
* Sets the URL to be loaded in an iframe when the user clicks the "Expand" action on the block.
|
|
40
|
-
*
|
|
41
|
-
* @ignore
|
|
42
32
|
*/
|
|
43
33
|
setIframe(unfurlIframe) {
|
|
44
34
|
const iframeAttributes = (0, unfurliframe_1.generateIframeAttributes)(unfurlIframe);
|
|
@@ -48,16 +38,12 @@ class ExperimentalLinkUnfurlBlockProxy extends blockproxy_1.BlockProxy {
|
|
|
48
38
|
}
|
|
49
39
|
/**
|
|
50
40
|
* Sets the main thumbnail on the block
|
|
51
|
-
*
|
|
52
|
-
* @ignore
|
|
53
41
|
*/
|
|
54
42
|
setPreviewThumbnailUrl(thumbnailUrl) {
|
|
55
43
|
this.properties.set('LinkUnfurlThumbnailUrl', thumbnailUrl);
|
|
56
44
|
}
|
|
57
45
|
/**
|
|
58
46
|
* Sets additional thumbnails on the block
|
|
59
|
-
*
|
|
60
|
-
* @ignore
|
|
61
47
|
*/
|
|
62
48
|
setThumbnailUrls(thumbnails) {
|
|
63
49
|
this.properties.set('LinkUnfurlThumbnailUrls', thumbnails);
|
|
@@ -72,5 +58,10 @@ class ExperimentalLinkUnfurlBlockProxy extends blockproxy_1.BlockProxy {
|
|
|
72
58
|
return result;
|
|
73
59
|
}
|
|
74
60
|
}
|
|
75
|
-
exports.
|
|
76
|
-
|
|
61
|
+
exports.LinkUnfurlBlockProxy = LinkUnfurlBlockProxy;
|
|
62
|
+
LinkUnfurlBlockProxy.classNameRegex = /^LinkUnfurlBlock$/;
|
|
63
|
+
/**
|
|
64
|
+
* @ignore
|
|
65
|
+
* @deprecated Use LinkUnfurlBlockProxy instead.
|
|
66
|
+
*/
|
|
67
|
+
exports.ExperimentalLinkUnfurlBlockProxy = LinkUnfurlBlockProxy;
|
package/sdk/editorclient.d.ts
CHANGED
|
@@ -51,7 +51,11 @@ export declare class EditorClient {
|
|
|
51
51
|
* @param mediaType The media type, e.g. 'image/png'
|
|
52
52
|
* @returns A promise that resolves with the URL of the created image.
|
|
53
53
|
*
|
|
54
|
+
*/
|
|
55
|
+
createUserImage(mediaType: string, data: Uint8Array | string): Promise<string>;
|
|
56
|
+
/**
|
|
54
57
|
* @ignore
|
|
58
|
+
* @deprecated Use createUserImage instead.
|
|
55
59
|
*/
|
|
56
60
|
experimentalCreateUserImage(mediaType: string, data: Uint8Array | string): Promise<string>;
|
|
57
61
|
/**
|
|
@@ -148,11 +152,15 @@ export declare class EditorClient {
|
|
|
148
152
|
*/
|
|
149
153
|
registerFileUploadAction(name: string, callback: (files: FileUploadData[]) => void): void;
|
|
150
154
|
/**
|
|
151
|
-
*
|
|
152
|
-
* Registers an handler for link unfurling.
|
|
155
|
+
* Registers a handler for link unfurling.
|
|
153
156
|
* @param domain The domain
|
|
154
157
|
* @param callbacks The callbacks to call when a link matching the domain is pasted.
|
|
155
158
|
*/
|
|
159
|
+
registerUnfurlHandler(domain: string, callbacks: UnfurlCallbacks): void;
|
|
160
|
+
/**
|
|
161
|
+
* @ignore
|
|
162
|
+
* @deprecated Use registerUnfurlHandler instead.
|
|
163
|
+
*/
|
|
156
164
|
experimentalRegisterUnfurlHandler(domain: string, callbacks: UnfurlCallbacks): void;
|
|
157
165
|
/**
|
|
158
166
|
* Remove the callback for a given action. If the action is later invoked, nothing will happen.
|
package/sdk/editorclient.js
CHANGED
|
@@ -82,15 +82,21 @@ class EditorClient {
|
|
|
82
82
|
* @param mediaType The media type, e.g. 'image/png'
|
|
83
83
|
* @returns A promise that resolves with the URL of the created image.
|
|
84
84
|
*
|
|
85
|
-
* @ignore
|
|
86
85
|
*/
|
|
87
|
-
async
|
|
86
|
+
async createUserImage(mediaType, data) {
|
|
88
87
|
const result = await this.sendCommand("cui" /* CommandName.CreateUserImage */, {
|
|
89
88
|
't': mediaType,
|
|
90
89
|
'd': (0, checks_1.isString)(data) ? data : (0, base64_1.encodeBase64)(data),
|
|
91
90
|
});
|
|
92
91
|
return result['u'];
|
|
93
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* @ignore
|
|
95
|
+
* @deprecated Use createUserImage instead.
|
|
96
|
+
*/
|
|
97
|
+
experimentalCreateUserImage(mediaType, data) {
|
|
98
|
+
return this.createUserImage(mediaType, data);
|
|
99
|
+
}
|
|
94
100
|
/**
|
|
95
101
|
*
|
|
96
102
|
* @param flowName
|
|
@@ -247,12 +253,11 @@ class EditorClient {
|
|
|
247
253
|
});
|
|
248
254
|
}
|
|
249
255
|
/**
|
|
250
|
-
*
|
|
251
|
-
* Registers an handler for link unfurling.
|
|
256
|
+
* Registers a handler for link unfurling.
|
|
252
257
|
* @param domain The domain
|
|
253
258
|
* @param callbacks The callbacks to call when a link matching the domain is pasted.
|
|
254
259
|
*/
|
|
255
|
-
|
|
260
|
+
registerUnfurlHandler(domain, callbacks) {
|
|
256
261
|
const action = this.getUniqueActionName();
|
|
257
262
|
this.registerAction(action, async (rawMsg) => {
|
|
258
263
|
var _a;
|
|
@@ -273,7 +278,7 @@ class EditorClient {
|
|
|
273
278
|
case unfurlcallbacks_1.UnfurlCallbackType.AfterUnfurl: {
|
|
274
279
|
if (msg.blockId) {
|
|
275
280
|
const proxy = this.getBlockProxy(msg.blockId);
|
|
276
|
-
if (proxy instanceof linkunfurlblockproxy_1.
|
|
281
|
+
if (proxy instanceof linkunfurlblockproxy_1.LinkUnfurlBlockProxy) {
|
|
277
282
|
await ((_a = callbacks.afterUnfurlCallback) === null || _a === void 0 ? void 0 : _a.call(callbacks, proxy, msg.url));
|
|
278
283
|
}
|
|
279
284
|
}
|
|
@@ -285,6 +290,13 @@ class EditorClient {
|
|
|
285
290
|
});
|
|
286
291
|
this.sendCommand("ru" /* CommandName.RegisterUnfurl */, { 'd': domain, 'a': action });
|
|
287
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* @ignore
|
|
295
|
+
* @deprecated Use registerUnfurlHandler instead.
|
|
296
|
+
*/
|
|
297
|
+
experimentalRegisterUnfurlHandler(domain, callbacks) {
|
|
298
|
+
return this.registerUnfurlHandler(domain, callbacks);
|
|
299
|
+
}
|
|
288
300
|
/**
|
|
289
301
|
* Remove the callback for a given action. If the action is later invoked, nothing will happen.
|
|
290
302
|
* @param name name of the action to unregister
|