@bendyline/squisq-editor-react 2.13.19 → 2.13.21
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.
|
@@ -31381,6 +31381,13 @@ function formatBytes2(size) {
|
|
|
31381
31381
|
if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`;
|
|
31382
31382
|
return `${(size / (1024 * 1024)).toFixed(1)} MB`;
|
|
31383
31383
|
}
|
|
31384
|
+
function decodeHrefForDisplay(href) {
|
|
31385
|
+
try {
|
|
31386
|
+
return decodeURIComponent(href);
|
|
31387
|
+
} catch {
|
|
31388
|
+
return href;
|
|
31389
|
+
}
|
|
31390
|
+
}
|
|
31384
31391
|
function DataCardWidget({
|
|
31385
31392
|
editor,
|
|
31386
31393
|
blockId,
|
|
@@ -31648,7 +31655,7 @@ function DataCardWidget({
|
|
|
31648
31655
|
}
|
|
31649
31656
|
}, [href, onMediaSaved]);
|
|
31650
31657
|
if (!link || !href) return null;
|
|
31651
|
-
const fileName = href.split("/").pop() ?? href;
|
|
31658
|
+
const fileName = decodeHrefForDisplay(href.split("/").pop() ?? href);
|
|
31652
31659
|
const size = state.kind === "meta" || state.kind === "grid" ? state.size : null;
|
|
31653
31660
|
const grid = state.kind === "grid" ? state.grid : null;
|
|
31654
31661
|
const xlsxMeta = grid?.ingested.xlsx;
|
|
@@ -31662,7 +31669,7 @@ function DataCardWidget({
|
|
|
31662
31669
|
children: [
|
|
31663
31670
|
/* @__PURE__ */ jsxs48("div", { className: "squisq-data-card-header", children: [
|
|
31664
31671
|
/* @__PURE__ */ jsx64("span", { className: "squisq-data-card-icon", "aria-hidden": "true", children: "\u{1F4CA}" }),
|
|
31665
|
-
/* @__PURE__ */ jsx64("span", { className: "squisq-data-card-name", title: href, children: fileName }),
|
|
31672
|
+
/* @__PURE__ */ jsx64("span", { className: "squisq-data-card-name", title: decodeHrefForDisplay(href), children: fileName }),
|
|
31666
31673
|
/* @__PURE__ */ jsx64("span", { className: "squisq-data-card-meta", children: [
|
|
31667
31674
|
state.kind === "missing" ? "not found in this document\u2019s files" : null,
|
|
31668
31675
|
state.kind === "loading" ? "loading\u2026" : null,
|
|
@@ -41358,12 +41365,29 @@ function loadPreparation() {
|
|
|
41358
41365
|
import("@bendyline/squisq-formats/html-icons"),
|
|
41359
41366
|
import("@bendyline/squisq-formats/diagrams"),
|
|
41360
41367
|
import("@bendyline/squisq-react/diagram-pictures")
|
|
41361
|
-
]).then(([prep, icons, diagrams, pictures]) =>
|
|
41362
|
-
|
|
41363
|
-
|
|
41364
|
-
|
|
41365
|
-
|
|
41366
|
-
|
|
41368
|
+
]).then(([prep, icons, diagrams, pictures]) => {
|
|
41369
|
+
const unthemed = diagrams.cachingDiagramRasterizer(pictures.createDiagramPictureRenderer());
|
|
41370
|
+
const themed = /* @__PURE__ */ new Map();
|
|
41371
|
+
return {
|
|
41372
|
+
needs: prep.needsPlainHtmlPreparation,
|
|
41373
|
+
prepare: prep.prepareMarkdownDocForPlainHtml,
|
|
41374
|
+
diagramRenderer: (theme) => {
|
|
41375
|
+
if (!theme) return unthemed;
|
|
41376
|
+
const key = JSON.stringify(theme);
|
|
41377
|
+
let renderer = themed.get(key);
|
|
41378
|
+
if (!renderer) {
|
|
41379
|
+
renderer = diagrams.cachingDiagramRasterizer(
|
|
41380
|
+
pictures.createDiagramPictureRenderer({ theme, background: theme.colors.background })
|
|
41381
|
+
);
|
|
41382
|
+
themed.set(key, renderer);
|
|
41383
|
+
const oldest = themed.size > 8 ? themed.keys().next().value : void 0;
|
|
41384
|
+
if (oldest !== void 0) themed.delete(oldest);
|
|
41385
|
+
}
|
|
41386
|
+
return renderer;
|
|
41387
|
+
},
|
|
41388
|
+
outlineIcons: icons.plainHtmlIcons
|
|
41389
|
+
};
|
|
41390
|
+
}));
|
|
41367
41391
|
return preparationPromise;
|
|
41368
41392
|
}
|
|
41369
41393
|
var PREPARE_DELAY_MS = 300;
|
|
@@ -41477,22 +41501,23 @@ function PlainHtmlPreview({
|
|
|
41477
41501
|
() => container ? dataTableCacheFor(container, mediaRevision ?? 0) : void 0,
|
|
41478
41502
|
[container, mediaRevision]
|
|
41479
41503
|
);
|
|
41504
|
+
const renderDiagram = useMemo52(() => preparation?.diagramRenderer(theme), [preparation, theme]);
|
|
41480
41505
|
const needsPreparation = useMemo52(
|
|
41481
|
-
() => preparation
|
|
41482
|
-
renderDiagram
|
|
41506
|
+
() => !!preparation && !!renderDiagram && preparation.needs(mdDoc, {
|
|
41507
|
+
renderDiagram,
|
|
41483
41508
|
outlineIcons: preparation.outlineIcons,
|
|
41484
41509
|
container
|
|
41485
|
-
})
|
|
41486
|
-
[preparation, mdDoc, container]
|
|
41510
|
+
}),
|
|
41511
|
+
[preparation, renderDiagram, mdDoc, container]
|
|
41487
41512
|
);
|
|
41488
41513
|
const [prepared, setPrepared] = useState76(null);
|
|
41489
41514
|
const preparedOnceRef = useRef60(false);
|
|
41490
41515
|
useEffect66(() => {
|
|
41491
|
-
if (!preparation || !needsPreparation) return;
|
|
41516
|
+
if (!preparation || !renderDiagram || !needsPreparation) return;
|
|
41492
41517
|
let cancelled = false;
|
|
41493
41518
|
const prepare = () => {
|
|
41494
41519
|
preparation.prepare(mdDoc, {
|
|
41495
|
-
renderDiagram
|
|
41520
|
+
renderDiagram,
|
|
41496
41521
|
outlineIcons: preparation.outlineIcons,
|
|
41497
41522
|
container,
|
|
41498
41523
|
dataTableCache
|
|
@@ -41512,7 +41537,7 @@ function PlainHtmlPreview({
|
|
|
41512
41537
|
cancelled = true;
|
|
41513
41538
|
clearTimeout(timer);
|
|
41514
41539
|
};
|
|
41515
|
-
}, [preparation, needsPreparation, mdDoc, container, dataTableCache]);
|
|
41540
|
+
}, [preparation, renderDiagram, needsPreparation, mdDoc, container, dataTableCache]);
|
|
41516
41541
|
const view = needsPreparation ? prepared : null;
|
|
41517
41542
|
const [renderFn, setRenderFn] = useState76(() => cachedRender);
|
|
41518
41543
|
useEffect66(() => {
|
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.21",
|
|
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.14",
|
|
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.16",
|
|
108
|
+
"@bendyline/squisq-grid-react": "2.11.43",
|
|
109
|
+
"@bendyline/squisq-react": "2.12.26",
|
|
110
|
+
"@bendyline/squisq-video-react": "2.5.27",
|
|
111
111
|
"@fortawesome/fontawesome-free": "7.3.1",
|
|
112
112
|
"@tiptap/core": "2.27.3",
|
|
113
113
|
"@tiptap/extension-heading": "2.27.3",
|