@impro.social/impro-plugin 0.0.10 → 0.0.11

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.
Files changed (2) hide show
  1. package/main.js +8 -1
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -316,7 +316,10 @@ export class Plugin {
316
316
  // callback(tokens, context) receives the rich-text token stream for one
317
317
  // post and returns a new token array (or the input unchanged). The host
318
318
  // batches all posts of a render into one call per plugin.
319
- registerRichTextTransform(callback = (tokens) => tokens) {
319
+ //
320
+ // options.handlesFacetTypes: array of facet feature $type strings this
321
+ // transform owns, to prevent render flash of fallback text
322
+ registerRichTextTransform(callback = (tokens) => tokens, options = {}) {
320
323
  const handlerId = uuid.create();
321
324
  callHandlers.set(handlerId, async (batch) => {
322
325
  const results = [];
@@ -330,10 +333,14 @@ export class Plugin {
330
333
  }
331
334
  return results;
332
335
  });
336
+ const handlesFacetTypes = Array.isArray(options.handlesFacetTypes)
337
+ ? options.handlesFacetTypes.filter((type) => typeof type === "string")
338
+ : [];
333
339
  self.postMessage({
334
340
  type: "register",
335
341
  target: "richTextTransform",
336
342
  handlerId,
343
+ handlesFacetTypes,
337
344
  });
338
345
  }
339
346
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impro.social/impro-plugin",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "main": "main.js",
6
6
  "license": "0BSD",