@qkix/better-blocks-react-renderer 0.18.1 → 0.18.3
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/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ComponentType, CSSProperties } from 'react';
|
|
2
|
-
import { BlocksContent, ExtendedBlocksContent, TableCellAlign, CalloutVariant, ButtonAlignment, ButtonLink, ButtonFile, ButtonStyle, SocialPlatform, SocialEmbedOembed, SocialEmbedAlignment, AudioFile, AudioPlayer, AudioAlignment, EmbedProvider, AspectRatio, MediaAlignment, VideoProvider, VideoFile, VideoPlayer
|
|
3
|
-
export { AspectRatio, AudioAlignment, AudioFile, AudioNode, AudioPlayer, AudioPreload, BlockNode, BlocksContent, ButtonAlignment, ButtonElement, ButtonFile, ButtonLink, ButtonStyle, CalloutNode, CalloutVariant, CodeNode, DetailsNode, DiagramNode, EmbedNode, EmbedProvider, HeadingNode, HorizontalLineNode, ImageNode, InlineNode, LinkNode, ListItemNode, ListNode, MathNode, MediaAlignment, MediaEmbedNode, ParagraphNode, QuoteNode, SocialEmbedAlignment, SocialEmbedNode, SocialEmbedOembed, SocialPlatform, TableCellAlign, TableCellNode, TableHeaderCellNode, TableNode, TableRowNode, TextAlign, TextNode, VideoFile, VideoNode, VideoPlayer, VideoProvider } from '@qkix/better-blocks-core';
|
|
2
|
+
import { BlockDefinition, CustomBlockNode, BlocksContent, ExtendedBlocksContent, TableCellAlign, CalloutVariant, ButtonAlignment, ButtonLink, ButtonFile, ButtonStyle, SocialPlatform, SocialEmbedOembed, SocialEmbedAlignment, AudioFile, AudioPlayer, AudioAlignment, EmbedProvider, AspectRatio, MediaAlignment, VideoProvider, VideoFile, VideoPlayer } from '@qkix/better-blocks-core';
|
|
3
|
+
export { AnyBlockNode, AspectRatio, AudioAlignment, AudioFile, AudioNode, AudioPlayer, AudioPreload, BlockDefinition, BlockNode, BlocksContent, ButtonAlignment, ButtonElement, ButtonFile, ButtonLink, ButtonStyle, CalloutNode, CalloutVariant, CodeNode, CustomBlockNode, DetailsNode, DiagramNode, EmbedNode, EmbedProvider, ExtendedBlocksContent, HeadingNode, HorizontalLineNode, ImageNode, InlineNode, LinkNode, ListItemNode, ListNode, MathNode, MediaAlignment, MediaEmbedNode, ParagraphNode, QuoteNode, SocialEmbedAlignment, SocialEmbedNode, SocialEmbedOembed, SocialPlatform, TableCellAlign, TableCellNode, TableHeaderCellNode, TableNode, TableRowNode, TextAlign, TextNode, VideoFile, VideoNode, VideoPlayer, VideoProvider } from '@qkix/better-blocks-core';
|
|
4
4
|
|
|
5
5
|
type ModifierProps = {
|
|
6
6
|
children: ReactNode;
|
|
@@ -220,4 +220,4 @@ type BlocksRendererProps = {
|
|
|
220
220
|
|
|
221
221
|
declare function BlocksRenderer({ content, blocks, modifiers, blockPlugins, codeTheme, codeCopyButton, }: BlocksRendererProps): ReactNode;
|
|
222
222
|
|
|
223
|
-
export { type BackgroundColorModifierProps, type BlockComponentProps, BlocksRenderer, type BlocksRendererProps, type ColorModifierProps, type CustomBlocksConfig, type CustomModifiersConfig, type FontFamilyModifierProps, type FontSizeModifierProps, type ModifierProps, type TableCellRenderProps };
|
|
223
|
+
export { type BackgroundColorModifierProps, type BlockComponentProps, type BlockPlugin, BlocksRenderer, type BlocksRendererProps, type ColorModifierProps, type CustomBlockProps, type CustomBlocksConfig, type CustomModifiersConfig, type FontFamilyModifierProps, type FontSizeModifierProps, type ModifierProps, type TableCellRenderProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ComponentType, CSSProperties } from 'react';
|
|
2
|
-
import { BlocksContent, ExtendedBlocksContent, TableCellAlign, CalloutVariant, ButtonAlignment, ButtonLink, ButtonFile, ButtonStyle, SocialPlatform, SocialEmbedOembed, SocialEmbedAlignment, AudioFile, AudioPlayer, AudioAlignment, EmbedProvider, AspectRatio, MediaAlignment, VideoProvider, VideoFile, VideoPlayer
|
|
3
|
-
export { AspectRatio, AudioAlignment, AudioFile, AudioNode, AudioPlayer, AudioPreload, BlockNode, BlocksContent, ButtonAlignment, ButtonElement, ButtonFile, ButtonLink, ButtonStyle, CalloutNode, CalloutVariant, CodeNode, DetailsNode, DiagramNode, EmbedNode, EmbedProvider, HeadingNode, HorizontalLineNode, ImageNode, InlineNode, LinkNode, ListItemNode, ListNode, MathNode, MediaAlignment, MediaEmbedNode, ParagraphNode, QuoteNode, SocialEmbedAlignment, SocialEmbedNode, SocialEmbedOembed, SocialPlatform, TableCellAlign, TableCellNode, TableHeaderCellNode, TableNode, TableRowNode, TextAlign, TextNode, VideoFile, VideoNode, VideoPlayer, VideoProvider } from '@qkix/better-blocks-core';
|
|
2
|
+
import { BlockDefinition, CustomBlockNode, BlocksContent, ExtendedBlocksContent, TableCellAlign, CalloutVariant, ButtonAlignment, ButtonLink, ButtonFile, ButtonStyle, SocialPlatform, SocialEmbedOembed, SocialEmbedAlignment, AudioFile, AudioPlayer, AudioAlignment, EmbedProvider, AspectRatio, MediaAlignment, VideoProvider, VideoFile, VideoPlayer } from '@qkix/better-blocks-core';
|
|
3
|
+
export { AnyBlockNode, AspectRatio, AudioAlignment, AudioFile, AudioNode, AudioPlayer, AudioPreload, BlockDefinition, BlockNode, BlocksContent, ButtonAlignment, ButtonElement, ButtonFile, ButtonLink, ButtonStyle, CalloutNode, CalloutVariant, CodeNode, CustomBlockNode, DetailsNode, DiagramNode, EmbedNode, EmbedProvider, ExtendedBlocksContent, HeadingNode, HorizontalLineNode, ImageNode, InlineNode, LinkNode, ListItemNode, ListNode, MathNode, MediaAlignment, MediaEmbedNode, ParagraphNode, QuoteNode, SocialEmbedAlignment, SocialEmbedNode, SocialEmbedOembed, SocialPlatform, TableCellAlign, TableCellNode, TableHeaderCellNode, TableNode, TableRowNode, TextAlign, TextNode, VideoFile, VideoNode, VideoPlayer, VideoProvider } from '@qkix/better-blocks-core';
|
|
4
4
|
|
|
5
5
|
type ModifierProps = {
|
|
6
6
|
children: ReactNode;
|
|
@@ -220,4 +220,4 @@ type BlocksRendererProps = {
|
|
|
220
220
|
|
|
221
221
|
declare function BlocksRenderer({ content, blocks, modifiers, blockPlugins, codeTheme, codeCopyButton, }: BlocksRendererProps): ReactNode;
|
|
222
222
|
|
|
223
|
-
export { type BackgroundColorModifierProps, type BlockComponentProps, BlocksRenderer, type BlocksRendererProps, type ColorModifierProps, type CustomBlocksConfig, type CustomModifiersConfig, type FontFamilyModifierProps, type FontSizeModifierProps, type ModifierProps, type TableCellRenderProps };
|
|
223
|
+
export { type BackgroundColorModifierProps, type BlockComponentProps, type BlockPlugin, BlocksRenderer, type BlocksRendererProps, type ColorModifierProps, type CustomBlockProps, type CustomBlocksConfig, type CustomModifiersConfig, type FontFamilyModifierProps, type FontSizeModifierProps, type ModifierProps, type TableCellRenderProps };
|
package/dist/index.js
CHANGED
|
@@ -120,17 +120,17 @@ function CodeBlock({
|
|
|
120
120
|
}) {
|
|
121
121
|
const [html, setHtml] = (0, import_react.useState)(null);
|
|
122
122
|
(0, import_react.useEffect)(() => {
|
|
123
|
-
let
|
|
123
|
+
let canceled = false;
|
|
124
124
|
setHtml(null);
|
|
125
125
|
if (!plainText) return;
|
|
126
126
|
const lang = (0, import_better_blocks_core2.normalizeCodeLang)(language);
|
|
127
127
|
loadHighlighter(theme, lang).then((highlighter) => highlighter.codeToHtml(plainText, { lang, theme })).then((highlighted) => {
|
|
128
|
-
if (!
|
|
128
|
+
if (!canceled) setHtml(highlighted);
|
|
129
129
|
}).catch(() => {
|
|
130
|
-
if (!
|
|
130
|
+
if (!canceled) setHtml(null);
|
|
131
131
|
});
|
|
132
132
|
return () => {
|
|
133
|
-
|
|
133
|
+
canceled = true;
|
|
134
134
|
};
|
|
135
135
|
}, [plainText, language, theme]);
|
|
136
136
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bb-code", children: [
|
|
@@ -157,16 +157,16 @@ var renderCount = 0;
|
|
|
157
157
|
function MermaidDiagram({ value }) {
|
|
158
158
|
const [svg, setSvg] = (0, import_react2.useState)(null);
|
|
159
159
|
(0, import_react2.useEffect)(() => {
|
|
160
|
-
let
|
|
160
|
+
let canceled = false;
|
|
161
161
|
setSvg(null);
|
|
162
162
|
if (!value) return;
|
|
163
163
|
loadMermaid().then((mermaid) => mermaid.render(`bb-mermaid-${renderCount++}`, value)).then(({ svg: svg2 }) => {
|
|
164
|
-
if (!
|
|
164
|
+
if (!canceled) setSvg(svg2);
|
|
165
165
|
}).catch(() => {
|
|
166
|
-
if (!
|
|
166
|
+
if (!canceled) setSvg(null);
|
|
167
167
|
});
|
|
168
168
|
return () => {
|
|
169
|
-
|
|
169
|
+
canceled = true;
|
|
170
170
|
};
|
|
171
171
|
}, [value]);
|
|
172
172
|
if (svg) {
|
|
@@ -348,14 +348,14 @@ function SocialEmbed({
|
|
|
348
348
|
});
|
|
349
349
|
const widget = WIDGET_SCRIPTS[platform];
|
|
350
350
|
if (!widget) return;
|
|
351
|
-
let
|
|
351
|
+
let canceled = false;
|
|
352
352
|
void loadWidgetScript(widget.src, platform).then(() => {
|
|
353
353
|
const container = containerRef.current;
|
|
354
|
-
if (
|
|
354
|
+
if (canceled || !container) return;
|
|
355
355
|
if (!widget.process(container)) reinjectWidgetScript(widget.src, platform);
|
|
356
356
|
});
|
|
357
357
|
return () => {
|
|
358
|
-
|
|
358
|
+
canceled = true;
|
|
359
359
|
};
|
|
360
360
|
}, [platform, html]);
|
|
361
361
|
const providerName = (_a = oembed == null ? void 0 : oembed.providerName) != null ? _a : PLATFORM_LABELS[platform];
|
|
@@ -415,12 +415,12 @@ function Video({
|
|
|
415
415
|
setMuxDefined(true);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
let
|
|
418
|
+
let canceled = false;
|
|
419
419
|
void window.customElements.whenDefined("mux-player").then(() => {
|
|
420
|
-
if (!
|
|
420
|
+
if (!canceled) setMuxDefined(true);
|
|
421
421
|
});
|
|
422
422
|
return () => {
|
|
423
|
-
|
|
423
|
+
canceled = true;
|
|
424
424
|
};
|
|
425
425
|
}, [wantsMux]);
|
|
426
426
|
const isHls = HLS_MANIFEST.test(url);
|