@file-viewer/renderer-drawing 2.1.30 → 2.2.0
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/drawing.js +10 -3
- package/package.json +2 -2
package/dist/drawing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createFileViewerTranslator, createFileViewerZoomChangeEmitter, registerFileViewerZoomProvider, readFileViewerText, resolveFileViewerDrawioViewerScriptUrl, waitForFileViewerNextPaint, unregisterFileViewerZoomProvider, } from '@file-viewer/core';
|
|
1
|
+
import { createFileViewerTranslator, createFileViewerZoomChangeEmitter, registerFileViewerZoomProvider, readFileViewerText, resolveFileViewerDrawioViewerScriptUrl, resolveFileViewerRuntimeAssetBaseUrl, waitForFileViewerNextPaint, unregisterFileViewerZoomProvider, } from '@file-viewer/core';
|
|
2
2
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
3
3
|
const EXCALIDRAW_OFFICIAL_TIMEOUT = 6000;
|
|
4
4
|
const DRAWIO_OFFICIAL_TIMEOUT = 6000;
|
|
@@ -75,7 +75,7 @@ const isTransparent = (color) => {
|
|
|
75
75
|
return !color || color === 'transparent' || color === 'rgba(0, 0, 0, 0)';
|
|
76
76
|
};
|
|
77
77
|
const resolveDrawingViewerScriptUrl = (options, documentRef) => {
|
|
78
|
-
return resolveFileViewerDrawioViewerScriptUrl(options, documentRef
|
|
78
|
+
return resolveFileViewerDrawioViewerScriptUrl(options, documentRef ? resolveFileViewerRuntimeAssetBaseUrl(documentRef) : undefined);
|
|
79
79
|
};
|
|
80
80
|
const resolveDirectoryUrl = (url) => {
|
|
81
81
|
try {
|
|
@@ -202,6 +202,11 @@ const importOptionalExcalidraw = async () => {
|
|
|
202
202
|
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
203
203
|
return dynamicImport('@excalidraw/excalidraw');
|
|
204
204
|
};
|
|
205
|
+
const isMissingOptionalExcalidraw = (error) => {
|
|
206
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
207
|
+
return message.includes('@excalidraw/excalidraw') &&
|
|
208
|
+
/(?:resolve|find|module|specifier)/i.test(message);
|
|
209
|
+
};
|
|
205
210
|
const suppressExcalidrawWorkerWarning = () => {
|
|
206
211
|
const originalError = console.error;
|
|
207
212
|
const patchedError = (...args) => {
|
|
@@ -462,7 +467,9 @@ const renderExcalidraw = async (documentRef, text, target, t) => {
|
|
|
462
467
|
await runWithTimeout(renderOfficialExcalidraw(payload, elements, target), EXCALIDRAW_OFFICIAL_TIMEOUT, t('drawing.error.excalidrawTimeout'));
|
|
463
468
|
}
|
|
464
469
|
catch (error) {
|
|
465
|
-
|
|
470
|
+
if (!isMissingOptionalExcalidraw(error)) {
|
|
471
|
+
console.warn(error);
|
|
472
|
+
}
|
|
466
473
|
await renderRoughFallback(documentRef, payload, elements, target);
|
|
467
474
|
}
|
|
468
475
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-drawing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone Draw.io, Excalidraw, Mermaid, and PlantUML renderer plugin for Flyfish File Viewer with pan/zoom support.",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"LICENSE"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@file-viewer/core": "2.
|
|
59
|
+
"@file-viewer/core": "2.2.0",
|
|
60
60
|
"@panzoom/panzoom": "^4.6.2",
|
|
61
61
|
"mermaid": "^11.15.0",
|
|
62
62
|
"plantuml-encoder": "^1.4.0",
|