@bendyline/squisq-editor-react 2.13.12 → 2.13.14
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/{chunk-J5IUF3BC.js → chunk-C5BXRPBX.js} +100 -10
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1 -1
- package/dist/shell/index.js +1 -1
- package/package.json +6 -6
|
@@ -40949,6 +40949,10 @@ import {
|
|
|
40949
40949
|
parseMarkdown as parseMarkdown9,
|
|
40950
40950
|
resolveWikiLinks
|
|
40951
40951
|
} from "@bendyline/squisq/markdown";
|
|
40952
|
+
import {
|
|
40953
|
+
isMediaAnnotationName,
|
|
40954
|
+
parseStandaloneAnnotation
|
|
40955
|
+
} from "@bendyline/squisq/doc";
|
|
40952
40956
|
import { sanitizedSvgImageUrl } from "@bendyline/squisq-react";
|
|
40953
40957
|
|
|
40954
40958
|
// src/utils/collectInlineFontAwesomeCss.ts
|
|
@@ -40996,6 +41000,22 @@ function loadRenderFn() {
|
|
|
40996
41000
|
}
|
|
40997
41001
|
return cachedRenderPromise;
|
|
40998
41002
|
}
|
|
41003
|
+
var preparationPromise = null;
|
|
41004
|
+
function loadPreparation() {
|
|
41005
|
+
preparationPromise ?? (preparationPromise = Promise.all([
|
|
41006
|
+
import("@bendyline/squisq-formats/html-prepare"),
|
|
41007
|
+
import("@bendyline/squisq-formats/html-icons"),
|
|
41008
|
+
import("@bendyline/squisq-formats/diagrams"),
|
|
41009
|
+
import("@bendyline/squisq-react/diagram-pictures")
|
|
41010
|
+
]).then(([prep, icons, diagrams, pictures]) => ({
|
|
41011
|
+
needs: prep.needsPlainHtmlPreparation,
|
|
41012
|
+
prepare: prep.prepareMarkdownDocForPlainHtml,
|
|
41013
|
+
renderDiagram: diagrams.cachingDiagramRasterizer(pictures.createDiagramPictureRenderer()),
|
|
41014
|
+
outlineIcons: icons.plainHtmlIcons
|
|
41015
|
+
})));
|
|
41016
|
+
return preparationPromise;
|
|
41017
|
+
}
|
|
41018
|
+
var PREPARE_DELAY_MS = 300;
|
|
40999
41019
|
var IFRAME_STYLE = {
|
|
41000
41020
|
width: "100%",
|
|
41001
41021
|
height: "100%",
|
|
@@ -41010,6 +41030,7 @@ function PlainHtmlPreview({
|
|
|
41010
41030
|
images,
|
|
41011
41031
|
mediaProvider,
|
|
41012
41032
|
mediaRevision,
|
|
41033
|
+
container,
|
|
41013
41034
|
theme,
|
|
41014
41035
|
className,
|
|
41015
41036
|
style,
|
|
@@ -41087,6 +41108,61 @@ function PlainHtmlPreview({
|
|
|
41087
41108
|
return merged;
|
|
41088
41109
|
}, [resolvedImages, images]);
|
|
41089
41110
|
const iconsCss = useMemo52(() => collectInlineFontAwesomeCss(), []);
|
|
41111
|
+
const [preparation, setPreparation] = useState76(null);
|
|
41112
|
+
useEffect64(() => {
|
|
41113
|
+
let cancelled = false;
|
|
41114
|
+
loadPreparation().then(
|
|
41115
|
+
(loaded) => {
|
|
41116
|
+
if (!cancelled) setPreparation(loaded);
|
|
41117
|
+
},
|
|
41118
|
+
() => {
|
|
41119
|
+
}
|
|
41120
|
+
);
|
|
41121
|
+
return () => {
|
|
41122
|
+
cancelled = true;
|
|
41123
|
+
};
|
|
41124
|
+
}, []);
|
|
41125
|
+
const dataTableCache = useMemo52(
|
|
41126
|
+
() => container ? dataTableCacheFor(container, mediaRevision ?? 0) : void 0,
|
|
41127
|
+
[container, mediaRevision]
|
|
41128
|
+
);
|
|
41129
|
+
const needsPreparation = useMemo52(
|
|
41130
|
+
() => preparation?.needs(mdDoc, {
|
|
41131
|
+
renderDiagram: preparation.renderDiagram,
|
|
41132
|
+
outlineIcons: preparation.outlineIcons,
|
|
41133
|
+
container
|
|
41134
|
+
}) ?? false,
|
|
41135
|
+
[preparation, mdDoc, container]
|
|
41136
|
+
);
|
|
41137
|
+
const [prepared, setPrepared] = useState76(null);
|
|
41138
|
+
const preparedOnceRef = useRef59(false);
|
|
41139
|
+
useEffect64(() => {
|
|
41140
|
+
if (!preparation || !needsPreparation) return;
|
|
41141
|
+
let cancelled = false;
|
|
41142
|
+
const prepare = () => {
|
|
41143
|
+
preparation.prepare(mdDoc, {
|
|
41144
|
+
renderDiagram: preparation.renderDiagram,
|
|
41145
|
+
outlineIcons: preparation.outlineIcons,
|
|
41146
|
+
container,
|
|
41147
|
+
dataTableCache
|
|
41148
|
+
}).then(
|
|
41149
|
+
(result) => {
|
|
41150
|
+
if (!cancelled) setPrepared(result);
|
|
41151
|
+
},
|
|
41152
|
+
() => {
|
|
41153
|
+
if (!cancelled)
|
|
41154
|
+
setPrepared({ markdownDoc: mdDoc, images: /* @__PURE__ */ new Map(), icons: /* @__PURE__ */ new Map() });
|
|
41155
|
+
}
|
|
41156
|
+
);
|
|
41157
|
+
};
|
|
41158
|
+
const timer = setTimeout(prepare, preparedOnceRef.current ? PREPARE_DELAY_MS : 0);
|
|
41159
|
+
preparedOnceRef.current = true;
|
|
41160
|
+
return () => {
|
|
41161
|
+
cancelled = true;
|
|
41162
|
+
clearTimeout(timer);
|
|
41163
|
+
};
|
|
41164
|
+
}, [preparation, needsPreparation, mdDoc, container, dataTableCache]);
|
|
41165
|
+
const view = needsPreparation ? prepared : null;
|
|
41090
41166
|
const [renderFn, setRenderFn] = useState76(() => cachedRender);
|
|
41091
41167
|
useEffect64(() => {
|
|
41092
41168
|
if (renderFn) return;
|
|
@@ -41098,14 +41174,18 @@ function PlainHtmlPreview({
|
|
|
41098
41174
|
cancelled = true;
|
|
41099
41175
|
};
|
|
41100
41176
|
}, [renderFn]);
|
|
41101
|
-
const html = useMemo52(
|
|
41102
|
-
()
|
|
41103
|
-
|
|
41104
|
-
|
|
41105
|
-
|
|
41106
|
-
|
|
41107
|
-
|
|
41108
|
-
|
|
41177
|
+
const html = useMemo52(() => {
|
|
41178
|
+
if (!renderFn) return "";
|
|
41179
|
+
const images2 = view && view.images.size > 0 ? new Map([...mergedImages ?? [], ...view.images]) : mergedImages;
|
|
41180
|
+
return renderFn(view?.markdownDoc ?? mdDoc, {
|
|
41181
|
+
title,
|
|
41182
|
+
images: images2,
|
|
41183
|
+
theme,
|
|
41184
|
+
iconsCss,
|
|
41185
|
+
icons: view?.icons,
|
|
41186
|
+
videoEmbeds: "poster"
|
|
41187
|
+
});
|
|
41188
|
+
}, [renderFn, view, mdDoc, title, mergedImages, theme, iconsCss]);
|
|
41109
41189
|
const installFrameLinkHandler = useCallback50(() => {
|
|
41110
41190
|
removeFrameLinkHandlerRef.current();
|
|
41111
41191
|
removeFrameLinkHandlerRef.current = () => void 0;
|
|
@@ -41292,6 +41372,12 @@ function collectImageRefs(doc) {
|
|
|
41292
41372
|
if (n.type === "image" && typeof n.url === "string" && n.url) {
|
|
41293
41373
|
refs.add(n.url);
|
|
41294
41374
|
}
|
|
41375
|
+
if (n.type === "paragraph") {
|
|
41376
|
+
const tag = parseStandaloneAnnotation(node2);
|
|
41377
|
+
if (tag?.template && isMediaAnnotationName(tag.template) && tag.params.src) {
|
|
41378
|
+
refs.add(tag.params.src);
|
|
41379
|
+
}
|
|
41380
|
+
}
|
|
41295
41381
|
if ((n.type === "htmlBlock" || n.type === "htmlInline") && Array.isArray(n.htmlChildren)) {
|
|
41296
41382
|
visitHtml(n.htmlChildren);
|
|
41297
41383
|
}
|
|
@@ -42278,7 +42364,8 @@ function PrintPreview({
|
|
|
42278
42364
|
theme,
|
|
42279
42365
|
showCover,
|
|
42280
42366
|
transformStyle,
|
|
42281
|
-
mediaRevision
|
|
42367
|
+
mediaRevision,
|
|
42368
|
+
container
|
|
42282
42369
|
}) {
|
|
42283
42370
|
const { slidesPerPage, registerPrintHandler } = usePrintMode();
|
|
42284
42371
|
const mediaProvider = useMediaProvider();
|
|
@@ -42320,6 +42407,7 @@ function PrintPreview({
|
|
|
42320
42407
|
title,
|
|
42321
42408
|
mediaProvider,
|
|
42322
42409
|
mediaRevision,
|
|
42410
|
+
container,
|
|
42323
42411
|
theme,
|
|
42324
42412
|
onFrameChange: setDocumentFrame
|
|
42325
42413
|
}
|
|
@@ -42845,7 +42933,8 @@ function PreviewPanel({
|
|
|
42845
42933
|
theme: activeTheme,
|
|
42846
42934
|
showCover: activeCoverSlide,
|
|
42847
42935
|
transformStyle: activeTransformStyle,
|
|
42848
|
-
mediaRevision
|
|
42936
|
+
mediaRevision,
|
|
42937
|
+
container: workspaceContainer ?? null
|
|
42849
42938
|
}
|
|
42850
42939
|
);
|
|
42851
42940
|
}
|
|
@@ -42858,6 +42947,7 @@ function PreviewPanel({
|
|
|
42858
42947
|
title: contentDoc?.frontmatter?.title ?? void 0,
|
|
42859
42948
|
mediaProvider,
|
|
42860
42949
|
mediaRevision,
|
|
42950
|
+
container: workspaceContainer ?? null,
|
|
42861
42951
|
theme: activeTheme,
|
|
42862
42952
|
globalKeyboardShortcuts: !audience,
|
|
42863
42953
|
onLinkClick,
|
package/dist/index.d.ts
CHANGED
|
@@ -434,6 +434,11 @@ interface PlainHtmlPreviewProps {
|
|
|
434
434
|
* Mirrors the `mediaRevision` bump the editor uses after an image
|
|
435
435
|
* edit so saves show up in the preview without remount. */
|
|
436
436
|
mediaRevision?: number;
|
|
437
|
+
/**
|
|
438
|
+
* The workspace holding the document's data files, so a
|
|
439
|
+
* `{[dataTable src=…]}` reference shows its first rows as the export does.
|
|
440
|
+
*/
|
|
441
|
+
container?: ContentContainer | null;
|
|
437
442
|
/**
|
|
438
443
|
* Squisq theme to apply. When set, the iframe loads any Google-
|
|
439
444
|
* hosted fonts the theme uses and the rendered HTML adopts the
|
|
@@ -456,7 +461,7 @@ interface PlainHtmlPreviewProps {
|
|
|
456
461
|
/** Optional host clipboard adapter; otherwise the browser Clipboard API is used. */
|
|
457
462
|
onCopyCode?: CodeBlockCopyHandler;
|
|
458
463
|
}
|
|
459
|
-
declare function PlainHtmlPreview({ markdown, wikiLinks, title, images, mediaProvider, mediaRevision, theme, className, style, globalKeyboardShortcuts, onFrameChange, onLinkClick, showCodeCopyButton, onCopyCode, }: PlainHtmlPreviewProps): react.JSX.Element;
|
|
464
|
+
declare function PlainHtmlPreview({ markdown, wikiLinks, title, images, mediaProvider, mediaRevision, container, theme, className, style, globalKeyboardShortcuts, onFrameChange, onLinkClick, showCodeCopyButton, onCopyCode, }: PlainHtmlPreviewProps): react.JSX.Element;
|
|
460
465
|
|
|
461
466
|
/**
|
|
462
467
|
* Emoji Dataset
|
package/dist/index.js
CHANGED
package/dist/shell/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-editor-react",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.14",
|
|
4
4
|
"description": "React editor shell with raw/WYSIWYG/preview modes for Squisq documents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -102,12 +102,12 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@bendyline/squisq": "2.13.
|
|
105
|
+
"@bendyline/squisq": "2.13.8",
|
|
106
106
|
"@bendyline/squisq-calc": "2.11.2",
|
|
107
|
-
"@bendyline/squisq-formats": "2.8.
|
|
108
|
-
"@bendyline/squisq-grid-react": "2.11.
|
|
109
|
-
"@bendyline/squisq-react": "2.12.
|
|
110
|
-
"@bendyline/squisq-video-react": "2.5.
|
|
107
|
+
"@bendyline/squisq-formats": "2.8.10",
|
|
108
|
+
"@bendyline/squisq-grid-react": "2.11.37",
|
|
109
|
+
"@bendyline/squisq-react": "2.12.20",
|
|
110
|
+
"@bendyline/squisq-video-react": "2.5.21",
|
|
111
111
|
"@fortawesome/fontawesome-free": "7.3.1",
|
|
112
112
|
"@tiptap/core": "2.27.3",
|
|
113
113
|
"@tiptap/extension-heading": "2.27.3",
|