Files
multica/packages/views/locales/ja/editor.json
Naiyuan Qing 17ee59ccc5 feat(editor): standard Mermaid viewer with pan/zoom, exports and a real dialog (MUL-4908) (#5564)
* feat(editor): standard Mermaid viewer with pan/zoom, exports and a real dialog (MUL-4908)

Mermaid's fullscreen view was a bespoke lightbox: no visible close button, no
canvas interaction, and a toolbar that scrolled away with wide diagrams. Escape
also stopped working once the iframe took focus, which is why it read as
"impossible to close".

Replace it with a viewer built on the shared Dialog, so it inherits the
backdrop, focus trap, scroll lock, focus restore and Escape handling that HTML
preview already had.

The diagram stays in an `sandbox=""` iframe — isolation is not relaxed to buy
interactivity. Instead the iframe is `pointer-events: none` and pan/zoom is
applied from the host document as a transform on its wrapper. That inversion is
also what keeps Escape working: the iframe can never take focus.

- Viewer: fit-on-open, drag pan, wheel/pinch/keyboard zoom (25%-400%) anchored
  at the pointer, Fit / 100% / Reset, and a header toolbar that cannot scroll
  away. Panning is clamped so the canvas can never be lost.
- Export: `.mmd`, `.svg` and `.png`. Requires `htmlLabels: false` — browsers do
  not rasterize Mermaid's default HTML-in-foreignObject labels through an
  `<img>`; verified in Chromium that they paint zero pixels AND taint the
  canvas, so PNG export silently produced nothing.
- Inline: toolbar lifted out of the scroll container, natural-size rendering
  (small diagrams centered, wide ones scroll at a readable size with edge
  fades), copy source, and a parser message on the error fallback.
- Theme switches no longer close the viewer or discard zoom/position; the
  previous diagram stays on screen until its replacement is ready.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(editor): stop Mermaid drags selecting text and misfiring the viewer (MUL-4908)

Two gesture defects on the inline diagram, reported by Naiyuan.

1. Dragging a diagram started a native text selection. The iframe is a replaced
   element, so the whole diagram box got painted with the selection highlight
   and the drag ran on into the surrounding comment text. Fixed with
   `user-select: none` on the inline scroller and the viewer canvas.

   Deliberately NOT by preventDefault-ing pointerdown: verified in Chromium that
   it also drops the default focus, which silently kills the viewer's keyboard
   controls (+/-, 0, arrows).

2. Any drag ended in a `click`, so trying to look along a wide diagram opened
   the viewer on top of the user. The inline diagram had no drag handling at
   all — only `onClick`. Suppressing the selection alone would have made this
   fire more reliably, not less, so both had to land together.

   Past a 5px threshold the gesture is a drag for good: releasing no longer
   taps, and a horizontal drag pans the scroller instead. This holds even when
   the diagram has no room to scroll, so an unscrollable diagram cannot open on
   release either. A still click, a sub-threshold jitter, and the expand button
   all still open the viewer.

Touch is left alone — it already pans natively and its vertical drags belong to
the page; the browser announces its takeover with pointercancel. Mouse and pen
have no native drag-to-scroll and are panned here.

Verified in Chromium: still click opens; a 150px drag pans and does not open; a
drag on an unscrollable diagram does not open; 3px jitter still opens; and no
gesture selects text.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: Walt <walt@multica.ai>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-17 16:07:37 +08:00

110 lines
4.0 KiB
JSON

{
"bubble_menu": {
"bold": "太字",
"italic": "斜体",
"strikethrough": "取り消し線",
"code": "コード",
"highlight": "ハイライト",
"link": "リンク",
"list": "リスト",
"task_list": "タスクリスト",
"quote": "引用",
"url_aria_label": "URL",
"heading_dropdown": {
"text": "テキスト",
"normal_text": "標準テキスト",
"heading_1": "見出し 1",
"heading_2": "見出し 2",
"heading_3": "見出し 3"
},
"list_dropdown": {
"bullet_list": "箇条書きリスト",
"ordered_list": "番号付きリスト",
"task_list": "タスクリスト"
},
"sub_issue": {
"tooltip": "選択範囲からサブイシューを作成",
"created": "{{identifier}} を作成しました",
"create_failed": "サブイシューを作成できませんでした"
}
},
"image": {
"view": "画像を表示",
"download": "ダウンロード",
"copy_link": "リンクをコピー",
"delete": "削除",
"link_copied": "リンクをコピーしました",
"copy_link_failed": "リンクをコピーできませんでした"
},
"attachment": {
"download_failed": "ダウンロードリンクを取得できませんでした。しばらくしてからもう一度お試しください。",
"preview": "プレビュー",
"preview_loading": "プレビューを読み込み中…",
"preview_failed": "プレビューを読み込めませんでした",
"preview_too_large": "ファイルが大きすぎてプレビューできません。ダウンロードしてください。",
"preview_unsupported": "このファイル形式はプレビューできません。",
"close": "閉じる",
"open_in_new_tab": "新しいタブで開く",
"remove": "添付ファイルを削除"
},
"link_hover": {
"copy_link": "リンクをコピー",
"open_link": "リンクを開く",
"link_copied": "リンクをコピーしました",
"copy_failed": "コピーできませんでした"
},
"mention": {
"group_users": "ユーザー",
"group_issues": "イシュー",
"all_members": "すべてのメンバー",
"searching": "検索中...",
"no_results": "結果なし",
"group_current": "現在のページ",
"group_recent": "最近見た項目",
"group_search": "検索結果"
},
"code_block": {
"copy_code": "コードをコピー",
"show_preview": "プレビューを表示",
"show_source": "ソースを表示",
"fullscreen": "全画面"
},
"file_card": {
"uploading": "{{filename}} をアップロード中"
},
"upload": {
"failed": "{{filename}} をアップロードできませんでした: {{reason}}",
"in_progress": "アップロード中…"
},
"title_editor": {
"title_aria_label": "タイトル"
},
"mermaid": {
"render_error": "Mermaid ダイアグラムを描画できません。",
"rendering": "ダイアグラムを描画中…",
"viewer_title": "ダイアグラム",
"canvas_label": "ダイアグラムキャンバス。ドラッグで移動、スクロールで拡大縮小できます。",
"open_viewer": "ダイアグラムビューアを開く",
"close_viewer": "閉じる",
"copy_source": "ダイアグラムのソースをコピー",
"show_source": "ソースを表示",
"show_diagram": "ダイアグラムを表示",
"zoom_in": "拡大",
"zoom_out": "縮小",
"zoom_fit": "画面に合わせる",
"zoom_actual": "実際のサイズ",
"reset_view": "表示をリセット",
"export": "エクスポート",
"export_png": "PNG をダウンロード",
"export_svg": "SVG をダウンロード",
"export_source": ".mmd をダウンロード"
},
"slash_command": {
"no_skills_configured": "設定済みスキルなし",
"no_results": "一致するスキルなし",
"commands": {
"note": "メモを追加 — エージェントをトリガーしません"
}
}
}