Replace unmaintained html2canvas with @zumer/snapdom for mind-map/image export

オープン
#1,210 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, typescript
領域
frontend

調査の方向性

Start with src/components/studio/views/html2canvas-loader.ts, which isolates the dependency behind a loader, then inspect src/components/studio/views/mindmap-export.ts for option and return-value usage. Replace the dynamic import with @zumer/snapdom, map the supported options, and update src/components/studio/views/mindmap-export.test.ts to verify the export behavior rather than matching html2canvas output. Also check the standalone HTML reader path for embedded captures and DPR or size handling.

索引モデルが issue の本文から書いたものです。

説明

chore deps priority: medium

Summary

html2canvas (used for mind-map/PNG export) has had no stable release since January 2022 (1.4.1); its own README still describes the project as experimental and recommends against production use. The 2026 ecosystem consensus replacement is a foreignObject-based capture library — @zumer/snapdom (actively maintained, v2.x, zero-dependency, TypeScript).

Evidence

  • Dependency: html2canvas ^1.4.1 in package.json.
  • Usage: src/components/studio/views/html2canvas-loader.ts (dedicated loader) and src/components/studio/views/mindmap-export.ts (consumer).
  • Tests exist, which keeps the migration safe: src/components/studio/views/mindmap-export.test.ts.

Impact

  • Fidelity: html2canvas hand-paints CSS in JS and ships a long list of unsupported properties (pseudo-elements, some fonts, Shadow DOM). SnapDOM clones the DOM and lets the browser rasterize, so styled mind-map exports (custom themes, web fonts from "Editorial Paper & Saffron") render correctly.
  • Performance: serialize-then-rasterize is several times faster on dense mind-map trees; html2canvas cost grows per node in its JS interpreter.
  • Supply chain / maintenance: an unmaintained rendering dependency is a standing risk in the dependency-audit posture this repo already enforces (scripts/verify-deps.sh, Dependabot alerts).

Proposed approach

  1. Swap the loader (html2canvas-loader.ts) to dynamically import @zumer/snapdom behind the same interface — the loader abstraction makes this a one-module change.
  2. Map options (scale, backgroundColor, filter) per the official migration guide; mind the return-value change (reusable CaptureResult).
  3. Re-baseline mindmap-export.test.ts against live rendering, not against html2canvas output (differences are usually features html2canvas was dropping).
  4. Verify export size + DPR handling in the encrypted standalone HTML reader path if it embeds captures.

References

主要言語
TypeScript
スター
3
フォーク
2
平均マージ
11時間 49分
マージ済み PR(30日)
102

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

d-oit/do-knowledge-studio のほかの issue

d-oit/do-knowledge-studio の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。