@file-viewer/renderer-drawing 2.1.13 → 2.1.15
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/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/drawing.js +5 -1
- package/package.json +2 -3
package/README.en.md
CHANGED
|
@@ -5,7 +5,7 @@ Standalone Draw.io, Excalidraw, Mermaid, and PlantUML renderer for Flyfish File
|
|
|
5
5
|
## Highlights
|
|
6
6
|
|
|
7
7
|
- Uses the bundled diagrams.net offline viewer for `drawio` / `dio` files.
|
|
8
|
-
-
|
|
8
|
+
- Renders `excalidraw` as a stable read-only SVG through `roughjs` by default. If the runtime provides the official `@excalidraw/excalidraw` ESM module, the renderer tries `restore` and `exportToSvg` first and falls back automatically.
|
|
9
9
|
- Lazy-loads the official `mermaid` renderer for `mermaid` / `mmd` files and outputs theme-aware SVG.
|
|
10
10
|
- Keeps `plantuml` / `puml` files fully offline by default with an SVG source preview; configure `options.drawing.plantumlServerUrl` for full PlantUML SVG rendering through a self-hosted endpoint. When that endpoint is unavailable, the renderer still falls back to the offline preview instead of a blank view or broken image.
|
|
11
11
|
- Mermaid and PlantUML previews use `@panzoom/panzoom` for drag panning, Ctrl/Command wheel zoom, and common toolbar zoom sync.
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Flyfish File Viewer 的独立绘图渲染器,覆盖 `drawio`、`dio`、`excali
|
|
|
5
5
|
## 特性
|
|
6
6
|
|
|
7
7
|
- `drawio` / `dio` 默认使用随 viewer assets 分发的 diagrams.net offline viewer。
|
|
8
|
-
- `excalidraw`
|
|
8
|
+
- `excalidraw` 默认使用 `roughjs` 生成稳定只读 SVG;如果运行环境已提供官方 `@excalidraw/excalidraw` ESM 模块,会优先尝试 `restore` 与 `exportToSvg`,失败时自动回退。
|
|
9
9
|
- `mermaid` / `mmd` 按需加载官方 `mermaid`,输出主题适配 SVG。
|
|
10
10
|
- `plantuml` / `puml` 默认保持离线 SVG 源码预览;需要完整 PlantUML 渲染时,可通过 `options.drawing.plantumlServerUrl` 指向自托管 SVG 端点,端点不可用时仍会回落到离线预览,避免白屏或 broken image。
|
|
11
11
|
- Mermaid / PlantUML 预览使用 `@panzoom/panzoom` 提供拖拽平移、Ctrl/Command 滚轮缩放和统一工具栏缩放联动。
|
package/dist/drawing.js
CHANGED
|
@@ -198,6 +198,10 @@ const appendRenderedSvg = (target, svg, mode) => {
|
|
|
198
198
|
svg.classList.add('drawing-svg');
|
|
199
199
|
target.appendChild(svg);
|
|
200
200
|
};
|
|
201
|
+
const importOptionalExcalidraw = async () => {
|
|
202
|
+
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
203
|
+
return dynamicImport('@excalidraw/excalidraw');
|
|
204
|
+
};
|
|
201
205
|
const suppressExcalidrawWorkerWarning = () => {
|
|
202
206
|
const originalError = console.error;
|
|
203
207
|
const patchedError = (...args) => {
|
|
@@ -419,7 +423,7 @@ const renderOfficialExcalidraw = async (payload, elements, target) => {
|
|
|
419
423
|
// 实际会继续使用主线程导出,这里只屏蔽这条已知噪声。
|
|
420
424
|
const restoreConsole = suppressExcalidrawWorkerWarning();
|
|
421
425
|
const restoreTimer = setTimeout(restoreConsole, EXCALIDRAW_OFFICIAL_TIMEOUT + 1000);
|
|
422
|
-
const { exportToSvg, restore } = await
|
|
426
|
+
const { exportToSvg, restore } = await importOptionalExcalidraw();
|
|
423
427
|
try {
|
|
424
428
|
const restored = restore({
|
|
425
429
|
elements: elements,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-drawing",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
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,8 +56,7 @@
|
|
|
56
56
|
"LICENSE"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@file-viewer/core": "^2.1.13",
|
|
59
|
+
"@file-viewer/core": "^2.1.15",
|
|
61
60
|
"@panzoom/panzoom": "^4.6.2",
|
|
62
61
|
"mermaid": "^11.15.0",
|
|
63
62
|
"plantuml-encoder": "^1.4.0",
|