@cccsaurora/howler-ui 2.15.0-dev.288 → 2.15.0-dev.292

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.
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable no-console */
3
- import Handlebars from 'handlebars';
3
+ import Handlebars, {} from 'handlebars';
4
4
  import asyncHelpers from 'handlebars-async-helpers';
5
5
  import { memo, useEffect, useMemo, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
@@ -54,11 +54,17 @@ const HandlebarsMarkdown = ({ md, object = {}, disableLinks = false }) => {
54
54
  }, [handlebars, helpers, mdComponents]);
55
55
  useEffect(() => {
56
56
  THROTTLER.debounce(async () => {
57
+ const compiled = handlebars.compile(md || '');
57
58
  try {
58
- const compiled = handlebars.compile(md || '');
59
59
  setRendered(await compiled(object));
60
60
  }
61
61
  catch (err) {
62
+ if (err.message?.startsWith('Missing helper')) {
63
+ const missingHelper = err.message.replace(/.+"(.+)"/, '$1');
64
+ handlebars.registerHelper(missingHelper, () => new Handlebars.SafeString(`\n\n<span style="color: red; font-weight: bold; font-family: monospace;">Missing helper ${missingHelper}</span>`));
65
+ setRendered(await compiled(object));
66
+ return;
67
+ }
62
68
  // eslint-disable-next-line no-console
63
69
  console.error(err);
64
70
  setRendered(`
package/package.json CHANGED
@@ -96,7 +96,7 @@
96
96
  "internal-slot": "1.0.7"
97
97
  },
98
98
  "type": "module",
99
- "version": "2.15.0-dev.288",
99
+ "version": "2.15.0-dev.292",
100
100
  "exports": {
101
101
  "./i18n": "./i18n.js",
102
102
  "./index.css": "./index.css",