@impro.social/impro-plugin 0.0.9 → 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.
- package/main.js +11 -1
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -147,6 +147,9 @@ class PluginData {
|
|
|
147
147
|
getProfile(did) {
|
|
148
148
|
return hostCall("getProfile", { did });
|
|
149
149
|
}
|
|
150
|
+
getRecord(repo, collection, rkey) {
|
|
151
|
+
return hostCall("getRecord", { repo, collection, rkey });
|
|
152
|
+
}
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
class App {
|
|
@@ -313,7 +316,10 @@ export class Plugin {
|
|
|
313
316
|
// callback(tokens, context) receives the rich-text token stream for one
|
|
314
317
|
// post and returns a new token array (or the input unchanged). The host
|
|
315
318
|
// batches all posts of a render into one call per plugin.
|
|
316
|
-
|
|
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 = {}) {
|
|
317
323
|
const handlerId = uuid.create();
|
|
318
324
|
callHandlers.set(handlerId, async (batch) => {
|
|
319
325
|
const results = [];
|
|
@@ -327,10 +333,14 @@ export class Plugin {
|
|
|
327
333
|
}
|
|
328
334
|
return results;
|
|
329
335
|
});
|
|
336
|
+
const handlesFacetTypes = Array.isArray(options.handlesFacetTypes)
|
|
337
|
+
? options.handlesFacetTypes.filter((type) => typeof type === "string")
|
|
338
|
+
: [];
|
|
330
339
|
self.postMessage({
|
|
331
340
|
type: "register",
|
|
332
341
|
target: "richTextTransform",
|
|
333
342
|
handlerId,
|
|
343
|
+
handlesFacetTypes,
|
|
334
344
|
});
|
|
335
345
|
}
|
|
336
346
|
|