lucid-extension-sdk 0.0.42 → 0.0.44
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/commandtypes.d.ts +16 -0
- package/sdk/core/unfurl/unfurlcallbacks.d.ts +1 -1
- package/sdk/document/blockclasses/linkunfurlblockproxy.d.ts +6 -0
- package/sdk/document/blockclasses/linkunfurlblockproxy.js +8 -0
- package/sdk/document/itemproxy.js +4 -3
- package/sdk/document/mapproxy.d.ts +5 -2
- package/sdk/document/mapproxy.js +2 -2
- package/sdk/editorclient.js +1 -1
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export declare const enum CommandName {
|
|
|
85
85
|
SetProperty = "sp",
|
|
86
86
|
SetReferenceKey = "srk",
|
|
87
87
|
SetShapeData = "ssd",
|
|
88
|
+
SetText = "st",
|
|
88
89
|
ShowModal = "sm",
|
|
89
90
|
ShowPanel = "spn",
|
|
90
91
|
SleepForTestCase = "sleep",
|
|
@@ -374,6 +375,10 @@ export declare type CommandArgs = {
|
|
|
374
375
|
query: SetShapeDataQuery;
|
|
375
376
|
result: SetShapeDataResult;
|
|
376
377
|
};
|
|
378
|
+
[CommandName.SetText]: {
|
|
379
|
+
query: SetTextQuery;
|
|
380
|
+
result: SetTextResult;
|
|
381
|
+
};
|
|
377
382
|
[CommandName.ShowModal]: {
|
|
378
383
|
query: ShowModalQuery;
|
|
379
384
|
result: ShowModalResult;
|
|
@@ -927,6 +932,17 @@ export declare type SetShapeDataQuery = {
|
|
|
927
932
|
'v'?: SerializedFieldType;
|
|
928
933
|
};
|
|
929
934
|
export declare type SetShapeDataResult = undefined;
|
|
935
|
+
export declare type SetTextQuery = {
|
|
936
|
+
/** ID of the element to change text on */
|
|
937
|
+
'id': string;
|
|
938
|
+
/** Name of the text area to update */
|
|
939
|
+
'n': string;
|
|
940
|
+
/** Plain text to put in the text area*/
|
|
941
|
+
't': string;
|
|
942
|
+
/** Optional force boolean for extension to update uneditable items*/
|
|
943
|
+
'f'?: boolean | undefined;
|
|
944
|
+
};
|
|
945
|
+
export declare type SetTextResult = undefined;
|
|
930
946
|
export declare type ShowModalQuery = {
|
|
931
947
|
/** Name of the modal's action for receiving events; generated automatically by Modal base class */
|
|
932
948
|
'n': string;
|
|
@@ -35,5 +35,5 @@ export interface UnfurlCallbacks {
|
|
|
35
35
|
* @param blockProxy The block proxy of the unfurl block
|
|
36
36
|
* @ignore
|
|
37
37
|
*/
|
|
38
|
-
afterUnfurlCallback?: (blockProxy: ExperimentalLinkUnfurlBlockProxy) => Promise<void>;
|
|
38
|
+
afterUnfurlCallback?: (blockProxy: ExperimentalLinkUnfurlBlockProxy, url: string) => Promise<void>;
|
|
39
39
|
}
|
|
@@ -13,6 +13,12 @@ export declare class ExperimentalLinkUnfurlBlockProxy extends BlockProxy {
|
|
|
13
13
|
* @ignore
|
|
14
14
|
*/
|
|
15
15
|
getTitle(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Sets the title on the block, which is the main text shown on the block.
|
|
18
|
+
*
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
setTitle(title: string): void;
|
|
16
22
|
/**
|
|
17
23
|
* Returns the name of the service the link belongs to, such as "Lucid" or "Google", as displayed below the title on
|
|
18
24
|
* the block.
|
|
@@ -18,6 +18,14 @@ class ExperimentalLinkUnfurlBlockProxy extends blockproxy_1.BlockProxy {
|
|
|
18
18
|
getTitle() {
|
|
19
19
|
return this.textAreas.get('t_LinkUnfurlTitle');
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Sets the title on the block, which is the main text shown on the block.
|
|
23
|
+
*
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
setTitle(title) {
|
|
27
|
+
this.textAreas.set('t_LinkUnfurlTitle', title, { force: true });
|
|
28
|
+
}
|
|
21
29
|
/**
|
|
22
30
|
* Returns the name of the service the link belongs to, such as "Lucid" or "Google", as displayed below the title on
|
|
23
31
|
* the block.
|
|
@@ -21,10 +21,11 @@ class ItemProxy extends elementproxy_1.ElementProxy {
|
|
|
21
21
|
this.textAreas = new mapproxy_1.WriteableMapProxy(() => this.client.sendCommand("lta" /* ListTextAreas */, this.id), (name) => this.client.sendCommand("gp" /* GetProperty */, {
|
|
22
22
|
'id': this.id,
|
|
23
23
|
'p': name,
|
|
24
|
-
}), (name, plainText) => this.client.sendCommand("
|
|
24
|
+
}), (name, plainText, options) => this.client.sendCommand("st" /* SetText */, {
|
|
25
25
|
'id': this.id,
|
|
26
|
-
'
|
|
27
|
-
'
|
|
26
|
+
'n': name,
|
|
27
|
+
't': plainText,
|
|
28
|
+
'f': options === null || options === void 0 ? void 0 : options.force,
|
|
28
29
|
}));
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
@@ -17,6 +17,9 @@ export declare class MapProxy<KEY, VALUE> {
|
|
|
17
17
|
}
|
|
18
18
|
export declare class WriteableMapProxy<KEY, VALUE> extends MapProxy<KEY, VALUE> {
|
|
19
19
|
private readonly setter;
|
|
20
|
-
constructor(getKeys: () => KEY[], getItem: (key: KEY) => VALUE, setter: (key: KEY, val: VALUE) => void);
|
|
21
|
-
set(key: KEY, value: VALUE): void;
|
|
20
|
+
constructor(getKeys: () => KEY[], getItem: (key: KEY) => VALUE, setter: (key: KEY, val: VALUE, options?: SetterOptions) => void);
|
|
21
|
+
set(key: KEY, value: VALUE, options?: SetterOptions): void;
|
|
22
|
+
}
|
|
23
|
+
export interface SetterOptions {
|
|
24
|
+
force?: boolean;
|
|
22
25
|
}
|
package/sdk/document/mapproxy.js
CHANGED
|
@@ -58,8 +58,8 @@ class WriteableMapProxy extends MapProxy {
|
|
|
58
58
|
super(getKeys, getItem);
|
|
59
59
|
this.setter = setter;
|
|
60
60
|
}
|
|
61
|
-
set(key, value) {
|
|
62
|
-
this.setter(key, value);
|
|
61
|
+
set(key, value, options = {}) {
|
|
62
|
+
this.setter(key, value, options);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
exports.WriteableMapProxy = WriteableMapProxy;
|
package/sdk/editorclient.js
CHANGED
|
@@ -220,7 +220,7 @@ class EditorClient {
|
|
|
220
220
|
if (msg.blockId) {
|
|
221
221
|
const proxy = this.getBlockProxy(msg.blockId);
|
|
222
222
|
if (proxy instanceof linkunfurlblockproxy_1.ExperimentalLinkUnfurlBlockProxy) {
|
|
223
|
-
await ((_a = callbacks.afterUnfurlCallback) === null || _a === void 0 ? void 0 : _a.call(callbacks, proxy));
|
|
223
|
+
await ((_a = callbacks.afterUnfurlCallback) === null || _a === void 0 ? void 0 : _a.call(callbacks, proxy, msg.url));
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
}
|