lucid-extension-sdk 0.0.19 → 0.0.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -432,6 +432,10 @@ export declare type BootstrapQuery = {
432
432
  * the result of the callback, the bootstrap data is cleared.
433
433
  */
434
434
  'c': string;
435
+ /**
436
+ * Marks a document as requiring the editor extension.
437
+ */
438
+ 'm'?: boolean;
435
439
  };
436
440
  export declare type BootstrapResult = Promise<void>;
437
441
  export declare type ConfirmQuery = {
@@ -178,12 +178,17 @@ export declare class EditorClient {
178
178
  * associated with this editor extension. If this callback is async (returns a promise), then the
179
179
  * bootstrap data is not cleared off of the document until that promise resolves.
180
180
  *
181
+ * @param markExtensionAsRequired If bootstrap data is available for this editor extension, this will mark the
182
+ * document as requiring the extension. Once marked, if the extension is not installed the user will be
183
+ * notified about the extension being required on document load. The minimum extension version required by the
184
+ * document is the version provided in the request body when creating the document.
185
+ *
181
186
  * @return a promise that resolves immediately if there is no available bootstrap data, or else after
182
187
  * the callback successfully completes. This promise will reject/throw if the callback throws or
183
188
  * returns a promise that rejects, or if there is another editor session processing the same bootstrap
184
189
  * data at the same time.
185
190
  */
186
- processAndClearBootstrapData(callback: (data: JsonSerializable) => void | Promise<void>): Promise<void>;
191
+ processAndClearBootstrapData(callback: (data: JsonSerializable) => void | Promise<void>, markExtensionAsRequired?: boolean): Promise<void>;
187
192
  /**
188
193
  * @param id ID of the line to create a proxy for
189
194
  * @returns the given line
@@ -284,17 +284,22 @@ class EditorClient {
284
284
  * associated with this editor extension. If this callback is async (returns a promise), then the
285
285
  * bootstrap data is not cleared off of the document until that promise resolves.
286
286
  *
287
+ * @param markExtensionAsRequired If bootstrap data is available for this editor extension, this will mark the
288
+ * document as requiring the extension. Once marked, if the extension is not installed the user will be
289
+ * notified about the extension being required on document load. The minimum extension version required by the
290
+ * document is the version provided in the request body when creating the document.
291
+ *
287
292
  * @return a promise that resolves immediately if there is no available bootstrap data, or else after
288
293
  * the callback successfully completes. This promise will reject/throw if the callback throws or
289
294
  * returns a promise that rejects, or if there is another editor session processing the same bootstrap
290
295
  * data at the same time.
291
296
  */
292
- async processAndClearBootstrapData(callback) {
297
+ async processAndClearBootstrapData(callback, markExtensionAsRequired) {
293
298
  const name = this.getUniqueActionName();
294
299
  this.registerAction(name, (msg) => {
295
300
  return callback(msg['d']);
296
301
  });
297
- await this.sendCommand("b" /* Bootstrap */, { 'c': name });
302
+ await this.sendCommand("b" /* Bootstrap */, { 'c': name, 'm': markExtensionAsRequired });
298
303
  this.deleteAction(name);
299
304
  }
300
305
  /**