Compare commits
3
Commits
bd80ff6a0c
...
v0.16.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02fb77f72b | ||
|
|
09afb438c9 | ||
|
|
2d6ceac0d7 |
No files matched your search
@@ -35,8 +35,8 @@ jobs:
|
|||||||
[worker.oci]
|
[worker.oci]
|
||||||
max-parallelism = 2
|
max-parallelism = 2
|
||||||
|
|
||||||
- name: Test release tooling and wallpaper palette
|
- name: Test release tooling and browser logic
|
||||||
run: node --test tools/ci/release-images.test.mjs static/js/home-palette-core.test.cjs
|
run: node --test tools/ci/release-images.test.mjs static/js/home-palette-core.test.cjs static/js/csv-core.test.cjs
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
uses: https://github.com/docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
uses: https://github.com/docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
||||||
|
|||||||
@@ -342,6 +342,12 @@ window.PagesWikiEditor = {
|
|||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (options.preserveLineEndings) {
|
||||||
|
// Split only at LF, keeping any CR bytes in the document. This
|
||||||
|
// preserves mixed LF/CRLF CSV sources instead of rewriting them.
|
||||||
|
extensions.push(EditorState.lineSeparator.of("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
if (keymapName === "vim") {
|
if (keymapName === "vim") {
|
||||||
installVimCommands();
|
installVimCommands();
|
||||||
extensions.push(vim());
|
extensions.push(vim());
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
- `+` は挿入・下書き、`文` は言語の編集・分岐、`↶` は旧リビジョンを作業バッファへ
|
- `+` は挿入・下書き、`文` は言語の編集・分岐、`↶` は旧リビジョンを作業バッファへ
|
||||||
読み込む。復元は明示保存で新 Revision を追加し、旧 Revision を書き換えない。
|
読み込む。復元は明示保存で新 Revision を追加し、旧 Revision を書き換えない。
|
||||||
履歴は50件ずつ追加取得し、現在言語で絞り込む。分岐は翻訳生成ではなく本文のコピー。
|
履歴は50件ずつ追加取得し、現在言語で絞り込む。分岐は翻訳生成ではなく本文のコピー。
|
||||||
- 挿入は子ページ・表・画像キャプション・補足・コード・引用の6種の初期パレット。
|
- 挿入は子ページ・表・画像キャプション・補足・コード・引用・CSV macroの初期パレット。
|
||||||
画像 URL 等のプレースホルダーは編集が必要。ファイルピッカー、図形・外部 widget の
|
画像 URL 等のプレースホルダーは編集が必要。ファイルピッカー、図形・外部 widget の
|
||||||
パラメータ編集、プラグインによる挿入パーツ登録は既存の HTML editor 設計に残る。
|
パラメータ編集、プラグインによる挿入パーツ登録は既存の HTML editor 設計に残る。
|
||||||
- touch/coarse pointer + hover 不可の端末ではデスクトップの Vim 設定を上書きせず、
|
- touch/coarse pointer + hover 不可の端末ではデスクトップの Vim 設定を上書きせず、
|
||||||
@@ -78,6 +78,8 @@
|
|||||||
|
|
||||||
## 次段階の実装順序
|
## 次段階の実装順序
|
||||||
|
|
||||||
|
CSVの表編集は既存保存・下書き・履歴の契約へ接続済みです。CSVはHTML変換と文字列自動マージを行わず、競合時は比較して採否を決めます。BOMと混在改行を保持するため、CSV初期値はHTMLのtextarea解析を通さず安全なJS文字列として渡し、CodeMirrorはLFのみで分割します。初期フォーカスの遅延処理も、表セルなどへ移ったフォーカスを奪いません。詳細な上限と残件は[表設計](extensions.md)を参照してください。
|
||||||
|
|
||||||
1. **E6a presence**:編集中リースの共有ストアと認可付き API、別端末を含む表示。
|
1. **E6a presence**:編集中リースの共有ストアと認可付き API、別端末を含む表示。
|
||||||
管理者にだけ見える監視ではなく、同じ Page/language を編集できる参加者に限定する。
|
管理者にだけ見える監視ではなく、同じ Page/language を編集できる参加者に限定する。
|
||||||
2. **E6b realtime**:下記 CRDT 詳細設計・採用ライブラリ・同時変換ルールを確定した後に
|
2. **E6b realtime**:下記 CRDT 詳細設計・採用ライブラリ・同時変換ルールを確定した後に
|
||||||
|
|||||||
@@ -48,13 +48,25 @@ IPアドレス管理(IPAM)、DNSゾーン/レコード管理、機器・
|
|||||||
|
|
||||||
## CSV/表・スライド拡張(設計TODO)
|
## CSV/表・スライド拡張(設計TODO)
|
||||||
|
|
||||||
初期CSV macroは実装済みです。`{{csv:/data/items.csv range=A1:H200 header=true}}` を認証済みProjectionで展開し、`rev=` で同じObjectのRevisionへ固定できます。現在のPath閲覧権限を毎回検査し、外部URL、匿名公開、asset指定、共有キャッシュ、CSV編集はこの段階に含めません。入力256 KiB・UTF-8、表示200行×32列、走査2,000行・100列、セル16 KiB、Projection当たり4種類のCSVまでに制限します。引用符・改行・BOMに対応し、セルはHTML escapeしてmacroや数式を実行しません。処理不能時は内容を漏らさない警告に置き換えます。Authoringでは元のmacroを保持します。
|
初期CSV macroは実装済みです。`{{csv:/data/items.csv range=A1:H200 header=true}}` を認証済みProjectionで展開し、`rev=` で同じObjectのRevisionへ固定できます。現在のPath閲覧権限を毎回検査し、外部URL、匿名公開、asset指定、共有キャッシュはこの段階に含めません。入力256 KiB・UTF-8、表示200行×32列、走査2,000行・100列、セル16 KiB、Projection当たり4種類のCSVまでに制限します。引用符・改行・BOMに対応し、セルはHTML escapeしてmacroや数式を実行しません。処理不能時は内容を漏らさない警告に置き換えます。Authoringでは元のmacroを保持します。
|
||||||
|
|
||||||
CSVをPage本文へ複製せず、認可済みの別Documentをテーブルとして投影するmacroを用意します。候補構文は `{{csv:/data/items.csv range=A1:H200 header=true}}` とし、Path、Revision(またはasset hash)、列・行上限、表示モードを正規化してキャッシュキーに含めます。macroは表示時にboundedなProjectionを作るだけで、結果HTMLを正本へ逆流させません。CSV Editorは元Revisionを編集し、表投影とは別の操作・競合・権限として扱います。
|
既存CSVの編集は `/e/-/{path}` の組み込みエディタで行います。デスクトップはソースと表を並べ、700px以下では表を全幅表示してソースへ切り替えます。セル編集、行・列追加/削除、20操作までの表のUndo/Redoに対応。表は200行・32列・セル16 KiB以内を25行ずつ描画し、先頭行を自動でヘッダ扱いしません。矩形でない行の欠落セルは表示だけでは補わず、列追加・貼り付けで必要になった部分だけ空セルを補います。全体256 KiB・UTF-8以内を対象とし、超過・不正形式の表を部分編集可能にして保存することはありません。表上限を超えても全体上限内ならソースで編集できます。
|
||||||
|
|
||||||
|
表計算ソフトからの複数セル貼り付けは、フォーカス中のセルを左上として反映します。クリップボードの `text/plain` にタブまたは改行があればタブ区切り表として解析し、引用符内の改行・タブ・二重引用符を保持します。カンマは列区切りにせずセル値として扱い、単一行の通常テキストはセル内への貼り付けです。複数行を一つのセルへ貼る場合は引用符で囲むかソースを編集します。HTML形式のクリップボードは使いません。必要な行・セルの拡張を含めて1操作でUndo/Redoでき、構文・行列・セル・変換後CSV全体の上限を検査してから一括反映します。失敗時は部分反映せず、既存のUndo履歴も変更しません。貼り付け範囲外のセルと改行形式は維持します。
|
||||||
|
|
||||||
|
CSV正本をHTMLへ変換せず、未変更fieldの引用符、BOM、混在LF/CRLFを保持します。セル内のHTML、macro、数式は実行しません。表編集も既存の下書き・認証切れ検出・言語別Revision CAS・履歴復元を使用し、他の保存と競合したCSVは文字列の自動マージをせず比較画面へ送ります。原文と編集済み表の両方を別正本として保存しません。DBスキーマ変更はありません。CSV新規作成ウィザード、TSVファイル/文字コード変換、大容量表のwindow編集、矩形選択/範囲コピー、列型/数式、ODSは残件です。
|
||||||
|
|
||||||
|
CSVをPage本文へ複製せず、認可済みの別Documentをテーブルとして投影します。共有キャッシュを将来追加する際は、Path、Revision(またはasset hash)、列・行上限、表示モードと権限を考慮します。macroは表示時にboundedなProjectionを作るだけで、結果HTMLを正本へ逆流させません。CSV Editorは元Revisionを編集し、表投影とは別の操作・競合・権限として扱います。
|
||||||
|
|
||||||
交換形式はRFC 4180互換CSV(UTF-8、CRLF、引用符・改行を含むfield、BOMの扱いを明示)を第一正本とします。複数シート、型、数式、結合セル、書式が必要な場合はODSを別アダプタ/Assetとして扱い、CSVへの不可逆変換を黙って行いません。行数、列数、セル長、総バイト、ネストmacroを制限し、malformed inputは安全なテキスト表示へfallbackします。
|
交換形式はRFC 4180互換CSV(UTF-8、CRLF、引用符・改行を含むfield、BOMの扱いを明示)を第一正本とします。複数シート、型、数式、結合セル、書式が必要な場合はODSを別アダプタ/Assetとして扱い、CSVへの不可逆変換を黙って行いません。行数、列数、セル長、総バイト、ネストmacroを制限し、malformed inputは安全なテキスト表示へfallbackします。
|
||||||
|
|
||||||
スライドは、Markdown/HTMLの正本からReveal.js互換のProjectionを生成する連携アダプタを設けます。HedgeDoc、Slidevは外部originのホスト型アダプタとして、保存・公開・ユーザー情報をPages Wikiの権限へ自動昇格させず、read-only preview→明示的なimport/saveの順にします。JSを使用できない環境向けには、CSS scroll-snap/`:target`/print CSSだけでページ送りできるCSS-only Slide Editorを別実装します。外部ランタイム停止時は静的HTML/Markdownへ安全にfallbackし、任意script、remote import、iframe権限を本文から許可しません。
|
スライドはローカル同梱のReveal.js 6.0.2で表示します。`/v/slides/{path}` は通常のPath閲覧権限でHTML/Markdownの最新Revisionを取得し、HTMLページのスライドアイコンや「連携アダプタで開く」から移動できます。組み込みHTML/Markdownエディタのスライドアイコンは、未保存の本文を通常プレビューと同じ変換経路で投影します。表示DOMを保存せず、保存・下書き・競合処理は既存エディタに任せます。Markdownの空行で囲んだ `---`、HTMLの直下の `<hr>` が横方向の区切りで、直下の `<section>` も1枚として扱います。コードブロック内の区切りは分割しません。
|
||||||
|
|
||||||
|
Reveal実行は `allow-scripts allow-popups` のsandbox iframeに隔離し、`allow-same-origin` は付けません。本文のscript・CSS・iframe・フォーム・任意data属性を渡さず、独自プラグインや外部Markdownを読み込みません。画像は同一originだけ、リンクはHTTP(S)だけです。矢印キー・タッチ・画面内コントロールで移動し、履歴やURL hashを変更しません。ビューアは全画面に対応し、背景・文字色はテーマから引き継ぎます。ライブラリ読込失敗時は静的なサニタイズ済み本文へfallbackします。本文256 KiB・100枚・DOM 10,000ノード/深さ64を上限とし、常時バックグラウンド生成や共有キャッシュは持ちません。`viewer.slides` は拡張設定でドメイン単位に停止でき、停止後のページではビューア・編集切替・アダプタ候補を表示しません。MITライセンス・固定版・配布元・hashは `static/vendor/reveal/` に同梱します。DBスキーマ変更はありません。
|
||||||
|
|
||||||
|
700px以下の編集画面ではスライドプレビューを全幅表示し、既存のプレビュー非表示ボタンでソースへ戻ります。小画面で自動スクロール形式に変わらないよう `scrollActivationWidth: null` を指定します([Reveal.js公式仕様](https://revealjs.com/scroll-view/))。
|
||||||
|
|
||||||
|
縦方向のスライド、fragments、発表者ノート、macroの非同期展開、スライド専用印刷、外部画像の承認連携は残件です。HedgeDoc、Slidevは外部originのホスト型アダプタとして、保存・公開・ユーザー情報をPages Wikiの権限へ自動昇格させず、read-only preview→明示的なimport/saveの順にします。JSを使用できない環境向けには、CSS scroll-snap/`:target`/print CSSだけでページ送りできるCSS-only Slide Editorを別実装します。
|
||||||
|
|
||||||
ネットワーク図ではnwdiagを追加候補とします。ソースをbounded parserで検証し、renderer version/theme/document hashをキーに静的SVGをキュー生成します。include、外部画像・font、未知directive、危険なSVG属性は拒否し、renderer停止時はescaped sourceまたは最後に検証済みの静的画像へfallbackします。編集アダプタの保存はone-use ticketと楽観的Revision競合を使い、Kroki経由の場合もorigin、timeout、quotaを明示します。
|
ネットワーク図ではnwdiagを追加候補とします。ソースをbounded parserで検証し、renderer version/theme/document hashをキーに静的SVGをキュー生成します。include、外部画像・font、未知directive、危険なSVG属性は拒否し、renderer停止時はescaped sourceまたは最後に検証済みの静的画像へfallbackします。編集アダプタの保存はone-use ticketと楽観的Revision競合を使い、Kroki経由の場合もorigin、timeout、quotaを明示します。
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ P0は認可・整合性・復旧の安全条件、P1は日常利用の回復性
|
|||||||
| SHARE-01 / P2 | 未実装:委譲share URL、期限/失効/監査、説明可能な権限総覧 | AUTH-01、PUB-01。login/adapter/federation資格情報と別目的、単一Page投影、caveat・依存物の失効を検証 | [公開](publication.md)、[Schutzaria](schutzaria.md) |
|
| SHARE-01 / P2 | 未実装:委譲share URL、期限/失効/監査、説明可能な権限総覧 | AUTH-01、PUB-01。login/adapter/federation資格情報と別目的、単一Page投影、caveat・依存物の失効を検証 | [公開](publication.md)、[Schutzaria](schutzaria.md) |
|
||||||
| COLLAB-01 / P2 | 一部実装:Page等の変更購読、最近閲覧/編集、集約通知。コメント/反応/評価は未実装 | OUT-01。現在権限で再投影、private履歴のopt-in/保持。inline commentはRevision変更時の孤立・再接続を扱う | [拡張](extensions.md) |
|
| COLLAB-01 / P2 | 一部実装:Page等の変更購読、最近閲覧/編集、集約通知。コメント/反応/評価は未実装 | OUT-01。現在権限で再投影、private履歴のopt-in/保持。inline commentはRevision変更時の孤立・再接続を扱う | [拡張](extensions.md) |
|
||||||
| BLOG-01 / P2 | 一部実装:安全なtDiary import、最近コメント、遠隔ブログ射影 | COLLAB-01、遠隔はFED-01。importは再開/重複抑止/dry-run。同一instance射影を再実装しない | [ブログ・日記](blog-diary.md) |
|
| BLOG-01 / P2 | 一部実装:安全なtDiary import、最近コメント、遠隔ブログ射影 | COLLAB-01、遠隔はFED-01。importは再開/重複抑止/dry-run。同一instance射影を再実装しない | [ブログ・日記](blog-diary.md) |
|
||||||
| CSV-01 / P2 | viewerと有界CSV macroを実装。残件:CSV editor、匿名投影、asset指定、ODS境界 | 行列・セル・総量上限、Revision固定、権限、CSV引用/改行fixture。表示HTMLをCSV正本へ逆流させない | [表設計](extensions.md) |
|
| CSV-01 / P2 | viewer・有界CSV macro・既存CSVの表編集/複数セル貼り付けを実装。残件:新規作成UI、大容量編集、矩形選択/範囲コピー、匿名投影、asset指定、ODS境界 | BOM/改行保持、25行描画、行列・セル・総量上限、貼り付けの一括検証/Undo、Revision CAS、権限、競合確認/履歴復元fixture。表示HTMLをCSV正本へ逆流させない | [表設計](extensions.md) |
|
||||||
| DIAGRAM-01 / P2 | 一部実装:nwdiag/Draw.io provider、slide preview/editor | RENDER-01。安全なSVG・include拒否・renderer版固定、ticket/CAS保存、print。既存Excalidraw/Krokiとは分ける | [Kunstzeal](kunstzeal.md) |
|
| DIAGRAM-01 / P2 | Reveal.jsビューア/編集プレビューを実装。残件:nwdiag/Draw.io provider、縦スライド・notes・専用print | RENDER-01。有界入力、sandbox、固定版ローカル同梱、ドメイン単位停止、Path認可。SVG・include拒否・ticket/CAS保存はprovider別に検証 | [Kunstzeal](kunstzeal.md)、[スライド](extensions.md) |
|
||||||
| RECIPE-01 / P2 | 未実装:構造化レシピmetadataとPage投影の初期slice | 材料・数量・未知単位を保持、人数変更は派生値、Asset認可、版競合、出典・公開確認 | [料理レシピ](recipe-management.md) |
|
| RECIPE-01 / P2 | 未実装:構造化レシピmetadataとPage投影の初期slice | 材料・数量・未知単位を保持、人数変更は派生値、Asset認可、版競合、出典・公開確認 | [料理レシピ](recipe-management.md) |
|
||||||
|
|
||||||
## D. 選定・別サブプロジェクト
|
## D. 選定・別サブプロジェクト
|
||||||
@@ -126,7 +126,7 @@ P0は認可・整合性・復旧の安全条件、P1は日常利用の回復性
|
|||||||
- **HOLD-01**:`/tasks/` 配下のメールWikiルーティング調査。利用者の棚上げ指定を維持。関連未コミットファイルを今回の実装・文書コミットへ混ぜない。
|
- **HOLD-01**:`/tasks/` 配下のメールWikiルーティング調査。利用者の棚上げ指定を維持。関連未コミットファイルを今回の実装・文書コミットへ混ぜない。
|
||||||
- **HOLD-02**:vim.wasm runtime改善とnativeアプリ起動。既存設定UIは残すが、自動的に再開しない。
|
- **HOLD-02**:vim.wasm runtime改善とnativeアプリ起動。既存設定UIは残すが、自動的に再開しない。
|
||||||
- **HOLD-03**:全面WYSIWYG、E6 CRDT/OT共同編集。まずEDIT-01と認可/presence契約、保存量・オフライン・競合モデルを確定する。
|
- **HOLD-03**:全面WYSIWYG、E6 CRDT/OT共同編集。まずEDIT-01と認可/presence契約、保存量・オフライン・競合モデルを確定する。
|
||||||
- **HOLD-04**:本番への反映。作業履歴/日次メールのv3/v4移行を含む同世代保全と隔離復元試験、容量確認、SMTP副作用照合が必要。古いbinaryを新schemaへ向ける切戻しは禁止。
|
- **HOLD-04**:本番反映は実装と別ゲート。[v0.15.0までの配備](../../operations/releases/2026-11-08-v0.15.0.md)は完了。追加変更には同世代保全と隔離復元試験、容量確認、外部副作用照合が必要。古いbinaryを新schemaへ向ける切戻しは禁止。
|
||||||
|
|
||||||
## 実装と分けて管理する受入
|
## 実装と分けて管理する受入
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ Cache-Control: private, no-store
|
|||||||
- [ ] ディスクcacheの容量・TTL・清掃、renderer更新時の不整合、障害後の一時ファイル残留を管理する。
|
- [ ] ディスクcacheの容量・TTL・清掃、renderer更新時の不整合、障害後の一時ファイル残留を管理する。
|
||||||
- [ ] provider宛通信と描画サービス内の外部参照を分け、送信許可・接続先・ネットワーク隔離・バージョン固定を契約化する。
|
- [ ] provider宛通信と描画サービス内の外部参照を分け、送信許可・接続先・ネットワーク隔離・バージョン固定を契約化する。
|
||||||
- [ ] nwdiagの有界parser・安全なSVG出力・編集preview、Draw.io等のproviderを追加する。現在のregistryにnwdiagは実装されていない。
|
- [ ] nwdiagの有界parser・安全なSVG出力・編集preview、Draw.io等のproviderを追加する。現在のregistryにnwdiagは実装されていない。
|
||||||
- [ ] Reveal互換・HedgeDoc・Slidev・CSS-onlyスライドのimport/save/printを独立providerとして設計する。
|
- [x] Reveal.jsの有界ビューア・既存HTML/Markdownエディタ内previewをローカル固定版で接続する。Path認可・sandbox・ドメイン停止を持ち、正本への保存は既存エディタを利用する([スライド設計](extensions.md))。
|
||||||
|
- [ ] Revealの縦スライド・発表者notes・専用print、HedgeDoc・Slidev・CSS-onlyスライドのimport/save/printを独立providerとして設計する。
|
||||||
- [ ] Excalidrawのhosted/browser実行とPDF/動画サムネイル・metadata subprocessを、各々の安全境界を維持したまま段階的に接続する。
|
- [ ] Excalidrawのhosted/browser実行とPDF/動画サムネイル・metadata subprocessを、各々の安全境界を維持したまま段階的に接続する。
|
||||||
|
|
||||||
## 検証と反映
|
## 検証と反映
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ type Manifest struct {
|
|||||||
|
|
||||||
func Catalog() []Manifest {
|
func Catalog() []Manifest {
|
||||||
return []Manifest{
|
return []Manifest{
|
||||||
|
{ID: "viewer.slides", APIVersion: 1, Version: "0.1.0", Kind: "viewer", Scope: "domain", NameKey: "slides.title", DescriptionKey: "slides.help", Capabilities: []string{"path.read"}, Events: []string{}, SettingsPanel: "extensions", Builtin: true, Enabled: true, ResourceClass: "client-compute+bounded-read"},
|
||||||
{ID: "viewer.gecko", APIVersion: 1, Version: "0.1.0", Kind: "viewer", Scope: "domain", NameKey: "feeds.gecko", DescriptionKey: "feeds.gecko_help", Capabilities: []string{"feeds.own.read"}, Events: []string{}, SettingsPanel: "extensions", Builtin: true, Enabled: false, ResourceClass: "client-compute+relay-network"},
|
{ID: "viewer.gecko", APIVersion: 1, Version: "0.1.0", Kind: "viewer", Scope: "domain", NameKey: "feeds.gecko", DescriptionKey: "feeds.gecko_help", Capabilities: []string{"feeds.own.read"}, Events: []string{}, SettingsPanel: "extensions", Builtin: true, Enabled: false, ResourceClass: "client-compute+relay-network"},
|
||||||
{ID: "organizer.feeds", APIVersion: 1, Version: "0.1.0", Kind: "feeds", Scope: "domain", NameKey: "feeds.title", DescriptionKey: "feeds.help", Capabilities: []string{"feeds.own.read", "feeds.own.write"}, Events: []string{"feed.source.sync"}, SettingsPanel: "extensions", Builtin: true, Enabled: true, ResourceClass: "background+network+index"},
|
{ID: "organizer.feeds", APIVersion: 1, Version: "0.1.0", Kind: "feeds", Scope: "domain", NameKey: "feeds.title", DescriptionKey: "feeds.help", Capabilities: []string{"feeds.own.read", "feeds.own.write"}, Events: []string{"feed.source.sync"}, SettingsPanel: "extensions", Builtin: true, Enabled: true, ResourceClass: "background+network+index"},
|
||||||
{ID: "organizer.contacts", APIVersion: 1, Version: "0.2.0", Kind: "contacts", Scope: "domain", NameKey: "contacts.title", DescriptionKey: "contacts.help", Capabilities: []string{"contacts.own.read", "contacts.own.write"}, Events: []string{}, SettingsPanel: "extensions", Builtin: true, Enabled: true, ResourceClass: "foreground+index"},
|
{ID: "organizer.contacts", APIVersion: 1, Version: "0.2.0", Kind: "contacts", Scope: "domain", NameKey: "contacts.title", DescriptionKey: "contacts.help", Capabilities: []string{"contacts.own.read", "contacts.own.write"}, Events: []string{}, SettingsPanel: "extensions", Builtin: true, Enabled: true, ResourceClass: "foreground+index"},
|
||||||
|
|||||||
@@ -227,4 +227,9 @@ func textMediaType(descriptor Descriptor) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Catalog returns a copy; callers cannot reorder or disable the shared registry.
|
// Catalog returns a copy; callers cannot reorder or disable the shared registry.
|
||||||
func Catalog() []Adapter { return append([]Adapter(nil), projectionAdapters...) }
|
func Catalog() []Adapter {
|
||||||
|
items := append([]Adapter(nil), projectionAdapters...)
|
||||||
|
// Explicitly selected projection. It must not replace normal HTML/text
|
||||||
|
// viewing in the automatic MIME classifier.
|
||||||
|
return append(items, Adapter{ID: "reveal", Kind: "slides", Delivery: DeliveryRawFrame, Match: func(Descriptor) bool { return false }})
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ func TestAdapterCatalogIsCopyAndConcurrent(t *testing.T) {
|
|||||||
for _, a := range catalog {
|
for _, a := range catalog {
|
||||||
ids = append(ids, a.ID)
|
ids = append(ids, a.ID)
|
||||||
}
|
}
|
||||||
if strings.Join(ids, ",") != "html,excalidraw,csv,archive,debian-package,eml,pe,json,text,image,audio,video,pdf,download" {
|
if strings.Join(ids, ",") != "html,excalidraw,csv,archive,debian-package,eml,pe,json,text,image,audio,video,pdf,download,reveal" {
|
||||||
t.Fatal("catalog order changed", ids)
|
t.Fatal("catalog order changed", ids)
|
||||||
}
|
}
|
||||||
catalog[0].ID = "corrupt"
|
catalog[0].ID = "corrupt"
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ func (s *Server) adapterActionsForPath(r *http.Request, semanticPath string) ([]
|
|||||||
{ID: "download", Name: "download", Mode: "viewer", Builtin: true,
|
{ID: "download", Name: "download", Mode: "viewer", Builtin: true,
|
||||||
OpenURL: rawProjectionURL("rev:" + revision.UUID)},
|
OpenURL: rawProjectionURL("rev:" + revision.UUID)},
|
||||||
}
|
}
|
||||||
|
if (mediaType == "text/html" || mediaType == "text/markdown" || mediaType == "text/x-markdown") && s.systemExtensionEnabled(domainUUID, "viewer.slides") {
|
||||||
|
actions = append(actions, adapterAction{ID: "reveal", Name: "Reveal.js", Mode: "viewer", Builtin: true, OpenURL: "/v/slides" + semanticPath})
|
||||||
|
}
|
||||||
if selected.NeedsText || selected.ID == "html" || selected.ID == "excalidraw" {
|
if selected.NeedsText || selected.ID == "html" || selected.ID == "excalidraw" {
|
||||||
actions = append(actions, adapterAction{
|
actions = append(actions, adapterAction{
|
||||||
ID: "editor", Name: "Pages Wiki Editor", Mode: "editor",
|
ID: "editor", Name: "Pages Wiki Editor", Mode: "editor",
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"html"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const csvEditorFixtureBody = "\ufeff\"name\",description\r\n日本語,\"a,b\r\nnext\"\r\n"
|
||||||
|
|
||||||
|
func TestCSVEditorRevisionAndBounds(t *testing.T) {
|
||||||
|
s, token, domain, _ := editorFixture(t)
|
||||||
|
object, err := s.store.CreatePageAtPathInDomain(domain, "/table.csv")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
first, err := s.store.SaveRevisionContent(object, []byte(csvEditorFixtureBody), "", "und", "text/csv; charset=utf-8", "table.csv")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, query := range []string{"", "?edittype=markdown", "?lang=und"} {
|
||||||
|
w := configRequest(s, token, "GET", "/e/-/table.csv"+query, nil)
|
||||||
|
if w.Code != 200 || !strings.Contains(w.Body.String(), `data-csv="true"`) || !strings.Contains(w.Body.String(), `value="code"`) || strings.Contains(w.Body.String(), `data-editor-action="markdown"`) {
|
||||||
|
t.Fatalf("editor %d %s", w.Code, w.Body.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
head, _ := s.store.GetRevisionForExactLanguage(object, "und")
|
||||||
|
if head.UUID != first.UUID {
|
||||||
|
t.Fatal("GET changed revision")
|
||||||
|
}
|
||||||
|
save := func(auth, base, body string) int {
|
||||||
|
data, _ := json.Marshal(map[string]any{"object_uuid": object, "body": body, "lang": "und", "content_type": "text/csv; charset=utf-8", "filename": "table.csv", "base_revision_uuid": base})
|
||||||
|
r := httptest.NewRequest("POST", "http://localhost/_/api/v1/revisions/save", bytes.NewReader(data))
|
||||||
|
r.Header.Set("Authorization", "Bearer "+auth)
|
||||||
|
r.Header.Set("Content-Type", "application/json")
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
s.withAuthorization(s.mux).ServeHTTP(w, r)
|
||||||
|
return w.Code
|
||||||
|
}
|
||||||
|
changed := strings.Replace(csvEditorFixtureBody, "日本語", "更新", 1)
|
||||||
|
if code := save(token, first.UUID, changed); code != 200 {
|
||||||
|
t.Fatal("save", code)
|
||||||
|
}
|
||||||
|
if code := save(token, first.UUID, "stale"); code != 409 {
|
||||||
|
t.Fatal("stale save", code)
|
||||||
|
}
|
||||||
|
head, _ = s.store.GetRevisionForExactLanguage(object, "und")
|
||||||
|
if head.Body != changed || head.ContentType != "text/csv; charset=utf-8" || head.Filename != "table.csv" {
|
||||||
|
t.Fatal("CSV altered")
|
||||||
|
}
|
||||||
|
state := configRequest(s, token, "GET", "/_/api/v1/editor/state?uuid="+object+"&lang=und&revision="+first.UUID, nil)
|
||||||
|
var content struct {
|
||||||
|
Body string
|
||||||
|
Editable bool
|
||||||
|
}
|
||||||
|
if err = json.Unmarshal(state.Body.Bytes(), &content); err != nil || state.Code != 200 || !content.Editable || content.Body != csvEditorFixtureBody {
|
||||||
|
t.Fatal("restore", state.Code, err)
|
||||||
|
}
|
||||||
|
reader, err := s.store.CreatePasswordAccount(domain, "csvreader", "a long test password", "Reader", "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err = s.store.SetPrincipalState(domain, reader.UUID, "readonly"); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
denied, _ := s.store.CreateAuthSession(domain, reader.UUID)
|
||||||
|
if code := save(denied, head.UUID, "forbidden"); code != 403 {
|
||||||
|
t.Fatal("readonly save", code)
|
||||||
|
}
|
||||||
|
// Initial CSV is embedded as an escaped JS string to preserve CRLF. A
|
||||||
|
// field must not terminate that script or become executable markup.
|
||||||
|
if _, err = s.store.SaveRevisionContent(object, []byte("\"</script><script>alert(1)</script>\",value\r\n"), "", "und", "text/csv", "table.csv"); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
escaped := configRequest(s, token, "GET", "/e/-/table.csv", nil)
|
||||||
|
if escaped.Code != 200 || strings.Contains(escaped.Body.String(), "<script>alert(1)</script>") || !strings.Contains(escaped.Body.String(), `\u003c/script\u003e`) {
|
||||||
|
t.Fatal("CSV script string was not escaped")
|
||||||
|
}
|
||||||
|
for _, input := range []struct {
|
||||||
|
body []byte
|
||||||
|
code int
|
||||||
|
}{{[]byte(strings.Repeat("x", maxCSVMacroBytes+1)), 413}, {[]byte{0xff, 0xfe}, 415}, {[]byte("a,\x00"), 415}} {
|
||||||
|
rev, e := s.store.SaveRevisionContent(object, input.body, "", "und", "text/csv", "table.csv")
|
||||||
|
if e != nil {
|
||||||
|
t.Fatal(e)
|
||||||
|
}
|
||||||
|
w := configRequest(s, token, "GET", "/e/-/table.csv", nil)
|
||||||
|
if w.Code != input.code {
|
||||||
|
t.Fatalf("editor bounds %d wanted %d", w.Code, input.code)
|
||||||
|
}
|
||||||
|
w = configRequest(s, token, "GET", "/_/api/v1/editor/state?uuid="+object+"&lang=und&revision="+rev.UUID, nil)
|
||||||
|
if w.Code != input.code {
|
||||||
|
t.Fatalf("state bounds %d wanted %d", w.Code, input.code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCSVEditorChromium(t *testing.T) {
|
||||||
|
if os.Getenv("PAGESWIKI_BROWSER_TEST") != "1" {
|
||||||
|
t.Skip("opt-in Chromium")
|
||||||
|
}
|
||||||
|
for _, width := range []string{"1280", "390"} {
|
||||||
|
t.Run(width, func(t *testing.T) {
|
||||||
|
s, token, domain, _ := editorFixture(t)
|
||||||
|
object, err := s.store.CreatePageAtPathInDomain(domain, "/table.csv")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err = s.store.SaveRevisionContent(object, []byte(csvEditorFixtureBody), "", "und", "text/csv; charset=utf-8", "table.csv"); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
script, err := os.ReadFile("internal/server/testdata/csv-editor.js")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
r.Host = "localhost"
|
||||||
|
r.Header.Set("Authorization", "Bearer "+token)
|
||||||
|
if r.URL.Path == "/e/-/table.csv" {
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
s.withAuthorization(s.mux).ServeHTTP(rec, r)
|
||||||
|
for k, v := range rec.Header() {
|
||||||
|
w.Header()[k] = v
|
||||||
|
}
|
||||||
|
w.WriteHeader(rec.Code)
|
||||||
|
_, policy, _ := strings.Cut(rec.Header().Get("Content-Security-Policy"), "'nonce-")
|
||||||
|
nonce, _, _ := strings.Cut(policy, "'")
|
||||||
|
w.Write([]byte(strings.Replace(rec.Body.String(), "</body>", `<script nonce="`+html.EscapeString(nonce)+`">`+string(script)+"</script></body>", 1)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.withAuthorization(s.mux).ServeHTTP(w, r)
|
||||||
|
}))
|
||||||
|
defer server.Close()
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
out, err := exec.CommandContext(ctx, "node", "internal/server/testdata/vim-browser-smoke.mjs", server.URL+"/e/-/table.csv", t.TempDir(), "/tmp/pageswiki-csv-editor-"+width+".png", width, "850").CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("browser: %v %s", err, out)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@ package server
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
for lang, entries := range map[string]map[string]string{
|
for lang, entries := range map[string]map[string]string{
|
||||||
"en": {"editor.tools": "Insert component / drafts", "editor.language": "Edit / fork language", "editor.restore": "Restore a revision into the editor"},
|
"en": {"editor.tools": "Insert component / drafts", "editor.language": "Edit / fork language", "editor.restore": "Restore a revision into the editor", "editor.csv_source": "CSV source", "editor.csv_table": "CSV table"},
|
||||||
"ja": {"editor.tools": "コンポーネント挿入・下書き", "editor.language": "言語の編集・分岐", "editor.restore": "過去のリビジョンをエディタに復元"},
|
"ja": {"editor.tools": "コンポーネント挿入・下書き", "editor.language": "言語の編集・分岐", "editor.restore": "過去のリビジョンをエディタに復元", "editor.csv_source": "CSVソースを表示", "editor.csv_table": "CSVの表を表示"},
|
||||||
} {
|
} {
|
||||||
for key, value := range entries {
|
for key, value := range entries {
|
||||||
translations[lang][key] = value
|
translations[lang][key] = value
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"pageswiki/internal/grammaratur"
|
"pageswiki/internal/grammaratur"
|
||||||
)
|
)
|
||||||
@@ -73,7 +74,20 @@ func (s *Server) handleEditorState(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
out := map[string]any{"revision_uuid": rev.UUID, "head_revision_uuid": head, "lang": rev.Language, "content_type": rev.ContentType, "filename": rev.Filename, "principal_uuid": owner}
|
out := map[string]any{"revision_uuid": rev.UUID, "head_revision_uuid": head, "lang": rev.Language, "content_type": rev.ContentType, "filename": rev.Filename, "principal_uuid": owner}
|
||||||
if r.URL.Query().Get("metadata") != "1" {
|
if r.URL.Query().Get("metadata") != "1" {
|
||||||
if rev.UUID != "" {
|
csv := selectProjectionAdapter(contentDescriptor{MediaType: strings.ToLower(strings.TrimSpace(strings.Split(rev.ContentType, ";")[0])), Filename: rev.Filename}).Kind == "csv"
|
||||||
|
if csv {
|
||||||
|
size, e := s.store.DocumentSizeContext(r.Context(), rev.DocumentHash)
|
||||||
|
if e != nil || size > maxCSVMacroBytes {
|
||||||
|
http.Error(w, "CSV editor size limit exceeded", 413)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window, e := s.store.ReadDocumentWindowContext(r.Context(), rev.DocumentHash, 0, maxCSVMacroBytes)
|
||||||
|
if e != nil || window.Truncated || !utf8.Valid(window.Data) || strings.ContainsRune(string(window.Data), 0) {
|
||||||
|
http.Error(w, "CSV source unavailable or not UTF-8", 415)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rev.Body = string(window.Data)
|
||||||
|
} else if rev.UUID != "" {
|
||||||
rev, err = s.store.GetRevision(rev.UUID)
|
rev, err = s.store.GetRevision(rev.UUID)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -90,7 +104,7 @@ func (s *Server) handleEditorState(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
out["body"], out["markdown"] = rev.Body, markdown
|
out["body"], out["markdown"] = rev.Body, markdown
|
||||||
kind := revisionContentView(rev, "").Kind
|
kind := revisionContentView(rev, "").Kind
|
||||||
out["editable"] = rev.UUID == "" || kind == "html" || kind == "code"
|
out["editable"] = rev.UUID == "" || kind == "html" || kind == "code" || (csv && utf8.ValidString(rev.Body) && !strings.ContainsRune(rev.Body, 0))
|
||||||
}
|
}
|
||||||
_ = json.NewEncoder(w).Encode(out)
|
_ = json.NewEncoder(w).Encode(out)
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ func readEndpointResolver(path string) (endpointTargetResolver, string) {
|
|||||||
return resolveHandler, "read"
|
return resolveHandler, "read"
|
||||||
case strings.HasPrefix(path, "/_/view/print/"):
|
case strings.HasPrefix(path, "/_/view/print/"):
|
||||||
return resolvePrint, "read"
|
return resolvePrint, "read"
|
||||||
case strings.HasPrefix(path, "/v/preview"), strings.HasPrefix(path, "/v/plain"), strings.HasPrefix(path, "/v/markdown"):
|
case strings.HasPrefix(path, "/v/preview"), strings.HasPrefix(path, "/v/plain"), strings.HasPrefix(path, "/v/markdown"), path == "/v/slides", strings.HasPrefix(path, "/v/slides/"):
|
||||||
return resolveViewPath, "read"
|
return resolveViewPath, "read"
|
||||||
case strings.HasPrefix(path, "/o/e/"):
|
case strings.HasPrefix(path, "/o/e/"):
|
||||||
return resolveObjectURL, "write"
|
return resolveObjectURL, "write"
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ func objectIDFromRoute(path string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func semanticViewPath(route string) string {
|
func semanticViewPath(route string) string {
|
||||||
for _, prefix := range []string{"/v/preview", "/v/plain", "/v/markdown", "/v/browser"} {
|
for _, prefix := range []string{"/v/preview", "/v/plain", "/v/markdown", "/v/browser", "/v/slides"} {
|
||||||
if strings.HasPrefix(route, prefix) {
|
if strings.HasPrefix(route, prefix) {
|
||||||
path := strings.TrimPrefix(route, prefix)
|
path := strings.TrimPrefix(route, prefix)
|
||||||
if path == "" {
|
if path == "" {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func parseTrustedTemplates(t *template.Template) (*template.Template, error) {
|
|||||||
|
|
||||||
func safeProjectionTemplate(name string) bool {
|
func safeProjectionTemplate(name string) bool {
|
||||||
switch name {
|
switch name {
|
||||||
case "periodical.gohtml", "public_periodical.gohtml", "periodical_new.gohtml":
|
case "periodical.gohtml", "public_periodical.gohtml", "periodical_new.gohtml", "slides.gohtml":
|
||||||
return true
|
return true
|
||||||
case "city_map.gohtml", "public_tree.gohtml", "anonymous_view.gohtml", "page.gohtml", "home.gohtml", "search_home.gohtml", "object_view.gohtml", "revision_view.gohtml", "preview.gohtml", "print.gohtml", "profile.gohtml", "editor.gohtml", "object_editor.gohtml":
|
case "city_map.gohtml", "public_tree.gohtml", "anonymous_view.gohtml", "page.gohtml", "home.gohtml", "search_home.gohtml", "object_view.gohtml", "revision_view.gohtml", "preview.gohtml", "print.gohtml", "profile.gohtml", "editor.gohtml", "object_editor.gohtml":
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ func (s *Server) renderWithContext(
|
|||||||
data["TasksEnabled"] = s.systemExtensionEnabled(domainUUID, "organizer.tasks")
|
data["TasksEnabled"] = s.systemExtensionEnabled(domainUUID, "organizer.tasks")
|
||||||
data["ContactsEnabled"] = s.systemExtensionEnabled(domainUUID, "organizer.contacts")
|
data["ContactsEnabled"] = s.systemExtensionEnabled(domainUUID, "organizer.contacts")
|
||||||
data["FeedsEnabled"] = s.systemExtensionEnabled(domainUUID, "organizer.feeds")
|
data["FeedsEnabled"] = s.systemExtensionEnabled(domainUUID, "organizer.feeds")
|
||||||
|
data["SlidesEnabled"] = s.systemExtensionEnabled(domainUUID, "viewer.slides")
|
||||||
data["OrganizerSection"] = organizerSection(r.URL.Path)
|
data["OrganizerSection"] = organizerSection(r.URL.Path)
|
||||||
if r.URL.Path == "/" {
|
if r.URL.Path == "/" {
|
||||||
data["IsHome"] = true
|
data["IsHome"] = true
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ type UIHandlers struct {
|
|||||||
Preview http.HandlerFunc
|
Preview http.HandlerFunc
|
||||||
PlainView http.HandlerFunc
|
PlainView http.HandlerFunc
|
||||||
MarkdownView http.HandlerFunc
|
MarkdownView http.HandlerFunc
|
||||||
|
Slides http.HandlerFunc
|
||||||
CompileMarkdown http.HandlerFunc
|
CompileMarkdown http.HandlerFunc
|
||||||
CompileDiagram http.HandlerFunc
|
CompileDiagram http.HandlerFunc
|
||||||
Config http.HandlerFunc
|
Config http.HandlerFunc
|
||||||
@@ -93,6 +94,8 @@ func RegisterUIRoutes(
|
|||||||
|
|
||||||
handleIfNotNil(mux, "/v/markdown", h.MarkdownView)
|
handleIfNotNil(mux, "/v/markdown", h.MarkdownView)
|
||||||
handleIfNotNil(mux, "/v/markdown/", h.MarkdownView)
|
handleIfNotNil(mux, "/v/markdown/", h.MarkdownView)
|
||||||
|
handleIfNotNil(mux, "/v/slides", h.Slides)
|
||||||
|
handleIfNotNil(mux, "/v/slides/", h.Slides)
|
||||||
|
|
||||||
handleIfNotNil(mux, "/:/compile/markdown", h.CompileMarkdown)
|
handleIfNotNil(mux, "/:/compile/markdown", h.CompileMarkdown)
|
||||||
handleIfNotNil(mux, "/:/compile/markdown/", h.CompileMarkdown)
|
handleIfNotNil(mux, "/:/compile/markdown/", h.CompileMarkdown)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"pageswiki/internal/grammaratur"
|
"pageswiki/internal/grammaratur"
|
||||||
"pageswiki/internal/store"
|
"pageswiki/internal/store"
|
||||||
@@ -211,16 +212,43 @@ func (s *Server) handleSemanticEditor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
latest, err :=
|
// CSV editing needs the complete source, never the viewer's truncated window.
|
||||||
s.latestRevisionForRequest(
|
// Check metadata before loading a potentially large document.
|
||||||
r,
|
metadata, metaErr := s.store.GetLatestRevisionMetadataForLanguagesContext(r.Context(), objectUUID, s.revisionLanguageCandidates(r))
|
||||||
objectUUID,
|
|
||||||
)
|
|
||||||
|
|
||||||
body := ""
|
|
||||||
if lang := r.URL.Query().Get("lang"); lang != "" {
|
if lang := r.URL.Query().Get("lang"); lang != "" {
|
||||||
latest, err = s.store.GetRevisionForExactLanguage(objectUUID, lang)
|
metadata, metaErr = s.store.GetRevisionMetadataForExactLanguage(objectUUID, lang)
|
||||||
}
|
}
|
||||||
|
if metaErr != nil || metadata == nil {
|
||||||
|
http.Error(w, "revision unavailable or invalid language", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
csvEditor := selectProjectionAdapter(contentDescriptor{MediaType: strings.ToLower(strings.TrimSpace(strings.Split(metadata.ContentType, ";")[0])), Filename: metadata.Filename}).Kind == "csv"
|
||||||
|
if csvEditor {
|
||||||
|
size, sizeErr := s.store.DocumentSizeContext(r.Context(), metadata.DocumentHash)
|
||||||
|
if sizeErr != nil || size > maxCSVMacroBytes {
|
||||||
|
http.Error(w, "CSV editor requires a complete document of at most 256 KiB", http.StatusRequestEntityTooLarge)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var latest *store.Revision
|
||||||
|
if csvEditor {
|
||||||
|
// Load the immutable revision we checked; a concurrent new head is
|
||||||
|
// handled by the normal save CAS, not by an unbounded second read.
|
||||||
|
window, readErr := s.store.ReadDocumentWindowContext(r.Context(), metadata.DocumentHash, 0, maxCSVMacroBytes)
|
||||||
|
if readErr != nil || window.Truncated {
|
||||||
|
http.Error(w, "CSV source unavailable", http.StatusServiceUnavailable)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
latest = metadata
|
||||||
|
latest.Body = string(window.Data)
|
||||||
|
} else {
|
||||||
|
latest, err = s.latestRevisionForRequest(r, objectUUID)
|
||||||
|
if lang := r.URL.Query().Get("lang"); lang != "" {
|
||||||
|
latest, err = s.store.GetRevisionForExactLanguage(objectUUID, lang)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body := ""
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, "revision unavailable or invalid language", 400)
|
http.Error(w, "revision unavailable or invalid language", 400)
|
||||||
return
|
return
|
||||||
@@ -233,7 +261,13 @@ func (s *Server) handleSemanticEditor(
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
if latest.UUID != "" {
|
if latest.UUID != "" {
|
||||||
view := revisionContentView(latest, path)
|
view := revisionContentView(latest, path)
|
||||||
if view.Kind == "code" {
|
if view.Kind == "csv" {
|
||||||
|
if !csvEditor || !utf8.ValidString(latest.Body) || strings.ContainsRune(latest.Body, 0) || len(latest.Body) > maxCSVMacroBytes {
|
||||||
|
http.Error(w, "CSV editor requires bounded UTF-8 text", http.StatusUnsupportedMediaType)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
editType = "code"
|
||||||
|
} else if view.Kind == "code" {
|
||||||
editType = "code"
|
editType = "code"
|
||||||
if strings.EqualFold(strings.TrimSpace(strings.Split(latest.ContentType, ";")[0]), "text/plain") {
|
if strings.EqualFold(strings.TrimSpace(strings.Split(latest.ContentType, ";")[0]), "text/plain") {
|
||||||
editType = "plain"
|
editType = "plain"
|
||||||
@@ -294,6 +328,7 @@ func (s *Server) handleSemanticEditor(
|
|||||||
"BaseBody": baseBody,
|
"BaseBody": baseBody,
|
||||||
"BaseRevision": latest.UUID,
|
"BaseRevision": latest.UUID,
|
||||||
"EditType": editType,
|
"EditType": editType,
|
||||||
|
"CSVEditor": csvEditor,
|
||||||
"PageLanguage": latest.Language,
|
"PageLanguage": latest.Language,
|
||||||
"PageContentType": contentType,
|
"PageContentType": contentType,
|
||||||
"PageFilename": filename,
|
"PageFilename": filename,
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ func (s *Server) registerRoutes() {
|
|||||||
Preview: s.handlePreview,
|
Preview: s.handlePreview,
|
||||||
PlainView: s.handlePlainView,
|
PlainView: s.handlePlainView,
|
||||||
MarkdownView: s.handleMarkdownView,
|
MarkdownView: s.handleMarkdownView,
|
||||||
|
Slides: s.handleSlides,
|
||||||
CompileMarkdown: s.handleCompileMarkdown,
|
CompileMarkdown: s.handleCompileMarkdown,
|
||||||
CompileDiagram: s.handleCompileDiagram,
|
CompileDiagram: s.handleCompileDiagram,
|
||||||
Config: s.handleConfig,
|
Config: s.handleConfig,
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"pageswiki/internal/grammaratur"
|
||||||
|
)
|
||||||
|
|
||||||
|
const maxSlideSourceBytes = 256 << 10
|
||||||
|
|
||||||
|
func (s *Server) handleSlides(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.Method != http.MethodGet && r.Method != http.MethodHead {
|
||||||
|
w.Header().Set("Allow", "GET, HEAD")
|
||||||
|
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
domain := s.domainUUIDForRequest(r)
|
||||||
|
if !s.systemExtensionEnabled(domain, "viewer.slides") {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
path := semanticViewPath(r.URL.Path)
|
||||||
|
if !s.requestCanReadPath(r, path) {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
object, err := s.store.ResolvePathInDomain(domain, path)
|
||||||
|
if err != nil {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
revision, err := s.store.GetLatestRevisionMetadataForLanguagesContext(r.Context(), object, s.revisionLanguageCandidates(r))
|
||||||
|
if err != nil || revision == nil {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
media := strings.ToLower(strings.TrimSpace(strings.Split(revision.ContentType, ";")[0]))
|
||||||
|
if media != "text/html" && media != "text/markdown" && media != "text/x-markdown" {
|
||||||
|
http.Error(w, "slides require HTML or Markdown", http.StatusUnsupportedMediaType)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
size, err := s.store.DocumentSizeContext(r.Context(), revision.DocumentHash)
|
||||||
|
if err != nil {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if size > maxSlideSourceBytes {
|
||||||
|
http.Error(w, "slides source exceeds 256 KiB", http.StatusRequestEntityTooLarge)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window, err := s.store.ReadDocumentWindowContext(r.Context(), revision.DocumentHash, 0, maxSlideSourceBytes)
|
||||||
|
if err != nil || window.Truncated || !utf8.Valid(window.Data) {
|
||||||
|
http.Error(w, "invalid slides source", http.StatusUnsupportedMediaType)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
source := string(window.Data)
|
||||||
|
if media != "text/html" {
|
||||||
|
source = grammaratur.MarkdownAuthoringHTML(source)
|
||||||
|
}
|
||||||
|
source = s.safeHTMLProjection(r, source, path, false)
|
||||||
|
w.Header().Set("Cache-Control", "private, no-store")
|
||||||
|
if r.Method == http.MethodHead {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.renderWithContext(w, r, "slides.gohtml", map[string]any{"Title": path, "Path": path, "SlideSource": source})
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
for lang, entries := range map[string]map[string]string{
|
||||||
|
"en": {"slides.title": "Slides", "slides.help": "Local Reveal.js viewer and editor preview. Separate slides with a horizontal rule.", "slides.preview": "Slide preview", "slides.close": "Return to page", "slides.fullscreen": "Fullscreen", "slides.error": "Slides could not be displayed. Use the document view (limit: 256 KiB, 100 slides)."},
|
||||||
|
"ja": {"slides.title": "スライド", "slides.help": "ローカル同梱のReveal.jsで閲覧・編集プレビュー。水平線でスライドを区切ります。", "slides.preview": "スライドプレビュー", "slides.close": "ページへ戻る", "slides.fullscreen": "全画面", "slides.error": "スライドを表示できません。通常表示を使用してください(上限256 KiB・100枚)。"},
|
||||||
|
} {
|
||||||
|
for key, value := range entries {
|
||||||
|
translations[lang][key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"html"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"pageswiki/internal/server/routes"
|
||||||
|
)
|
||||||
|
|
||||||
|
const slideFixture = `<h1>First slide</h1><p>日本語のスライド</p><hr><h2>Second slide</h2><ul><li>Local Reveal.js</li><li>No source mutation</li></ul>`
|
||||||
|
|
||||||
|
func TestSlidesAccessAndLimits(t *testing.T) {
|
||||||
|
s, token, domain, _ := editorFixture(t)
|
||||||
|
routes.RegisterUIRoutes(s.mux, routes.UIHandlers{Slides: s.handleSlides})
|
||||||
|
s.mux.HandleFunc("/deck", s.handleSemanticRoute)
|
||||||
|
object, err := s.store.CreatePageAtPathInDomain(domain, "/deck")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
save := func(body, media string) {
|
||||||
|
t.Helper()
|
||||||
|
if _, e := s.store.SaveRevisionContent(object, []byte(body), "", "und", media, ""); e != nil {
|
||||||
|
t.Fatal(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
save(slideFixture, "text/html")
|
||||||
|
w := configRequest(s, token, "GET", "/v/slides/deck", nil)
|
||||||
|
if w.Code != 200 || !strings.Contains(w.Body.String(), "data-slides-viewer") || !strings.Contains(w.Body.String(), "<h1>First slide") {
|
||||||
|
t.Fatalf("slides %d %s", w.Code, w.Body.String())
|
||||||
|
}
|
||||||
|
if !strings.Contains(w.Header().Get("Content-Security-Policy"), "'nonce-") {
|
||||||
|
t.Fatal("missing CSP")
|
||||||
|
}
|
||||||
|
page := configRequest(s, token, "GET", "/deck", nil)
|
||||||
|
if !strings.Contains(page.Body.String(), `href="/v/slides/deck"`) {
|
||||||
|
t.Fatal("viewer action missing")
|
||||||
|
}
|
||||||
|
editor := configRequest(s, token, "GET", "/e/-/deck", nil)
|
||||||
|
if !strings.Contains(editor.Body.String(), `data-editor-action="slides"`) {
|
||||||
|
t.Fatal("preview action missing")
|
||||||
|
}
|
||||||
|
// A missing or unauthorized semantic path is not exposed via the new view.
|
||||||
|
req := httptest.NewRequest("GET", "http://localhost/v/slides/deck", nil)
|
||||||
|
denied := httptest.NewRecorder()
|
||||||
|
s.withAuthorization(s.mux).ServeHTTP(denied, req)
|
||||||
|
if denied.Code == 200 || strings.Contains(denied.Body.String(), "First slide") {
|
||||||
|
t.Fatal("anonymous private content exposed")
|
||||||
|
}
|
||||||
|
if configRequest(s, token, "GET", "/v/slides/missing", nil).Code != 404 {
|
||||||
|
t.Fatal("missing deck")
|
||||||
|
}
|
||||||
|
if p := policyForRequest(httptest.NewRequest("GET", "/v/slides/deck", nil)); p.Resolver != resolveViewPath || p.Capability != "read" {
|
||||||
|
t.Fatal("wrong policy")
|
||||||
|
}
|
||||||
|
if semanticViewPath("/v/slides/deck") != "/deck" {
|
||||||
|
t.Fatal("wrong target")
|
||||||
|
}
|
||||||
|
save("# Markdown\n\n---\n\n## Second", "text/markdown")
|
||||||
|
if w = configRequest(s, token, "GET", "/v/slides/deck", nil); w.Code != 200 || !strings.Contains(w.Body.String(), "<hr") {
|
||||||
|
t.Fatal("markdown projection", w.Code)
|
||||||
|
}
|
||||||
|
save("%PDF-synthetic", "application/pdf")
|
||||||
|
if configRequest(s, token, "GET", "/v/slides/deck", nil).Code != 415 {
|
||||||
|
t.Fatal("binary accepted")
|
||||||
|
}
|
||||||
|
save(strings.Repeat("x", maxSlideSourceBytes+1), "text/html")
|
||||||
|
if configRequest(s, token, "GET", "/v/slides/deck", nil).Code != 413 {
|
||||||
|
t.Fatal("oversize accepted")
|
||||||
|
}
|
||||||
|
save(slideFixture, "text/html")
|
||||||
|
if err = s.setSystemExtensionEnabled(domain, "viewer.slides", false); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if configRequest(s, token, "GET", "/v/slides/deck", nil).Code != 404 {
|
||||||
|
t.Fatal("disabled viewer active")
|
||||||
|
}
|
||||||
|
editor = configRequest(s, token, "GET", "/e/-/deck", nil)
|
||||||
|
if strings.Contains(editor.Body.String(), `data-editor-action="slides"`) {
|
||||||
|
t.Fatal("disabled preview action")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSlidesChromium(t *testing.T) {
|
||||||
|
if os.Getenv("PAGESWIKI_BROWSER_TEST") != "1" {
|
||||||
|
t.Skip("opt-in Chromium")
|
||||||
|
}
|
||||||
|
for _, mode := range []string{"viewer", "editor"} {
|
||||||
|
for _, width := range []string{"1280", "390"} {
|
||||||
|
t.Run(mode+width, func(t *testing.T) {
|
||||||
|
s, token, domain, _ := editorFixture(t)
|
||||||
|
routes.RegisterUIRoutes(s.mux, routes.UIHandlers{Slides: s.handleSlides})
|
||||||
|
object, err := s.store.CreatePageAtPathInDomain(domain, "/deck")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err = s.store.SaveRevisionContent(object, []byte(slideFixture), "", "und", "text/html", ""); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
script, err := os.ReadFile("internal/server/testdata/slides.js")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
route := "/v/slides/deck"
|
||||||
|
if mode == "editor" {
|
||||||
|
route = "/e/-/deck"
|
||||||
|
}
|
||||||
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
r.Host = "localhost"
|
||||||
|
r.Header.Set("Authorization", "Bearer "+token)
|
||||||
|
if r.URL.Path == route {
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
s.withAuthorization(s.mux).ServeHTTP(rec, r)
|
||||||
|
for k, v := range rec.Header() {
|
||||||
|
w.Header()[k] = v
|
||||||
|
}
|
||||||
|
w.WriteHeader(rec.Code)
|
||||||
|
_, policy, _ := strings.Cut(rec.Header().Get("Content-Security-Policy"), "'nonce-")
|
||||||
|
nonce, _, _ := strings.Cut(policy, "'")
|
||||||
|
w.Write([]byte(strings.Replace(rec.Body.String(), "</body>", `<script nonce="`+html.EscapeString(nonce)+`">`+string(script)+"</script></body>", 1)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.withAuthorization(s.mux).ServeHTTP(w, r)
|
||||||
|
}))
|
||||||
|
defer server.Close()
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
cmd := exec.CommandContext(ctx, "node", "internal/server/testdata/vim-browser-smoke.mjs", server.URL+route, t.TempDir(), "/tmp/pageswiki-slides-"+mode+width+".png", width, "850")
|
||||||
|
cmd.Env = append(os.Environ(), "PAGESWIKI_SLIDES_BROWSER=1")
|
||||||
|
out, err := cmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("browser %v: %s", err, out)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
(async()=>{
|
||||||
|
const assert=(ok,msg)=>{if(!ok)throw Error(msg)},delay=ms=>new Promise(r=>setTimeout(r,ms));
|
||||||
|
const wait=async fn=>{for(let n=0;n<150;n++){if(fn())return;await delay(25)}throw Error('Timeout '+fn)};
|
||||||
|
await wait(()=>window.PagesWikiCodeMirror&&document.querySelector('.csv-edit-scroll textarea'));
|
||||||
|
const e=window.PagesEditor;setEditorPreviewVisible(true);e.paused=true;
|
||||||
|
if(innerWidth<=700){assert(getComputedStyle(document.querySelector('.editor-pane')).display==='none','Mobile table is not full width');setEditorPreviewVisible(false);assert(getComputedStyle(document.querySelector('.editor-pane')).display!=='none','Mobile source inaccessible');setEditorPreviewVisible(true);}
|
||||||
|
const original=e.text(),base=e.baseRevision;
|
||||||
|
const cell=(r,c)=>document.querySelector(`.csv-edit-scroll textarea[data-row="${r}"][data-column="${c}"]`);
|
||||||
|
const button=text=>[...document.querySelectorAll('.csv-edit-toolbar button')].find(b=>b.textContent===text);
|
||||||
|
let input=cell(1,0);input.focus();input.value='新しい,名前';input.dispatchEvent(new Event('input',{bubbles:true}));
|
||||||
|
await delay(400);assert(document.activeElement===input,'Table caret lost; connected='+input.isConnected+' active='+document.activeElement?.className);
|
||||||
|
assert(e.text()==='\ufeff"name",description\r\n"新しい,名前","a,b\r\nnext"\r\n','Untouched CSV changed');
|
||||||
|
e.persist();assert(localStorage.getItem(e.keyPrefix()+e.tab),'CSV draft missing');
|
||||||
|
button('↶').click();assert(e.text()===original,'Undo not lossless');button('↷').click();
|
||||||
|
assert(await e.saveNow(),'CSV save failed');assert(e.baseRevision!==base,'Revision unchanged');
|
||||||
|
let state=await e.state();assert(state.body===e.text()&&state.content_type==='text/csv; charset=utf-8'&&state.editable,'CSV metadata changed');
|
||||||
|
// Markup and formulas are text, never document nodes or evaluated values.
|
||||||
|
e.paused=true;input=cell(1,0);input.value='<img src=x onerror=alert(1)>';input.dispatchEvent(new Event('input',{bubbles:true}));
|
||||||
|
assert(!document.querySelector('.csv-edit-pane img'),'CSV injected markup');
|
||||||
|
assert(await e.saveNow(),'Markup-as-data save failed');
|
||||||
|
// A competing change is always reviewed, even on different CSV fields.
|
||||||
|
const remoteBody=PagesCSV.edit(e.text(),'cell',0,1,'remote');
|
||||||
|
const remote=await e.post('/_/api/v1/revisions/save',{object_uuid:e.value('object-uuid'),body:remoteBody,lang:'und',content_type:e.value('page-content-type'),filename:'table.csv',base_revision_uuid:e.baseRevision,editor_principal_uuid:e.owner});
|
||||||
|
e.paused=true;e.setText(PagesCSV.edit(e.text(),'cell',1,0,'local'));
|
||||||
|
assert(!await e.saveNow(),'Conflicting CSV silently saved');
|
||||||
|
assert(document.querySelector('#editor-dialog textarea[readonly]'),'CSV conflict comparison missing');
|
||||||
|
assert((await e.state()).revision_uuid===remote.revision_uuid,'Remote CSV overwritten');
|
||||||
|
const merged=PagesCSV.edit(remoteBody,'cell',1,0,'local');
|
||||||
|
const areas=document.querySelectorAll('#editor-dialog textarea');areas[areas.length-1].value=merged;
|
||||||
|
document.querySelector('#editor-dialog footer button:last-child').click();await wait(()=>!document.querySelector('#editor-dialog'));
|
||||||
|
assert(await e.saveNow(),'Reviewed CSV failed to save');
|
||||||
|
// Restore stages the old CSV, retains MIME and creates a new revision on save.
|
||||||
|
e.paused=true;await e.historyDialog();const history=document.querySelector('#editor-dialog select');history.value=base;
|
||||||
|
document.querySelector('#editor-dialog footer button:last-child').click();await wait(()=>!document.querySelector('#editor-dialog'));
|
||||||
|
assert(e.text()===original,'History did not restore exact CSV');assert(await e.saveNow(),'Restore save failed');
|
||||||
|
// Source syntax errors do not cause a truncated table to be written back.
|
||||||
|
e.paused=true;e.setText('"unfinished');await e.renderPreview();assert(!document.querySelector('.csv-edit-scroll'),'Malformed CSV table editable');assert(e.text()==='"unfinished','Malformed source lost');
|
||||||
|
e.setText(original);await e.renderPreview();
|
||||||
|
for(let i=0;i<27;i++)button('+↧').click();
|
||||||
|
assert(PagesCSV.parse(e.text()).rows.length===29,'Row append failed');
|
||||||
|
assert(document.querySelectorAll('.csv-edit-scroll tbody tr').length<=25,'Table was not paged');
|
||||||
|
button('‹').click();assert(document.querySelectorAll('.csv-edit-scroll tbody tr').length===25,'Previous page missing');
|
||||||
|
button('+→').click();assert(PagesCSV.parse(e.text()).rows[0].cells.length===3,'Column append failed');
|
||||||
|
cell(1,1).focus();button('−→').click();assert(PagesCSV.parse(e.text()).rows[0].cells.length===2,'Column delete failed');
|
||||||
|
button('↶').click();cell(1,1).focus();button('−↧').click();assert(PagesCSV.parse(e.text()).rows.length===28,'Row delete failed');
|
||||||
|
button('↶').click();
|
||||||
|
// Spreadsheet clipboard paste is one atomic undo step, including new rows.
|
||||||
|
e.setText(original);await e.renderPreview();
|
||||||
|
const paste=(r,c,text)=>{const data=new DataTransfer();data.setData('text/plain',text);data.setData('text/html','<img src=x onerror=alert(1)>');const target=cell(r,c);target.focus();const event=new ClipboardEvent('paste',{clipboardData:data,bubbles:true,cancelable:true});target.dispatchEvent(event);return event;};
|
||||||
|
assert(paste(1,0,'first\t"multi\nline"\r\n<img src=x onerror=alert(1)>\t=1+1\r\n').defaultPrevented,'Table paste not intercepted');
|
||||||
|
const pasted=e.text();assert(PagesCSV.parse(pasted).rows.length===3,'Paste did not grow rows');
|
||||||
|
assert(cell(1,1).value==='multi\nline','Quoted multiline clipboard broken');
|
||||||
|
assert(!document.querySelector('.csv-edit-pane img'),'Clipboard HTML executed');
|
||||||
|
assert(document.activeElement===cell(1,0),'Paste focus lost');
|
||||||
|
assert(await e.saveNow(),'Pasted CSV save failed');assert((await e.state()).body===pasted,'Pasted CSV not persisted exactly');e.paused=true;
|
||||||
|
button('↶').click();assert(e.text()===original,'Paste not undone atomically');
|
||||||
|
button('↷').click();assert(e.text()===pasted,'Paste redo changed bytes');
|
||||||
|
assert(paste(1,0,'valid\tdata\n"unfinished').defaultPrevented,'Malformed paste fell through');
|
||||||
|
assert(e.text()===pasted,'Malformed paste partially applied');
|
||||||
|
assert(paste(1,0,'a\n'.repeat(200)).defaultPrevented,'Oversize paste fell through');
|
||||||
|
assert(e.text()===pasted,'Oversize paste partially applied');
|
||||||
|
assert(!paste(1,0,'ordinary, text').defaultPrevented,'Single-cell text paste intercepted');
|
||||||
|
button('↶').click();assert(e.text()===original,'Rejected paste polluted undo');
|
||||||
|
const css=getComputedStyle(document.querySelector('.csv-edit-toolbar'));assert(css.color!==css.backgroundColor,'Toolbar lacks contrast');
|
||||||
|
clearTimeout(e.autosaveTimer);clearInterval(e.stateTimer);e.paused=true;
|
||||||
|
document.body.dataset.vimReady='true';
|
||||||
|
})().catch(error=>{const p=document.createElement('pre');p.id='error';p.textContent=error.stack;document.body.append(p)});
|
||||||
@@ -109,6 +109,9 @@
|
|||||||
e.tools();
|
e.tools();
|
||||||
const style=w.getComputedStyle(d.querySelector('#editor-dialog'));
|
const style=w.getComputedStyle(d.querySelector('#editor-dialog'));
|
||||||
assert(style.color!==style.backgroundColor&&style.backgroundColor!=='rgba(0, 0, 0, 0)','Dialog not themed');
|
assert(style.color!==style.backgroundColor&&style.backgroundColor!=='rgba(0, 0, 0, 0)','Dialog not themed');
|
||||||
|
const components=d.querySelector('#editor-dialog select');components.selectedIndex=components.options.length-1;
|
||||||
|
d.querySelector('#editor-dialog footer button:nth-child(2)').click();await wait(()=>!d.querySelector('#editor-dialog'));
|
||||||
|
assert(e.text().includes('{{csv:/data/table.csv')&&!e.text().includes('{=html}'),'CSV macro insertion was wrapped in protected HTML');
|
||||||
document.body.dataset.vimReady='true';
|
document.body.dataset.vimReady='true';
|
||||||
} catch(error) {const box=document.createElement('div');box.id='error';box.textContent=error.stack||error.message;document.body.prepend(box)}
|
} catch(error) {const box=document.createElement('div');box.id='error';box.textContent=error.stack||error.message;document.body.prepend(box)}
|
||||||
})();
|
})();
|
||||||
Vendored
+33
@@ -0,0 +1,33 @@
|
|||||||
|
(async()=>{
|
||||||
|
const assert=(ok,msg)=>{if(!ok)throw Error(msg)},delay=ms=>new Promise(r=>setTimeout(r,ms));
|
||||||
|
const wait=async fn=>{for(let n=0;n<300;n++){if(fn())return;await delay(25)}throw Error('Timeout '+fn)};
|
||||||
|
const ready=()=>document.querySelector('.slides-frame[data-ready=true]');
|
||||||
|
await wait(()=>window.PagesSlides);
|
||||||
|
const e=window.PagesEditor;
|
||||||
|
if(e){await wait(()=>document.querySelector('[data-editor-action=slides]')&&e.preview);e.paused=true;document.querySelector('[data-editor-action=slides]').click();}
|
||||||
|
await wait(ready);
|
||||||
|
const frame=ready(),source=e?.text(),historyLength=history.length;
|
||||||
|
assert(frame.dataset.count==='2','Wrong slide count');
|
||||||
|
assert(frame.sandbox.contains('allow-scripts')&&!frame.sandbox.contains('allow-same-origin'),'Isolation missing');
|
||||||
|
let isolated=false;try{isolated=!frame.contentDocument}catch{isolated=true}assert(isolated,'Frame can access parent origin');
|
||||||
|
assert(frame.getBoundingClientRect().height>=240,'Slide frame collapsed');
|
||||||
|
assert(frame.getBoundingClientRect().width<=innerWidth,'Mobile slide overflow');
|
||||||
|
if(e&&innerWidth<=700){assert(getComputedStyle(document.querySelector('.editor-pane')).display==='none','Mobile preview not full width');setEditorPreviewVisible(false);assert(getComputedStyle(document.querySelector('.editor-pane')).display!=='none','Mobile source inaccessible');setEditorPreviewVisible(true);}
|
||||||
|
const host=frame.parentElement;
|
||||||
|
// Verify the defensive DOM boundary independently of server sanitization.
|
||||||
|
PagesSlides.render(host,'<h1 onclick="alert(1)" data-background-iframe="https://evil.invalid">Safe</h1><script>alert(1)</scr'+'ipt><iframe src="https://evil.invalid"></iframe><img src="https://evil.invalid/x"><hr><p>Next</p>','/deck');
|
||||||
|
await wait(ready);
|
||||||
|
let projected=ready().srcdoc;
|
||||||
|
assert(!projected.includes('evil.invalid')&&!projected.includes('onclick=')&&!projected.includes('alert(1)'),'Unsafe content entered frame');
|
||||||
|
assert(!projected.includes('data-background-iframe'),'Reveal directives leaked');
|
||||||
|
assert(history.length===historyLength,'Slide render changed history');
|
||||||
|
let rejected=false;try{PagesSlides.render(host,'<p>x</p><hr>'.repeat(101),'/deck')}catch{rejected=true}assert(rejected,'Too many slides accepted');
|
||||||
|
if(e){
|
||||||
|
assert(e.text()===source,'Preview mutated canonical source');
|
||||||
|
e.setText('<h1>Edited</h1><hr><p>Second</p><hr><p>Third</p>');await e.renderPreview();await wait(ready);assert(ready().dataset.count==='3','Live preview stale');
|
||||||
|
document.querySelector('[data-editor-action=slides]').click();await wait(()=>!document.querySelector('.slides-frame'));assert(e.preview.textContent.includes('Edited'),'Normal preview not restored');
|
||||||
|
document.querySelector('[data-editor-action=slides]').click();await wait(ready);
|
||||||
|
clearTimeout(e.autosaveTimer);clearInterval(e.stateTimer);e.paused=true;
|
||||||
|
}else{PagesSlides.render(host,document.querySelector('[data-slides-source]').value,'/deck');await wait(ready);}
|
||||||
|
document.body.dataset.vimReady='true';
|
||||||
|
})().catch(error=>{const p=document.createElement('pre');p.id='error';p.textContent=error.stack;document.body.append(p)});
|
||||||
+12
@@ -58,6 +58,18 @@ try {
|
|||||||
const layout=await evaluate(`fetch('/_/api/v1/extension/organizer.tasks/dashboard').then(r=>r.json())`);if(layout.widgets[0].id!=='today'||layout.widgets.find(w=>w.id==='tasks').height!==4)throw Error('Pointer layout persistence failed');
|
const layout=await evaluate(`fetch('/_/api/v1/extension/organizer.tasks/dashboard').then(r=>r.json())`);if(layout.widgets[0].id!=='today'||layout.widgets.find(w=>w.id==='tasks').height!==4)throw Error('Pointer layout persistence failed');
|
||||||
await evaluate(`document.querySelector('#dashboard-controls button[aria-pressed]').click();scrollTo(0,0)`);
|
await evaluate(`document.querySelector('#dashboard-controls button[aria-pressed]').click();scrollTo(0,0)`);
|
||||||
}
|
}
|
||||||
|
if (ready && process.env.PAGESWIKI_SLIDES_BROWSER === '1') {
|
||||||
|
const evaluate = async expression => (await call('Runtime.evaluate', {expression, returnByValue:true})).result.value;
|
||||||
|
const initialHistory = await evaluate('history.length');
|
||||||
|
await evaluate("document.querySelector('.slides-frame').focus()");
|
||||||
|
const key = async (key, code) => {await call('Input.dispatchKeyEvent',{type:'keyDown',key,code:key,windowsVirtualKeyCode:code});await call('Input.dispatchKeyEvent',{type:'keyUp',key,code:key,windowsVirtualKeyCode:code});};
|
||||||
|
await key('ArrowRight',39);
|
||||||
|
let advanced=false;for(let n=0;n<30;n++){if(await evaluate("document.querySelector('.slides-frame').parentElement.dataset.slideIndex") === '1'){advanced=true;break;}await delay(100);}
|
||||||
|
if(!advanced)throw Error('Slide keyboard navigation failed');
|
||||||
|
await key('ArrowLeft',37);await delay(150);
|
||||||
|
if(await evaluate("document.querySelector('.slides-frame').parentElement.dataset.slideIndex") !== '0')throw Error('Slide previous navigation failed');
|
||||||
|
if(await evaluate('history.length') !== initialHistory)throw Error('Slides polluted browser history');
|
||||||
|
}
|
||||||
if (screenshot) {
|
if (screenshot) {
|
||||||
const {data} = await call('Page.captureScreenshot', {format: 'png'});
|
const {data} = await call('Page.captureScreenshot', {format: 'png'});
|
||||||
await writeFile(screenshot, Buffer.from(data, 'base64'));
|
await writeFile(screenshot, Buffer.from(data, 'base64'));
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
.csv-edit-pane{padding:0!important;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}
|
||||||
|
.csv-edit-pane[hidden]{display:none!important}
|
||||||
|
.csv-edit-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.2rem;padding:.3rem;border-bottom:1px solid var(--border,#444);flex:none;background:var(--bg,#fff);color:var(--fg,#222)}
|
||||||
|
.csv-edit-toolbar button{font:inherit;min-width:2rem;min-height:2rem;padding:.2rem .4rem;border:1px solid var(--border,#777);border-radius:.25rem;color:inherit;background:transparent;cursor:pointer}
|
||||||
|
.csv-edit-toolbar button:disabled{opacity:.4;cursor:default}
|
||||||
|
.csv-edit-toolbar svg{width:1.2rem;height:1.2rem;fill:none;stroke:currentColor;stroke-width:1.7;vertical-align:middle}
|
||||||
|
.csv-edit-toolbar button:focus-visible,.csv-edit-scroll textarea:focus-visible{outline:2px solid var(--accent,#768ad7);outline-offset:-2px}
|
||||||
|
.csv-edit-toolbar output{font-variant-numeric:tabular-nums;font-size:.8rem;white-space:nowrap}
|
||||||
|
.csv-edit-toolbar span{font-size:.8rem}
|
||||||
|
.csv-edit-scroll{overflow:auto;min-height:0;flex:1;overscroll-behavior:contain}
|
||||||
|
.csv-edit-scroll table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:.85rem}
|
||||||
|
.csv-edit-scroll th,.csv-edit-scroll td{border-right:1px solid var(--border,#777);border-bottom:1px solid var(--border,#777);padding:0;vertical-align:top}
|
||||||
|
.csv-edit-scroll th{padding:.2rem .4rem;font-weight:normal;font-variant-numeric:tabular-nums;background:var(--bg,#fff);color:var(--fg,#222)}
|
||||||
|
.csv-edit-scroll thead th{position:sticky;top:0;z-index:1}
|
||||||
|
.csv-edit-scroll textarea{display:block;width:11rem;min-width:6rem;max-width:30rem;min-height:2rem;margin:0;padding:.3rem;border:0;border-radius:0;font:inherit;line-height:1.4;color:inherit;background:transparent;resize:both;box-sizing:border-box}
|
||||||
|
@media(max-width:600px){.csv-edit-toolbar button{min-width:2.75rem;min-height:2.75rem}.csv-edit-scroll textarea{min-height:2.75rem;font-size:16px}}
|
||||||
|
@media(max-width:700px){.csv-editor .editor-grid:not(.preview-hidden){grid-template-columns:1fr!important}.csv-editor .editor-grid:not(.preview-hidden)>.editor-pane{display:none}}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
html,body{height:100%;margin:0;overflow:hidden;font-family:system-ui,sans-serif}
|
||||||
|
.reveal{height:100%;font-size:30px;line-height:1.4;color:inherit}
|
||||||
|
.reveal .slides{text-align:left}.reveal h1{font-size:2em}.reveal h2{font-size:1.6em}.reveal h3{font-size:1.25em}
|
||||||
|
.reveal p,.reveal ul,.reveal ol,.reveal pre,.reveal table{margin:.6em 0}
|
||||||
|
.reveal ul,.reveal ol{display:block;margin-left:1.3em}.reveal li{margin:.2em 0}
|
||||||
|
.reveal pre{font-size:.65em;white-space:pre-wrap;padding:.5em;background:#8882;max-height:500px;overflow:auto}
|
||||||
|
.reveal code{font-family:ui-monospace,monospace}.reveal table{border-collapse:collapse;font-size:.8em}.reveal td,.reveal th{border:1px solid #8886;padding:.3em .5em}
|
||||||
|
.reveal img{max-width:90%;max-height:500px;object-fit:contain}.reveal a{color:inherit;text-decoration:underline}
|
||||||
|
.reveal .controls,.reveal .progress{color:inherit}.reveal .slide-number{font-size:16px}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
.slides-page{height:100dvh;margin:0;display:flex;flex-direction:column;overflow:hidden}
|
||||||
|
.slides-page .topbar{position:static;flex-shrink:0;display:flex;gap:1rem;align-items:center;padding:.5rem 1rem}
|
||||||
|
.slides-page .topbar span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||||
|
.slides-page [data-slides-viewer]{flex:1;min-height:0;width:100%}
|
||||||
|
.slides-preview{position:relative;min-height:300px;background:var(--bg);color:var(--fg)}
|
||||||
|
.slides-frame{display:block;border:0;width:100%;height:100%;min-height:300px;background:inherit}
|
||||||
|
.slides-frame[hidden],.slides-fallback[hidden]{display:none!important}
|
||||||
|
.slides-fallback{padding:1rem;overflow:auto;max-height:100%}
|
||||||
|
.slides-fallback section{padding:1rem;border-bottom:1px solid var(--border)}
|
||||||
|
.slides-preview:fullscreen{background:var(--bg);height:100dvh;width:100vw}
|
||||||
|
.mode-editor .slides-preview{padding:0!important;height:100%;overflow:hidden}
|
||||||
|
[data-editor-action=slides][aria-pressed=true]{color:var(--accent);background:var(--bg-elevated,var(--bg))}
|
||||||
|
@media(max-width:700px){.slides-frame{min-height:240px}.slides-page .topbar button,.slides-page .topbar a{min-height:44px;min-width:44px;display:grid;place-items:center}}
|
||||||
|
@media(max-width:700px){
|
||||||
|
body.mode-editor:has([data-editor-action=slides]){display:flex;flex-direction:column;height:100dvh}
|
||||||
|
body.mode-editor:has([data-editor-action=slides]) .topbar{height:auto;flex-shrink:0;flex-wrap:wrap;gap:.25rem}
|
||||||
|
body.mode-editor:has([data-editor-action=slides]) .topbar .brand,body.mode-editor:has([data-editor-action=slides]) .auth-user-name{display:none}
|
||||||
|
body.mode-editor:has([data-editor-action=slides]) .editor-head{flex:0 0 100%;order:1;gap:.5rem}
|
||||||
|
body.mode-editor:has([data-editor-action=slides]) .editor-head-right{flex-shrink:0}
|
||||||
|
body.mode-editor:has([data-editor-action=slides]) .container{flex:1;min-height:0;height:auto}
|
||||||
|
body.mode-editor .editor-grid:has(.slides-preview):not(.preview-hidden){grid-template-columns:1fr!important}
|
||||||
|
body.mode-editor .editor-grid:has(.slides-preview):not(.preview-hidden) .editor-pane{display:none}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
(function(root) {
|
||||||
|
'use strict';
|
||||||
|
const limits={bytes:256*1024,rows:200,columns:32,cellBytes:16*1024};
|
||||||
|
const bytes=s=>new TextEncoder().encode(s).length;
|
||||||
|
function parseRecords(source,separator) {
|
||||||
|
if(typeof source!=='string'||bytes(source)>limits.bytes||source.includes('\0'))throw Error('size');
|
||||||
|
const bom=source.startsWith('\ufeff')?'\ufeff':'',rows=[];
|
||||||
|
let i=bom.length,lineEnding='',cells=[];
|
||||||
|
while(i<source.length||cells.length){
|
||||||
|
const start=i;let value='';
|
||||||
|
if(source[i]==='"'){
|
||||||
|
i++;let closed=false;
|
||||||
|
while(i<source.length){const c=source[i++];if(c==='"'){if(source[i]==='"'){value+='"';i++;}else{closed=true;break;}}else value+=c;}
|
||||||
|
if(!closed||i<source.length&&![separator,'\r','\n'].includes(source[i]))throw Error('syntax');
|
||||||
|
value=value.replace(/\r\n/g,'\n');
|
||||||
|
}else{
|
||||||
|
while(i<source.length&&![separator,'\r','\n'].includes(source[i])){if(source[i]==='"')throw Error('syntax');value+=source[i++];}
|
||||||
|
}
|
||||||
|
if(bytes(value)>limits.cellBytes||cells.length>=limits.columns)throw Error('size');
|
||||||
|
cells.push({value,raw:source.slice(start,i),original:value});
|
||||||
|
if(source[i]===separator){i++;continue;}
|
||||||
|
let end='';
|
||||||
|
if(source[i]==='\r'){if(source[i+1]!=='\n')throw Error('syntax');end='\r\n';i+=2;}
|
||||||
|
else if(source[i]==='\n'){end='\n';i++;}
|
||||||
|
if(!lineEnding&&end)lineEnding=end;
|
||||||
|
rows.push({cells,end});cells=[];if(rows.length>limits.rows)throw Error('size');
|
||||||
|
}
|
||||||
|
return {source,bom,lineEnding:lineEnding||'\r\n',rows};
|
||||||
|
}
|
||||||
|
function parse(source){return parseRecords(source,',');}
|
||||||
|
function encode(value){return /[",\r\n]/.test(value)||/^\s/.test(value)?'"'+value.replace(/"/g,'""')+'"':value;}
|
||||||
|
function serialize(model){
|
||||||
|
const source=model.bom+model.rows.map(row=>{const record=row.cells.map(c=>c.value===c.original?c.raw:encode(c.value)).join(',');return record+(row.end||(!record?model.lineEnding:''));}).join('');
|
||||||
|
parse(source);return source;
|
||||||
|
}
|
||||||
|
function edit(source,action,row=0,column=0,value=''){
|
||||||
|
const m=parse(source),blank=()=>({value:'',raw:'',original:''});
|
||||||
|
if(action==='cell'){
|
||||||
|
if(!m.rows[row]?.cells[column]||typeof value!=='string')throw Error('cell');
|
||||||
|
m.rows[row].cells[column].value=value;
|
||||||
|
}else if(action==='add-row'){
|
||||||
|
const last=m.rows.at(-1),cols=Math.max(1,...m.rows.map(r=>r.cells.length));
|
||||||
|
if(last&&!last.end)last.end=m.lineEnding;
|
||||||
|
// A newline is necessary to distinguish a blank final row from no row.
|
||||||
|
m.rows.push({cells:Array.from({length:cols},blank),end:m.lineEnding});
|
||||||
|
}else if(action==='add-column'){
|
||||||
|
if(!m.rows.length)m.rows.push({cells:[blank()],end:m.lineEnding});
|
||||||
|
const cols=Math.max(...m.rows.map(r=>r.cells.length));
|
||||||
|
for(const r of m.rows){while(r.cells.length<cols)r.cells.push(blank());r.cells.push(blank());}
|
||||||
|
}else if(action==='delete-row'){
|
||||||
|
if(!m.rows[row])throw Error('row');m.rows.splice(row,1);
|
||||||
|
}else if(action==='delete-column'){
|
||||||
|
if(!m.rows.some(r=>r.cells[column]))throw Error('column');
|
||||||
|
for(const r of m.rows){r.cells.splice(column,1);if(!r.cells.length)r.cells.push(blank());}
|
||||||
|
}else throw Error('action');
|
||||||
|
return serialize(m);
|
||||||
|
}
|
||||||
|
function paste(source,row,column,clipboard){
|
||||||
|
// Clipboard tables use tabs, not commas. Parse and validate the entire
|
||||||
|
// operation before returning anything to the editor or its undo history.
|
||||||
|
const m=parse(source),incoming=parseRecords(clipboard,'\t');
|
||||||
|
if(!Number.isInteger(row)||!Number.isInteger(column)||row<0||column<0||row>=limits.rows||column>=limits.columns)throw Error('cell');
|
||||||
|
if(!incoming.rows.length)return source;
|
||||||
|
const width=Math.max(...incoming.rows.map(r=>r.cells.length));
|
||||||
|
if(row+incoming.rows.length>limits.rows||column+width>limits.columns)throw Error('size');
|
||||||
|
const blank=()=>({value:'',raw:'',original:''});
|
||||||
|
while(m.rows.length<row+incoming.rows.length){
|
||||||
|
const last=m.rows.at(-1);if(last&&!last.end)last.end=m.lineEnding;
|
||||||
|
m.rows.push({cells:[blank()],end:m.lineEnding});
|
||||||
|
}
|
||||||
|
for(let r=0;r<incoming.rows.length;r++){
|
||||||
|
const target=m.rows[row+r].cells,fields=incoming.rows[r].cells;
|
||||||
|
while(target.length<column+fields.length)target.push(blank());
|
||||||
|
for(let c=0;c<fields.length;c++)target[column+c].value=fields[c].value;
|
||||||
|
}
|
||||||
|
return serialize(m);
|
||||||
|
}
|
||||||
|
root.PagesCSV={parse,edit,paste,serialize,limits};
|
||||||
|
})(typeof window==='undefined'?globalThis:window);
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
const test=require('node:test'),assert=require('node:assert/strict');
|
||||||
|
require('./csv-core.js');const csv=globalThis.PagesCSV;
|
||||||
|
test('CSV parsing preserves untouched bytes and logical field values',()=>{
|
||||||
|
for(const source of ['', '\ufeff', 'a', 'a,', '\n', '""', 'a\r\nb\n', '\ufeff"name",description\r\n日本語,"a,b\r\nnext"\r\n', '"a""b",=1+1\n'])assert.equal(csv.serialize(csv.parse(source)),source);
|
||||||
|
const s='\ufeff"name",description\r\n日本語,"a,b\r\nnext"\r\n';
|
||||||
|
assert.equal(csv.parse(s).rows[1].cells[1].value,'a,b\nnext');
|
||||||
|
assert.equal(csv.edit(s,'cell',1,0,'新しい,名前'),'\ufeff"name",description\r\n"新しい,名前","a,b\r\nnext"\r\n');
|
||||||
|
assert.equal(csv.edit(s,'cell',1,1,'a,b\nnext'),s);
|
||||||
|
assert.equal(csv.edit('a','cell',0,0,''),'\r\n');
|
||||||
|
});
|
||||||
|
test('Row and column operations preserve fields; empty and ragged data are explicit',()=>{
|
||||||
|
assert.equal(csv.edit('a,b\nc\n','add-column'),'a,b,\nc,,\n');
|
||||||
|
assert.equal(csv.edit('a,b\nc\n','delete-column',0,1),'a\nc\n');
|
||||||
|
assert.equal(csv.edit('a,b\r\n"c",d','delete-row',0),'"c",d');
|
||||||
|
assert.equal(csv.edit('a,b','add-row'),'a,b\r\n,\r\n');
|
||||||
|
assert.equal(csv.parse(csv.edit('','add-row')).rows.length,1);
|
||||||
|
assert.equal(csv.edit('a\n','delete-row',0),'');
|
||||||
|
});
|
||||||
|
test('Malformed and excessive data fail without truncation',()=>{
|
||||||
|
for(const source of ['"unfinished','a"b','"a"x','a\rb','a\0b','x'.repeat(256*1024+1),'x'.repeat(16385), 'a,'.repeat(32), 'a\n'.repeat(201)])assert.throws(()=>csv.parse(source));
|
||||||
|
assert.throws(()=>csv.edit('a\n'.repeat(200),'add-row'));
|
||||||
|
assert.throws(()=>csv.edit('a','cell',0,0,'x'.repeat(16385)));
|
||||||
|
assert.throws(()=>csv.edit('a','cell',2,0,'bad'));
|
||||||
|
});
|
||||||
|
test('Quotes, HTML, formulas and newlines remain inert CSV data',()=>{
|
||||||
|
for(const value of ['"','a,b','<img src=x onerror=alert(1)>','{{children}}','=SUM(A1:A9)',' leading','日本語\n次の行','a\r\nb']){
|
||||||
|
const source=csv.edit('old,unchanged\r\n','cell',0,0,value);
|
||||||
|
assert.equal(csv.parse(source).rows[0].cells[0].value,value.replace(/\r\n/g,'\n'));
|
||||||
|
assert.ok(source.endsWith(',unchanged\r\n'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('Tab-separated paste preserves untouched CSV bytes and treats commas as data',()=>{
|
||||||
|
const source='\ufeff"keep",old,last\r\n"unchanged",x,y\n';
|
||||||
|
assert.equal(csv.paste(source,0,1,'日本語,値\t"a""b"\r\nnext\tfinal\r\n'),
|
||||||
|
'\ufeff"keep","日本語,値","a""b"\r\n"unchanged",next,final\n');
|
||||||
|
assert.equal(csv.paste(source,0,0,'keep\told\tlast\nunchanged\tx\ty\n'),source);
|
||||||
|
assert.equal(csv.paste('a,b\n',0,0,'"line1\r\nline2"\t"tab\tvalue"\n'),'"line1\nline2",tab\tvalue\n');
|
||||||
|
});
|
||||||
|
test('Paste grows only required rows and cells, preserving ragged data',()=>{
|
||||||
|
assert.equal(csv.paste('a,b\nc\nz\n',0,1,'x\ty\nz'),'a,x,y\nc,z\nz\n');
|
||||||
|
assert.equal(csv.paste('a,b',0,1,'x\ty\nz\tw'),'a,x,y\r\n,z,w\r\n');
|
||||||
|
assert.equal(csv.paste('',0,0,'a\tb\n'),'a,b\r\n');
|
||||||
|
assert.equal(csv.paste('a,b\n',0,0,'\t\n'),',\n');
|
||||||
|
assert.equal(csv.paste('a,b\n',0,0,''),'a,b\n');
|
||||||
|
});
|
||||||
|
test('Paste validates both input and final CSV size without partial writes',()=>{
|
||||||
|
const source='original,untouched\r\n';
|
||||||
|
for(const text of ['a\tb\n"unfinished','a\0b\tc','x'.repeat(16385)+'\tb','a\n'.repeat(201),'a\t'.repeat(32)])assert.throws(()=>csv.paste(source,0,0,text));
|
||||||
|
for(const [row,col] of [[-1,0],[0,-1],[0.5,0],[0,NaN],[200,0],[0,32]])assert.throws(()=>csv.paste(source,row,col,'a\tb'));
|
||||||
|
assert.throws(()=>csv.paste(source,199,0,'a\nb'));
|
||||||
|
assert.throws(()=>csv.paste(source,0,31,'a\tb'));
|
||||||
|
// Valid individual cells can still exceed the total document limit.
|
||||||
|
const big=Array(16).fill('x'.repeat(16000)).join(',');
|
||||||
|
assert.throws(()=>csv.paste(big,0,16,'y'.repeat(16000)));
|
||||||
|
// Quoting comma-heavy clipboard data expands the resulting CSV.
|
||||||
|
assert.throws(()=>csv.paste('',0,0,Array(16).fill(','.repeat(16383)).join('\t')));
|
||||||
|
assert.equal(source,'original,untouched\r\n');
|
||||||
|
});
|
||||||
|
test('Pasted HTML, macros and formulas remain values rather than executable content',()=>{
|
||||||
|
const values=['<img src=x onerror=alert(1)>','{{children}}','=SUM(A1:A9)'];
|
||||||
|
assert.deepEqual(csv.parse(csv.paste('',0,0,values.join('\t'))).rows[0].cells.map(c=>c.value),values);
|
||||||
|
});
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const views=new WeakMap(),pageSize=25;
|
||||||
|
const el=(tag,text)=>{const n=document.createElement(tag);if(text!==undefined)n.textContent=text;return n;};
|
||||||
|
class TableEditor {
|
||||||
|
constructor(editor){this.editor=editor;this.page=0;this.selected=null;this.last=null;this.undo=[];this.redo=[];}
|
||||||
|
t(en,ja){return this.editor.ja?ja:en;}
|
||||||
|
render(text){
|
||||||
|
if(this.last===text)return;
|
||||||
|
this.last=text;this.selected=null;
|
||||||
|
const pane=this.editor.preview;pane.classList.remove('code-preview');pane.classList.add('csv-edit-pane');pane.replaceChildren();
|
||||||
|
try{this.model=PagesCSV.parse(text);}catch{
|
||||||
|
const error=el('p',this.t('Table unavailable: check CSV syntax or limits (200 rows, 32 columns, 16 KiB per cell). Edit the source; no data was truncated.','表を表示できません。CSVの構文・上限(200行、32列、セル16 KiB)を確認してください。ソースで編集できます。データは切り捨てていません。'));
|
||||||
|
error.role='status';pane.append(error);return;
|
||||||
|
}
|
||||||
|
const toolbar=el('div');toolbar.className='csv-edit-toolbar';
|
||||||
|
const button=(icon,en,ja,fn)=>{const b=el('button',icon);b.type='button';b.title=b.ariaLabel=this.t(en,ja);b.onclick=fn;toolbar.append(b);return b;};
|
||||||
|
const save=button('','Save','保存',async()=>{save.disabled=true;try{await this.editor.saveNow();}finally{save.disabled=false;}});
|
||||||
|
save.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h12l2 2v14H5zM8 4v6h8V4M8 20v-6h8v6"/></svg>';
|
||||||
|
button('+↧','Add row','行を追加',()=>this.change('add-row'));
|
||||||
|
button('+→','Add column','列を追加',()=>this.change('add-column'));
|
||||||
|
this.deleteRow=button('−↧','Delete selected row','選択行を削除',()=>this.change('delete-row'));
|
||||||
|
this.deleteColumn=button('−→','Delete selected column','選択列を削除',()=>this.change('delete-column'));
|
||||||
|
this.deleteRow.disabled=this.deleteColumn.disabled=true;
|
||||||
|
const undo=button('↶','Undo table edit','表の編集を元に戻す',()=>this.history(false));undo.disabled=!this.undo.length;
|
||||||
|
const redo=button('↷','Redo table edit','表の編集をやり直す',()=>this.history(true));redo.disabled=!this.redo.length;
|
||||||
|
this.undoButton=undo;this.redoButton=redo;
|
||||||
|
this.page=Math.max(0,Math.min(this.page,Math.ceil(this.model.rows.length/pageSize)-1));
|
||||||
|
const previous=button('‹','Previous rows','前の行',()=>{this.page--;this.last=null;this.render(this.editor.text());});previous.disabled=this.page===0;
|
||||||
|
const first=this.page*pageSize,end=Math.min(first+pageSize,this.model.rows.length);
|
||||||
|
this.position=el('output',this.model.rows.length?`${first+1}–${end} / ${this.model.rows.length}`:'0');toolbar.append(this.position);
|
||||||
|
const next=button('›','Next rows','次の行',()=>{this.page++;this.last=null;this.render(this.editor.text());});next.disabled=end>=this.model.rows.length;
|
||||||
|
this.message=el('span');this.message.role='status';toolbar.append(this.message);
|
||||||
|
const saved=el('span',document.getElementById('editor-save-status')?.textContent||'');saved.dataset.csvSaveStatus='';saved.role='status';toolbar.append(saved);pane.append(toolbar);
|
||||||
|
const scroll=el('div');scroll.className='csv-edit-scroll';const table=el('table');table.setAttribute('aria-label',this.t('CSV cells','CSVのセル'));
|
||||||
|
const head=el('thead'),hr=el('tr');hr.append(el('th','#'));
|
||||||
|
const width=Math.max(0,...this.model.rows.map(r=>r.cells.length));
|
||||||
|
for(let c=0;c<width;c++){const th=el('th',String(c+1));th.scope='col';hr.append(th);}head.append(hr);table.append(head);
|
||||||
|
const body=el('tbody');
|
||||||
|
for(let r=first;r<end;r++){
|
||||||
|
const tr=el('tr'),number=el('th',String(r+1));number.scope='row';tr.append(number);
|
||||||
|
for(let c=0;c<width;c++){
|
||||||
|
const td=el('td'),cell=this.model.rows[r].cells[c];
|
||||||
|
if(cell){const input=el('textarea');input.value=cell.value;input.rows=cell.value.includes('\n')?3:1;input.spellcheck=false;input.dataset.row=r;input.dataset.column=c;input.ariaLabel=this.t(`Row ${r+1}, column ${c+1}`,`${r+1}行 ${c+1}列`);
|
||||||
|
input.addEventListener('focus',()=>{this.selected=[r,c];this.deleteRow.disabled=this.deleteColumn.disabled=false;});
|
||||||
|
input.addEventListener('input',()=>this.change('cell',r,c,input.value,input));td.append(input);
|
||||||
|
input.addEventListener('paste',event=>{
|
||||||
|
const text=event.clipboardData?.getData('text/plain');
|
||||||
|
if(typeof text!=='string'||!/[\t\r\n]/.test(text))return;
|
||||||
|
event.preventDefault();this.change('paste',r,c,text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
tr.append(td);
|
||||||
|
}
|
||||||
|
body.append(tr);
|
||||||
|
}
|
||||||
|
table.append(body);scroll.append(table);pane.append(scroll);
|
||||||
|
}
|
||||||
|
change(action,row=this.selected?.[0],column=this.selected?.[1],value,input){
|
||||||
|
const source=this.editor.text();
|
||||||
|
if(source!==this.last){this.last=null;this.render(source);return;}
|
||||||
|
try{
|
||||||
|
const next=action==='paste'?PagesCSV.paste(source,row,column,value):PagesCSV.edit(source,action,row,column,value);if(next===source)return;
|
||||||
|
this.undo.push({before:source,after:next});if(this.undo.length>20)this.undo.shift();this.redo=[];
|
||||||
|
if(action==='cell'){
|
||||||
|
// Keep the active textarea and its caret; delayed preview is a no-op.
|
||||||
|
this.model=PagesCSV.parse(next);this.last=next;this.editor.setText(next);
|
||||||
|
this.undoButton.disabled=false;this.redoButton.disabled=true;this.message.textContent='';
|
||||||
|
}else{
|
||||||
|
if(action==='add-row')this.page=Math.floor((PagesCSV.parse(next).rows.length-1)/pageSize);
|
||||||
|
this.last=null;this.editor.setText(next);this.render(next);
|
||||||
|
if(action==='paste')this.editor.preview.querySelector(`textarea[data-row="${row}"][data-column="${column}"]`)?.focus();
|
||||||
|
}
|
||||||
|
}catch{
|
||||||
|
if(input)input.value=this.model.rows[row].cells[column].value;
|
||||||
|
this.message.textContent=action==='paste'?this.t('Paste rejected: invalid tab-separated data or CSV limits exceeded. Source retained.','貼り付けできません。タブ区切りデータの形式またはCSVの上限を確認してください。元の内容を保持しました。'):this.t('Edit exceeds CSV limits. Source retained.','CSVの上限を超えます。元の内容を保持しました。');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
history(forward){
|
||||||
|
const from=forward?this.redo:this.undo,to=forward?this.undo:this.redo;if(!from.length)return;
|
||||||
|
const item=from.at(-1),current=this.editor.text();
|
||||||
|
if(current!==(forward?item.before:item.after)){this.message.textContent=this.t('Source changed. Use source editor undo.','ソースが変更されています。ソース側の取り消しを使ってください。');return;}
|
||||||
|
from.pop();to.push(item);const text=forward?item.after:item.before;this.last=null;this.editor.setText(text);this.render(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.PagesCSVEditor={render(editor,text){let view=views.get(editor);if(!view){view=new TableEditor(editor);views.set(editor,view);}view.render(text);}};
|
||||||
|
})();
|
||||||
+40
-10
@@ -6,8 +6,12 @@ window.PagesEditor = {
|
|||||||
this.mount = document.getElementById('editor-mount')
|
this.mount = document.getElementById('editor-mount')
|
||||||
if (!this.editor || !this.preview || !this.mount) return
|
if (!this.editor || !this.preview || !this.mount) return
|
||||||
this.baseRevision = this.mount.dataset.baseRevision || ''
|
this.baseRevision = this.mount.dataset.baseRevision || ''
|
||||||
this.baseBody = document.getElementById('editor-base')?.value || ''
|
// HTML textarea parsing and CodeMirror's default input both normalize
|
||||||
this.initialText = this.editor.value
|
// CRLF. CSV receives an escaped JS string and uses LF-only splitting.
|
||||||
|
this.csvInitialSource = this.mount.dataset.csv === 'true' ? window.PagesCSVSource : undefined
|
||||||
|
delete window.PagesCSVSource
|
||||||
|
this.baseBody = this.csvInitialSource ?? (document.getElementById('editor-base')?.value || '')
|
||||||
|
this.initialText = this.csvInitialSource ?? this.editor.value
|
||||||
this.owner = this.mount.dataset.owner || ''
|
this.owner = this.mount.dataset.owner || ''
|
||||||
this.serial = 0
|
this.serial = 0
|
||||||
this.paused = false
|
this.paused = false
|
||||||
@@ -25,6 +29,12 @@ window.PagesEditor = {
|
|||||||
if (action === 'delete') window.PagesPathActions?.removeCurrentPath()
|
if (action === 'delete') window.PagesPathActions?.removeCurrentPath()
|
||||||
if (action === 'html' || action === 'markdown') this.switchFormat(action)
|
if (action === 'html' || action === 'markdown') this.switchFormat(action)
|
||||||
if (action === 'preview') window.toggleEditorPreview()
|
if (action === 'preview') window.toggleEditorPreview()
|
||||||
|
if (action === 'slides' && window.PagesSlides) {
|
||||||
|
this.slidePreview=!this.slidePreview
|
||||||
|
button.setAttribute('aria-pressed',String(this.slidePreview))
|
||||||
|
if(this.slidePreview)window.setEditorPreviewVisible?.(true)
|
||||||
|
this.renderPreview()
|
||||||
|
}
|
||||||
if (action === 'tools') this.tools()
|
if (action === 'tools') this.tools()
|
||||||
if (action === 'language') this.languageDialog()
|
if (action === 'language') this.languageDialog()
|
||||||
if (action === 'restore') this.historyDialog()
|
if (action === 'restore') this.historyDialog()
|
||||||
@@ -65,17 +75,21 @@ window.PagesEditor = {
|
|||||||
exists:['指定言語には既に本文があります。編集として開いてください','This language already exists. Open it for editing'], history:['過去のリビジョンを復元','Restore a previous revision'],
|
exists:['指定言語には既に本文があります。編集として開いてください','This language already exists. Open it for editing'], history:['過去のリビジョンを復元','Restore a previous revision'],
|
||||||
signin:['再ログイン(別タブ)','Sign in again (new tab)'], insert:['挿入','Insert'], invalid:['言語タグを確認してください','Check the language tag'], identity:['別アカウントに切り替わっています。元のアカウントで開き直してください','Account changed. Reopen using the original account'],
|
signin:['再ログイン(別タブ)','Sign in again (new tab)'], insert:['挿入','Insert'], invalid:['言語タグを確認してください','Check the language tag'], identity:['別アカウントに切り替わっています。元のアカウントで開き直してください','Account changed. Reopen using the original account'],
|
||||||
incompatible:['ファイル形式が変更されています。下書きを退避して開き直してください','File type changed. Download your draft and reopen'], older:['さらに古い履歴','Older revisions'],
|
incompatible:['ファイル形式が変更されています。下書きを退避して開き直してください','File type changed. Download your draft and reopen'], older:['さらに古い履歴','Older revisions'],
|
||||||
|
csvlimit:['CSVは256 KiB以内で保存してください。下書きは保持しています','CSV must be at most 256 KiB. Your draft is retained'],
|
||||||
children:['子ページ一覧','Children'], table:['表','Table'], figure:['画像とキャプション','Image + caption'], note:['補足','Note'], code:['コードブロック','Code block'], quote:['引用','Quote'],
|
children:['子ページ一覧','Children'], table:['表','Table'], figure:['画像とキャプション','Image + caption'], note:['補足','Note'], code:['コードブロック','Code block'], quote:['引用','Quote'],
|
||||||
|
csv:['CSVの表を埋め込む','Embed CSV table'],
|
||||||
protected:['Markdown で表せない HTML は {=html} ブロックに保持します。ブロック内も編集でき、保存・プレビュー時に HTML として扱います。','HTML not representable in Markdown is retained in editable {=html} blocks and rendered as HTML on save / preview.'],
|
protected:['Markdown で表せない HTML は {=html} ブロックに保持します。ブロック内も編集でき、保存・プレビュー時に HTML として扱います。','HTML not representable in Markdown is retained in editable {=html} blocks and rendered as HTML on save / preview.'],
|
||||||
}
|
}
|
||||||
return text[key]?.[this.ja ? 0 : 1] || key
|
return text[key]?.[this.ja ? 0 : 1] || key
|
||||||
},
|
},
|
||||||
value(id) { return document.getElementById(id)?.value || '' },
|
value(id) { return document.getElementById(id)?.value || '' },
|
||||||
format() {return this.value('edit-type')},
|
format() {return this.value('edit-type')},
|
||||||
text() {return window.PagesWikiCodeMirror?.state.doc.toString() ?? this.editor.value},
|
text() {return window.PagesWikiCodeMirror?.state.doc.toString() ?? this.csvInitialSource ?? this.editor.value},
|
||||||
status(key) {
|
status(key) {
|
||||||
const status = document.getElementById('editor-save-status')
|
const status = document.getElementById('editor-save-status')
|
||||||
if (status) {status.textContent = this.t(key); status.dataset.state = key}
|
if (status) {status.textContent = this.t(key); status.dataset.state = key}
|
||||||
|
const csvStatus=this.preview?.querySelector('[data-csv-save-status]')
|
||||||
|
if (csvStatus) csvStatus.textContent=this.t(key)
|
||||||
},
|
},
|
||||||
keyPrefix() {return 'pageswiki.draft.v1:'+JSON.stringify([this.mount.dataset.domain,this.owner,this.value('object-uuid'),this.value('page-language')||'und'])+':'},
|
keyPrefix() {return 'pageswiki.draft.v1:'+JSON.stringify([this.mount.dataset.domain,this.owner,this.value('object-uuid'),this.value('page-language')||'und'])+':'},
|
||||||
expireDrafts() {
|
expireDrafts() {
|
||||||
@@ -180,6 +194,7 @@ window.PagesEditor = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async canonical(text = this.text(), format = this.format()) {
|
async canonical(text = this.text(), format = this.format()) {
|
||||||
|
if (this.mount.dataset.csv === 'true' && (new TextEncoder().encode(text).length > 256*1024 || text.includes('\0'))) throw {kind:'csvlimit'}
|
||||||
if (text === this.initialText && format === this.initialFormat) return this.baseBody
|
if (text === this.initialText && format === this.initialFormat) return this.baseBody
|
||||||
if (format !== 'markdown') return text
|
if (format !== 'markdown') return text
|
||||||
const data = await this.post('/_/api/v1/render/markdown',{markdown:text,authoring:true})
|
const data = await this.post('/_/api/v1/render/markdown',{markdown:text,authoring:true})
|
||||||
@@ -192,6 +207,7 @@ window.PagesEditor = {
|
|||||||
const controller = new AbortController()
|
const controller = new AbortController()
|
||||||
this.previewController = controller
|
this.previewController = controller
|
||||||
const text = this.text()
|
const text = this.text()
|
||||||
|
if (this.mount.dataset.csv === 'true' && window.PagesCSVEditor) {window.PagesCSVEditor.render(this,text); return}
|
||||||
if (this.format() === 'code' || this.format() === 'plain') {this.preview.classList.add('code-preview'); this.preview.textContent=text; return}
|
if (this.format() === 'code' || this.format() === 'plain') {this.preview.classList.add('code-preview'); this.preview.textContent=text; return}
|
||||||
try {
|
try {
|
||||||
const data = await this.post('/_/api/v1/render/markdown',{
|
const data = await this.post('/_/api/v1/render/markdown',{
|
||||||
@@ -199,10 +215,16 @@ window.PagesEditor = {
|
|||||||
},{signal:controller.signal})
|
},{signal:controller.signal})
|
||||||
if (controller.signal.aborted || text !== this.text()) return
|
if (controller.signal.aborted || text !== this.text()) return
|
||||||
this.preview.classList.remove('code-preview')
|
this.preview.classList.remove('code-preview')
|
||||||
|
if (this.slidePreview && window.PagesSlides) {
|
||||||
|
try {window.PagesSlides.render(this.preview,data.html,window.PagesWikiCurrentPath||'/');return}
|
||||||
|
catch {window.PagesSlides.clear(this.preview);this.preview.textContent=this.ja?'スライドの上限を超えています(256 KiB・100枚)。通常プレビューを使用してください。':'Slide limits exceeded (256 KiB, 100 slides). Use normal preview.';return}
|
||||||
|
}
|
||||||
|
window.PagesSlides?.clear(this.preview)
|
||||||
this.preview.innerHTML = data.html
|
this.preview.innerHTML = data.html
|
||||||
window.PagesWikiLoadChildren?.(this.preview)
|
window.PagesWikiLoadChildren?.(this.preview)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (controller.signal.aborted) return
|
if (controller.signal.aborted) return
|
||||||
|
window.PagesSlides?.clear(this.preview)
|
||||||
this.preview.classList.add('code-preview'); this.preview.textContent=text
|
this.preview.classList.add('code-preview'); this.preview.textContent=text
|
||||||
this.fail(error)
|
this.fail(error)
|
||||||
}
|
}
|
||||||
@@ -270,7 +292,9 @@ window.PagesEditor = {
|
|||||||
this.dirty=false; this.paused=false; this.clearDraft(); this.status('saved'); return
|
this.dirty=false; this.paused=false; this.clearDraft(); this.status('saved'); return
|
||||||
}
|
}
|
||||||
if (serial !== this.serial) {this.status('remote'); this.persist(); return}
|
if (serial !== this.serial) {this.status('remote'); this.persist(); return}
|
||||||
const merged = PagesEditorCore.merge(this.baseBody,local,remote.body)
|
// Text ranges do not describe CSV record boundaries. Review competing
|
||||||
|
// table edits rather than silently combining rows/columns incorrectly.
|
||||||
|
const merged = this.mount.dataset.csv === 'true' ? null : PagesEditorCore.merge(this.baseBody,local,remote.body)
|
||||||
const apply = result => {
|
const apply = result => {
|
||||||
this.baseRevision=remote.revision_uuid; this.baseBody=remote.body
|
this.baseRevision=remote.revision_uuid; this.baseBody=remote.body
|
||||||
document.getElementById('page-filename').value=remote.filename||''
|
document.getElementById('page-filename').value=remote.filename||''
|
||||||
@@ -301,12 +325,13 @@ window.PagesEditor = {
|
|||||||
const oldFormat = this.format()
|
const oldFormat = this.format()
|
||||||
document.getElementById('edit-type').value=format
|
document.getElementById('edit-type').value=format
|
||||||
const status=document.getElementById('editor-format-status')
|
const status=document.getElementById('editor-format-status')
|
||||||
if (status) status.textContent=format
|
if (status) status.textContent=this.mount.dataset.csv === 'true' ? 'CSV' : format
|
||||||
this.editor.value=text
|
this.editor.value=text
|
||||||
|
if (this.mount.dataset.csv === 'true') this.csvInitialSource=text
|
||||||
if (oldFormat !== format && window.PagesWikiCodeMirror) {
|
if (oldFormat !== format && window.PagesWikiCodeMirror) {
|
||||||
window.PagesWikiCodeMirror.destroy()
|
window.PagesWikiCodeMirror.destroy()
|
||||||
window.PagesWikiCodeMirror = window.PagesWikiEditor.create(this.mount,text,format,{
|
window.PagesWikiCodeMirror = window.PagesWikiEditor.create(this.mount,text,format,{
|
||||||
keymap:this.mount.dataset.keymap,syntax:this.mount.dataset.syntax==='true',autocomplete:this.mount.dataset.autocomplete==='true',
|
keymap:this.mount.dataset.keymap,syntax:this.mount.dataset.syntax==='true',autocomplete:this.mount.dataset.autocomplete==='true',preserveLineEndings:this.mount.dataset.csv==='true',
|
||||||
})
|
})
|
||||||
} else if (window.PagesWikiCodeMirror) {
|
} else if (window.PagesWikiCodeMirror) {
|
||||||
const cm=window.PagesWikiCodeMirror
|
const cm=window.PagesWikiCodeMirror
|
||||||
@@ -368,19 +393,24 @@ window.PagesEditor = {
|
|||||||
const {dialog,content,button}=this.dialog('tools')
|
const {dialog,content,button}=this.dialog('tools')
|
||||||
this.paragraph(content,this.t('privacy'))
|
this.paragraph(content,this.t('privacy'))
|
||||||
const select=document.createElement('select'); select.setAttribute('aria-label',this.t('insert'))
|
const select=document.createElement('select'); select.setAttribute('aria-label',this.t('insert'))
|
||||||
this.paragraph(content,this.t('protected'))
|
const csvFile=this.mount.dataset.csv==='true'
|
||||||
|
if (!csvFile) this.paragraph(content,this.t('protected'))
|
||||||
const parts=[['children','{{children}}'],['table','<table>\n<thead><tr><th>Column</th></tr></thead>\n<tbody><tr><td>Value</td></tr></tbody>\n</table>'],['figure','<figure><img src="/_/obj/sha256:HASH" alt="Description"><figcaption>Caption</figcaption></figure>'],['note','<aside class="note"><p>Note</p></aside>'],['code','<pre><code class="language-text">code</code></pre>'],['quote','<blockquote><p>Quote</p></blockquote>']]
|
const parts=[['children','{{children}}'],['table','<table>\n<thead><tr><th>Column</th></tr></thead>\n<tbody><tr><td>Value</td></tr></tbody>\n</table>'],['figure','<figure><img src="/_/obj/sha256:HASH" alt="Description"><figcaption>Caption</figcaption></figure>'],['note','<aside class="note"><p>Note</p></aside>'],['code','<pre><code class="language-text">code</code></pre>'],['quote','<blockquote><p>Quote</p></blockquote>']]
|
||||||
|
parts.push(['csv','{{csv:/data/table.csv range=A1:H200 header=true}}'])
|
||||||
parts.forEach(([label],i) => {const option=document.createElement('option'); option.value=i; option.textContent=this.t(label); select.append(option)})
|
parts.forEach(([label],i) => {const option=document.createElement('option'); option.value=i; option.textContent=this.t(label); select.append(option)})
|
||||||
content.append(select)
|
content.append(select)
|
||||||
|
select.hidden=csvFile
|
||||||
const login=document.createElement('a'); login.href='/_/auth/login?return='+encodeURIComponent(location.pathname+location.search); login.target='_blank'; login.rel='noopener'; login.textContent=this.t('signin'); content.append(login)
|
const login=document.createElement('a'); login.href='/_/auth/login?return='+encodeURIComponent(location.pathname+location.search); login.target='_blank'; login.rel='noopener'; login.textContent=this.t('signin'); content.append(login)
|
||||||
button('insert',() => {
|
const insert=button('insert',() => {
|
||||||
|
if (csvFile) return
|
||||||
const part=parts[Number(select.value)]
|
const part=parts[Number(select.value)]
|
||||||
const source=this.format()==='markdown' && part[0]!=='children' ? '```{=html}\n'+part[1]+'\n```' : part[1]
|
const source=this.format()==='markdown' && !['children','csv'].includes(part[0]) ? '```{=html}\n'+part[1]+'\n```' : part[1]
|
||||||
const text='\n\n'+source+'\n\n'
|
const text='\n\n'+source+'\n\n'
|
||||||
const cm=window.PagesWikiCodeMirror
|
const cm=window.PagesWikiCodeMirror
|
||||||
if (cm) cm.dispatch(cm.state.replaceSelection(text)); else this.setText(this.text()+text)
|
if (cm) cm.dispatch(cm.state.replaceSelection(text)); else this.setText(this.text()+text)
|
||||||
dialog.close(); cm?.focus()
|
dialog.close(); cm?.focus()
|
||||||
})
|
})
|
||||||
|
insert.hidden=csvFile
|
||||||
button('export',() => this.download())
|
button('export',() => this.download())
|
||||||
button('discard',() => {
|
button('discard',() => {
|
||||||
this.clearDraft()
|
this.clearDraft()
|
||||||
@@ -429,7 +459,7 @@ window.PagesEditor = {
|
|||||||
const serial=this.serial
|
const serial=this.serial
|
||||||
const old=await this.state({revision:select.value})
|
const old=await this.state({revision:select.value})
|
||||||
if (serial!==this.serial || this.saving) return
|
if (serial!==this.serial || this.saving) return
|
||||||
if (!old.editable) throw {kind:'incompatible'}
|
if (!old.editable || this.mount.dataset.csv === 'true' && (old.content_type||'').split(';')[0] !== this.value('page-content-type').split(';')[0]) throw {kind:'incompatible'}
|
||||||
this.setText(this.format()==='markdown'?old.markdown:old.body)
|
this.setText(this.format()==='markdown'?old.markdown:old.body)
|
||||||
this.persist(); dialog.close()
|
this.persist(); dialog.close()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const token=document.body.dataset.token;
|
||||||
|
const deck=new Reveal(document.querySelector('.reveal'),{
|
||||||
|
embedded:true,hash:false,history:false,respondToHashChanges:false,
|
||||||
|
transition:'none',backgroundTransition:'none',controls:true,progress:true,
|
||||||
|
slideNumber:'c/t',autoSlide:0,autoPlayMedia:false,postMessage:false,
|
||||||
|
postMessageEvents:false,view:'slide',scrollActivationWidth:null,width:960,height:700,
|
||||||
|
});
|
||||||
|
deck.initialize().then(()=>{
|
||||||
|
deck.slide(Math.min(Number(document.body.dataset.index)||0,deck.getTotalSlides()-1));
|
||||||
|
parent.postMessage({type:'slides-ready',token,index:deck.getIndices().h},'*');
|
||||||
|
deck.on('slidechanged',()=>parent.postMessage({type:'slides-index',token,index:deck.getIndices().h},'*'));
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/* Reveal is a disposable projection. No slide DOM is ever saved as source. */
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
const nonce=document.currentScript?.nonce||'', views=new WeakMap();
|
||||||
|
const allowed=new Set('p br hr div span h1 h2 h3 h4 h5 h6 blockquote pre code b strong i em u s del ins sub sup small mark kbd ul ol li dl dt dd table thead tbody tfoot tr th td caption figure figcaption section article a img'.split(' '));
|
||||||
|
const blocked=new Set('script style iframe object embed template form input button textarea select link meta base svg math audio video'.split(' '));
|
||||||
|
function slides(html,path){
|
||||||
|
if(new TextEncoder().encode(html).length>256*1024)throw Error('size');
|
||||||
|
const input=document.createElement('template');input.innerHTML=html;
|
||||||
|
const clean=document.createDocumentFragment();let count=0;
|
||||||
|
const base=new URL(path||'/',location.origin);
|
||||||
|
function copy(node,parent,depth=0){
|
||||||
|
if(++count>10000||depth>64)throw Error('size');
|
||||||
|
if(node.nodeType===Node.TEXT_NODE){parent.append(document.createTextNode(node.textContent));return;}
|
||||||
|
if(node.nodeType!==Node.ELEMENT_NODE)return;
|
||||||
|
const tag=node.localName;if(blocked.has(tag))return;
|
||||||
|
let target=parent;
|
||||||
|
if(allowed.has(tag)){
|
||||||
|
target=document.createElement(tag==='section'&&depth>0?'div':tag);parent.append(target);
|
||||||
|
// Never forward Reveal data-*, IDs, styles or event handlers from content.
|
||||||
|
for(const attr of ['title','alt','colspan','rowspan']){
|
||||||
|
const value=node.getAttribute(attr);
|
||||||
|
if(value!==null&&(!['colspan','rowspan'].includes(attr)||/^[1-9][0-9]{0,2}$/.test(value)))target.setAttribute(attr,value);
|
||||||
|
}
|
||||||
|
const attr=tag==='a'?'href':tag==='img'?'src':null;
|
||||||
|
if(attr&&node.hasAttribute(attr)){
|
||||||
|
try{const url=new URL(node.getAttribute(attr),base);
|
||||||
|
if(['http:','https:'].includes(url.protocol)&&!url.username&&!url.password&&(tag!=='img'||url.origin===location.origin)){
|
||||||
|
target.setAttribute(attr,url.href);
|
||||||
|
if(tag==='a'){target.target='_blank';target.rel='noopener noreferrer';}
|
||||||
|
else{target.loading='lazy';target.referrerPolicy='no-referrer';}
|
||||||
|
}
|
||||||
|
}catch{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(const child of node.childNodes)copy(child,target,depth+1);
|
||||||
|
}
|
||||||
|
for(const node of input.content.childNodes)copy(node,clean);
|
||||||
|
const result=[];let section=document.createElement('section');
|
||||||
|
const flush=()=>{if(section.textContent.trim()||section.querySelector('img,table,hr')){result.push(section);section=document.createElement('section');}};
|
||||||
|
for(const node of [...clean.childNodes]){
|
||||||
|
if(node.nodeName==='HR'){flush();}
|
||||||
|
else if(node.nodeName==='SECTION'){flush();result.push(node);}
|
||||||
|
else section.append(node);
|
||||||
|
}
|
||||||
|
flush();if(!result.length)result.push(section);if(result.length>100)throw Error('size');
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
function clear(host){const view=views.get(host);if(view){clearTimeout(view.timer);window.removeEventListener('message',view.listener);views.delete(host);}host.classList.remove('slides-preview');}
|
||||||
|
function render(host,html,path){
|
||||||
|
clear(host);
|
||||||
|
const sections=slides(html,path),doc=document.implementation.createHTMLDocument('Slides');
|
||||||
|
const token=crypto.randomUUID(),origin=location.origin;
|
||||||
|
const meta=doc.createElement('meta');meta.httpEquiv='Content-Security-Policy';
|
||||||
|
meta.content=`default-src 'none'; script-src 'nonce-${nonce}'; script-src-attr 'none'; style-src ${origin} 'unsafe-inline'; img-src ${origin}; connect-src 'none'; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'`;
|
||||||
|
doc.head.prepend(meta);
|
||||||
|
for(const file of ['/static/vendor/reveal/reveal.css','/static/css/slides-frame.css']){const link=doc.createElement('link');link.rel='stylesheet';link.href=origin+file;doc.head.append(link);}
|
||||||
|
const colors=getComputedStyle(host),style=doc.createElement('style');
|
||||||
|
// Computed colors only; no authored CSS enters this isolated document.
|
||||||
|
style.textContent=`html,body,.reveal-viewport{background:${colors.backgroundColor==='rgba(0, 0, 0, 0)'?getComputedStyle(document.body).backgroundColor:colors.backgroundColor}!important;color:${colors.color}!important}`;doc.head.append(style);
|
||||||
|
const root=doc.createElement('div');root.className='reveal';const container=doc.createElement('div');container.className='slides';
|
||||||
|
for(const section of sections)container.append(doc.importNode(section,true));root.append(container);doc.body.append(root);
|
||||||
|
doc.body.dataset.token=token;doc.body.dataset.index=host.dataset.slideIndex||'0';
|
||||||
|
for(const file of ['/static/vendor/reveal/reveal.js','/static/js/slides-frame.js']){const script=doc.createElement('script');script.setAttribute('nonce',nonce);script.src=origin+file;doc.body.append(script);}
|
||||||
|
const frame=document.createElement('iframe');frame.className='slides-frame';frame.title=document.documentElement.lang.startsWith('ja')?'スライド':'Slides';
|
||||||
|
frame.setAttribute('sandbox','allow-scripts allow-popups');frame.setAttribute('allow','fullscreen');frame.referrerPolicy='no-referrer';
|
||||||
|
const fallback=document.createElement('div');fallback.className='slides-fallback';for(const section of sections)fallback.append(section);
|
||||||
|
// Keep a static projection available when the local runtime fails to load.
|
||||||
|
host.classList.add('slides-preview');host.replaceChildren(frame,fallback);
|
||||||
|
const listener=event=>{
|
||||||
|
if(event.source!==frame.contentWindow||event.data?.token!==token)return;
|
||||||
|
if(event.data.type==='slides-ready'){frame.dataset.ready='true';frame.dataset.count=String(sections.length);frame.hidden=false;fallback.hidden=true;clearTimeout(timer);}
|
||||||
|
if(['slides-index','slides-ready'].includes(event.data.type)&&Number.isInteger(event.data.index)&&event.data.index>=0&&event.data.index<sections.length)host.dataset.slideIndex=String(event.data.index);
|
||||||
|
};
|
||||||
|
window.addEventListener('message',listener);
|
||||||
|
const timer=setTimeout(()=>{if(frame.dataset.ready!=='true'){frame.hidden=true;fallback.hidden=false;}},8000);
|
||||||
|
views.set(host,{listener,timer});frame.srcdoc='<!doctype html>'+doc.documentElement.outerHTML;
|
||||||
|
}
|
||||||
|
window.PagesSlides={render,clear};
|
||||||
|
document.addEventListener('DOMContentLoaded',()=>{
|
||||||
|
const host=document.querySelector('[data-slides-viewer]');if(!host)return;
|
||||||
|
try{render(host,document.querySelector('[data-slides-source]').value,host.dataset.path);}catch{host.textContent=host.dataset.error;}
|
||||||
|
document.querySelector('[data-slides-fullscreen]')?.addEventListener('click',()=>{if(document.fullscreenElement)document.exitFullscreen?.();else host.requestFullscreen?.().catch(()=>{});});
|
||||||
|
});
|
||||||
|
})();
|
||||||
+3
@@ -38953,6 +38953,9 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
if (options.preserveLineEndings) {
|
||||||
|
extensions.push(EditorState.lineSeparator.of("\n"));
|
||||||
|
}
|
||||||
if (keymapName === "vim") {
|
if (keymapName === "vim") {
|
||||||
installVimCommands();
|
installVimCommands();
|
||||||
extensions.push(vim());
|
extensions.push(vim());
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"sources": ["../../../assets/editor/node_modules/@marijn/find-cluster-break/src/index.js", "../../../assets/editor/node_modules/@codemirror/state/dist/index.js", "../../../assets/editor/node_modules/style-mod/src/style-mod.js", "../../../assets/editor/node_modules/w3c-keyname/index.js", "../../../assets/editor/node_modules/@codemirror/view/dist/index.js", "../../../assets/editor/node_modules/@lezer/common/dist/index.js", "../../../assets/editor/node_modules/@lezer/highlight/dist/index.js", "../../../assets/editor/node_modules/@codemirror/language/dist/index.js", "../../../assets/editor/node_modules/@codemirror/commands/dist/index.js", "../../../assets/editor/node_modules/@codemirror/autocomplete/dist/index.js", "../../../assets/editor/node_modules/@lezer/lr/dist/index.js", "../../../assets/editor/node_modules/@lezer/html/dist/index.js", "../../../assets/editor/node_modules/@lezer/css/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-css/dist/index.js", "../../../assets/editor/node_modules/@lezer/javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-html/dist/index.js", "../../../assets/editor/node_modules/@lezer/markdown/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-markdown/dist/index.js", "../../../assets/editor/node_modules/@lezer/python/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-python/dist/index.js", "../../../assets/editor/node_modules/@lezer/json/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-json/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-sql/dist/index.js", "../../../assets/editor/node_modules/@lezer/yaml/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-yaml/dist/index.js", "../../../assets/editor/node_modules/@lezer/go/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-go/dist/index.js", "../../../assets/editor/node_modules/@lezer/rust/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-rust/dist/index.js", "../../../assets/editor/node_modules/@lezer/java/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-java/dist/index.js", "../../../assets/editor/node_modules/@lezer/cpp/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-cpp/dist/index.js", "../../../assets/editor/node_modules/@codemirror/legacy-modes/mode/shell.js", "../../../assets/editor/node_modules/@codemirror/legacy-modes/mode/toml.js", "../../../assets/editor/node_modules/@codemirror/search/dist/index.js", "../../../assets/editor/node_modules/@replit/codemirror-vim/dist/index.js", "../../../assets/editor/src/editor.js"],
|
"sources": ["../../../assets/editor/node_modules/@marijn/find-cluster-break/src/index.js", "../../../assets/editor/node_modules/@codemirror/state/dist/index.js", "../../../assets/editor/node_modules/style-mod/src/style-mod.js", "../../../assets/editor/node_modules/w3c-keyname/index.js", "../../../assets/editor/node_modules/@codemirror/view/dist/index.js", "../../../assets/editor/node_modules/@lezer/common/dist/index.js", "../../../assets/editor/node_modules/@lezer/highlight/dist/index.js", "../../../assets/editor/node_modules/@codemirror/language/dist/index.js", "../../../assets/editor/node_modules/@codemirror/commands/dist/index.js", "../../../assets/editor/node_modules/@codemirror/autocomplete/dist/index.js", "../../../assets/editor/node_modules/@lezer/lr/dist/index.js", "../../../assets/editor/node_modules/@lezer/html/dist/index.js", "../../../assets/editor/node_modules/@lezer/css/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-css/dist/index.js", "../../../assets/editor/node_modules/@lezer/javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-javascript/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-html/dist/index.js", "../../../assets/editor/node_modules/@lezer/markdown/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-markdown/dist/index.js", "../../../assets/editor/node_modules/@lezer/python/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-python/dist/index.js", "../../../assets/editor/node_modules/@lezer/json/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-json/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-sql/dist/index.js", "../../../assets/editor/node_modules/@lezer/yaml/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-yaml/dist/index.js", "../../../assets/editor/node_modules/@lezer/go/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-go/dist/index.js", "../../../assets/editor/node_modules/@lezer/rust/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-rust/dist/index.js", "../../../assets/editor/node_modules/@lezer/java/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-java/dist/index.js", "../../../assets/editor/node_modules/@lezer/cpp/dist/index.js", "../../../assets/editor/node_modules/@codemirror/lang-cpp/dist/index.js", "../../../assets/editor/node_modules/@codemirror/legacy-modes/mode/shell.js", "../../../assets/editor/node_modules/@codemirror/legacy-modes/mode/toml.js", "../../../assets/editor/node_modules/@codemirror/search/dist/index.js", "../../../assets/editor/node_modules/@replit/codemirror-vim/dist/index.js", "../../../assets/editor/src/editor.js"],
|
||||||
"sourcesContent": ["// These are filled with ranges (rangeFrom[i] up to but not including\n// rangeTo[i]) of code points that count as extending characters.\nlet rangeFrom = [], rangeTo = []\n\n;(() => {\n // Compressed representation of the Grapheme_Cluster_Break=Extend\n // information from\n // http://www.unicode.org/Public/16.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n // Each pair of elements represents a range, as an offet from the\n // previous range and a length. Numbers are in base-36, with the empty\n // string being a shorthand for 1.\n let numbers = \"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o\".split(\",\").map(s => s ? parseInt(s, 36) : 1)\n for (let i = 0, n = 0; i < numbers.length; i++)\n (i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i])\n})()\n\nexport function isExtendingChar(code) {\n if (code < 768) return false\n for (let from = 0, to = rangeFrom.length;;) {\n let mid = (from + to) >> 1\n if (code < rangeFrom[mid]) to = mid\n else if (code >= rangeTo[mid]) from = mid + 1\n else return true\n if (from == to) return false\n }\n}\n\nfunction isRegionalIndicator(code) {\n return code >= 0x1F1E6 && code <= 0x1F1FF\n}\n\nfunction check(code) {\n for (let i = 0; i < rangeFrom.length; i++) {\n if (rangeTo[i] > code) return rangeFrom[i] <= code\n }\n return false\n}\n\nconst ZWJ = 0x200d\n\nexport function findClusterBreak(str, pos, forward = true, includeExtending = true) {\n return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending)\n}\n\nfunction nextClusterBreak(str, pos, includeExtending) {\n if (pos == str.length) return pos\n // If pos is in the middle of a surrogate pair, move to its start\n if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--\n let prev = codePointAt(str, pos)\n pos += codePointSize(prev)\n while (pos < str.length) {\n let next = codePointAt(str, pos)\n if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n pos += codePointSize(next)\n prev = next\n } else if (isRegionalIndicator(next)) {\n let countBefore = 0, i = pos - 2\n while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) { countBefore++; i -= 2 }\n if (countBefore % 2 == 0) break\n else pos += 2\n } else {\n break\n }\n }\n return pos\n}\n\nfunction prevClusterBreak(str, pos, includeExtending) {\n while (pos > 0) {\n let found = nextClusterBreak(str, pos - 2, includeExtending)\n if (found < pos) return found\n pos--\n }\n return 0\n}\n\nfunction codePointAt(str, pos) {\n let code0 = str.charCodeAt(pos)\n if (!surrogateHigh(code0) || pos + 1 == str.length) return code0\n let code1 = str.charCodeAt(pos + 1)\n if (!surrogateLow(code1)) return code0\n return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000\n}\n\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000 }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00 }\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2 }\n", "import { findClusterBreak as findClusterBreak$1 } from '@marijn/find-cluster-break';\n\n/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n /**\n Get the line description around the given position.\n */\n lineAt(pos) {\n if (pos < 0 || pos > this.length)\n throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n return this.lineInner(pos, false, 1, 0);\n }\n /**\n Get the description for the given (1-based) line number.\n */\n line(n) {\n if (n < 1 || n > this.lines)\n throw new RangeError(`Invalid line number ${n}Line truncated
|
"sourcesContent": ["// These are filled with ranges (rangeFrom[i] up to but not including\n// rangeTo[i]) of code points that count as extending characters.\nlet rangeFrom = [], rangeTo = []\n\n;(() => {\n // Compressed representation of the Grapheme_Cluster_Break=Extend\n // information from\n // http://www.unicode.org/Public/16.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n // Each pair of elements represents a range, as an offet from the\n // previous range and a length. Numbers are in base-36, with the empty\n // string being a shorthand for 1.\n let numbers = \"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o\".split(\",\").map(s => s ? parseInt(s, 36) : 1)\n for (let i = 0, n = 0; i < numbers.length; i++)\n (i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i])\n})()\n\nexport function isExtendingChar(code) {\n if (code < 768) return false\n for (let from = 0, to = rangeFrom.length;;) {\n let mid = (from + to) >> 1\n if (code < rangeFrom[mid]) to = mid\n else if (code >= rangeTo[mid]) from = mid + 1\n else return true\n if (from == to) return false\n }\n}\n\nfunction isRegionalIndicator(code) {\n return code >= 0x1F1E6 && code <= 0x1F1FF\n}\n\nfunction check(code) {\n for (let i = 0; i < rangeFrom.length; i++) {\n if (rangeTo[i] > code) return rangeFrom[i] <= code\n }\n return false\n}\n\nconst ZWJ = 0x200d\n\nexport function findClusterBreak(str, pos, forward = true, includeExtending = true) {\n return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending)\n}\n\nfunction nextClusterBreak(str, pos, includeExtending) {\n if (pos == str.length) return pos\n // If pos is in the middle of a surrogate pair, move to its start\n if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--\n let prev = codePointAt(str, pos)\n pos += codePointSize(prev)\n while (pos < str.length) {\n let next = codePointAt(str, pos)\n if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n pos += codePointSize(next)\n prev = next\n } else if (isRegionalIndicator(next)) {\n let countBefore = 0, i = pos - 2\n while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) { countBefore++; i -= 2 }\n if (countBefore % 2 == 0) break\n else pos += 2\n } else {\n break\n }\n }\n return pos\n}\n\nfunction prevClusterBreak(str, pos, includeExtending) {\n while (pos > 0) {\n let found = nextClusterBreak(str, pos - 2, includeExtending)\n if (found < pos) return found\n pos--\n }\n return 0\n}\n\nfunction codePointAt(str, pos) {\n let code0 = str.charCodeAt(pos)\n if (!surrogateHigh(code0) || pos + 1 == str.length) return code0\n let code1 = str.charCodeAt(pos + 1)\n if (!surrogateLow(code1)) return code0\n return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000\n}\n\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000 }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00 }\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2 }\n", "import { findClusterBreak as findClusterBreak$1 } from '@marijn/find-cluster-break';\n\n/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n /**\n Get the line description around the given position.\n */\n lineAt(pos) {\n if (pos < 0 || pos > this.length)\n throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n return this.lineInner(pos, false, 1, 0);\n }\n /**\n Get the description for the given (1-based) line number.\n */\n line(n) {\n if (n < 1 || n > this.lines)\n throw new RangeError(`Invalid line number ${n}Line truncated
|
||||||
"mappings": "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 truncated
|
"mappings": "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 truncated
|
||||||
"names": ["Text", "a", "string", "top", "number", "findClusterBreak", "surrogateLow", "surrogateHigh", "codePointAt", "codePointSize", "MapMode", "json", "doc", "process", "insert", "i", "values", "compare", "config", "_a", "id", "prec", "content", "base", "scrollIntoView", "CharCategory", "require", "name", "defaults", "cur", "spec", "a", "id", "doc", "name", "ie", "name", "a", "BlockType", "off", "elt", "doc", "cur", "top", "rect", "Direction", "replace", "type", "isNum", "_a", "findClusterBreak", "values", "t", "id", "pos", "flatten", "Text", "dist", "cache", "blockWrappers", "marks", "tile", "decorations", "from", "to", "offset", "textHeight", "i", "content", "child", "scrollIntoView", "base", "handlers", "observers", "insert", "event", "data", "_b", "QueryType", "DecorationComparator", "gap", "key", "view", "config", "shift", "meta", "command", "codePointAt", "codePointSize", "cmd", "a", "t", "_a", "i", "values", "_a", "_b", "config", "t", "space", "top", "elt", "top", "values", "config", "gutter", "cur", "gutters", "asArray", "marker", "elt", "a", "event", "number", "marks", "Range", "config", "parser", "bracketed", "name", "id", "types", "IterMode", "data", "_a", "mounted", "cur", "cache", "nodeSet", "children", "positions", "node", "buffer", "contextHash", "length", "lookAhead", "base", "pair", "nodeSize", "nodeStart", "from", "to", "off", "string", "done", "inner", "r", "pos", "a", "name", "base", "t", "a", "sameArray", "config", "tags", "cur", "hasChild", "rangeFrom", "rangeTo", "name", "values", "data", "parser", "name", "top", "base", "_a", "doc", "stringStart", "parser", "_a", "language", "name", "a", "values", "cur", "base", "lineEnd", "space", "closing", "cur", "lineEnd", "a", "_a", "from", "to", "a", "values", "config", "baseTheme$1", "baseTheme$1", "values", "from", "to", "baseTheme", "decorations", "config", "cur", "matching", "bracket", "pos", "string", "indentUnit", "_a", "parser", "data", "line", "indentation", "off", "eol", "rangeEnd", "id", "name", "t", "config", "data", "tokens", "comment", "indent", "empty", "isAdjacent", "a", "config", "json", "command", "_a", "_b", "json", "none", "a", "isAdjacent", "t", "_f", "config", "bracket", "space", "matching", "cur", "findClusterBreak", "findClusterBreak", "nextChar", "lineEnd", "Text", "findClusterBreak", "dist", "indent", "insert", "Text", "changes", "cur", "space", "types", "words", "score", "_a", "codePointAt", "codePointSize", "a", "space", "config", "content", "off", "applyCompletion", "options", "id", "scrollIntoView", "name", "compare", "cur", "none", "noAttrs", "baseTheme", "indent", "pos", "m", "snippet", "Text", "inputHandler", "insert", "codePointSize", "codePointAt", "tokens", "bracket", "doc", "config", "content", "baseTheme", "score", "_a", "parser", "base", "count", "top", "off", "i", "Type", "data", "id", "readToken", "dialect", "FragmentCursor", "nodeSet", "Parse", "a", "tokens", "insert", "name", "config", "t", "prec", "values", "name", "getAttrs", "tags", "id", "attrs", "dash", "id", "callee", "parser", "name", "tags", "identifier", "doc", "_a", "callee", "cur", "node", "parser", "newline", "space", "slash", "question", "bracketL", "spec_identifier", "parser", "id", "doc", "top", "node", "name", "parser", "_a", "name", "config", "doc", "android", "base", "empty", "insert", "a", "elementName", "doc", "name", "identifier", "elt", "_a", "base", "config", "cur", "dialect", "autoCloseTags", "selfClosers", "_b", "to", "insert", "hash", "nodeSet", "Type", "content", "Line", "indent", "elt", "space", "count", "marks", "base", "empty", "off", "parser", "FragmentCursor", "eol", "none", "top", "rangeEnd", "t", "config", "nodeTypes", "name", "id", "rm", "spec", "a", "conc", "Element", "comment", "cur", "node", "m", "next", "parser", "heading", "doc", "number", "cur", "node", "content", "space", "config", "insert", "changes", "empty", "_a", "newline", "space", "hash", "dot", "backslash", "isHex", "spaces", "Context", "indent", "topIndent", "off", "spec_identifier", "parser", "cache", "ScopeNodes", "defID", "id", "gatherCompletions", "_a", "_b", "getScope", "doc", "top", "node", "name", "Identifier", "dontComplete", "localCompletionSource", "snippets", "base", "parser", "parser", "parser", "LineComment", "BlockComment", "String$1", "Number", "Bool", "ParenL", "BraceL", "BracketL", "Punctuation", "Identifier", "Type", "isAlpha", "keywords", "types", "defaults", "dialect", "_a", "cur", "doc", "id", "name", "top", "empty", "keyword", "parser", "language", "config", "eof", "Tag", "BracketL", "BraceL", "Context", "findColumn", "indentation", "indent", "off", "newlines", "parser", "parser", "identifier", "String", "Number", "newline", "carriageReturn", "space", "tab", "slash", "semicolon", "spec_identifier", "parser", "snippets", "cache", "ScopeNodes", "cur", "gatherCompletions", "getScope", "doc", "top", "node", "name", "Identifier", "dontComplete", "localCompletionSource", "parser", "kwCompletion", "keywords", "Dot", "count", "spec_idLine truncated
|
"names": ["Text", "a", "string", "top", "number", "findClusterBreak", "surrogateLow", "surrogateHigh", "codePointAt", "codePointSize", "MapMode", "json", "doc", "process", "insert", "i", "values", "compare", "config", "_a", "id", "prec", "content", "base", "scrollIntoView", "CharCategory", "require", "name", "defaults", "cur", "spec", "a", "id", "doc", "name", "ie", "name", "a", "BlockType", "off", "elt", "doc", "cur", "top", "rect", "Direction", "replace", "type", "isNum", "_a", "findClusterBreak", "values", "t", "id", "pos", "flatten", "Text", "dist", "cache", "blockWrappers", "marks", "tile", "decorations", "from", "to", "offset", "textHeight", "i", "content", "child", "scrollIntoView", "base", "handlers", "observers", "insert", "event", "data", "_b", "QueryType", "DecorationComparator", "gap", "key", "view", "config", "shift", "meta", "command", "codePointAt", "codePointSize", "cmd", "a", "t", "_a", "i", "values", "_a", "_b", "config", "t", "space", "top", "elt", "top", "values", "config", "gutter", "cur", "gutters", "asArray", "marker", "elt", "a", "event", "number", "marks", "Range", "config", "parser", "bracketed", "name", "id", "types", "IterMode", "data", "_a", "mounted", "cur", "cache", "nodeSet", "children", "positions", "node", "buffer", "contextHash", "length", "lookAhead", "base", "pair", "nodeSize", "nodeStart", "from", "to", "off", "string", "done", "inner", "r", "pos", "a", "name", "base", "t", "a", "sameArray", "config", "tags", "cur", "hasChild", "rangeFrom", "rangeTo", "name", "values", "data", "parser", "name", "top", "base", "_a", "doc", "stringStart", "parser", "_a", "language", "name", "a", "values", "cur", "base", "lineEnd", "space", "closing", "cur", "lineEnd", "a", "_a", "from", "to", "a", "values", "config", "baseTheme$1", "baseTheme$1", "values", "from", "to", "baseTheme", "decorations", "config", "cur", "matching", "bracket", "pos", "string", "indentUnit", "_a", "parser", "data", "line", "indentation", "off", "eol", "rangeEnd", "id", "name", "t", "config", "data", "tokens", "comment", "indent", "empty", "isAdjacent", "a", "config", "json", "command", "_a", "_b", "json", "none", "a", "isAdjacent", "t", "_f", "config", "bracket", "space", "matching", "cur", "findClusterBreak", "findClusterBreak", "nextChar", "lineEnd", "Text", "findClusterBreak", "dist", "indent", "insert", "Text", "changes", "cur", "space", "types", "words", "score", "_a", "codePointAt", "codePointSize", "a", "space", "config", "content", "off", "applyCompletion", "options", "id", "scrollIntoView", "name", "compare", "cur", "none", "noAttrs", "baseTheme", "indent", "pos", "m", "snippet", "Text", "inputHandler", "insert", "codePointSize", "codePointAt", "tokens", "bracket", "doc", "config", "content", "baseTheme", "score", "_a", "parser", "base", "count", "top", "off", "i", "Type", "data", "id", "readToken", "dialect", "FragmentCursor", "nodeSet", "Parse", "a", "tokens", "insert", "name", "config", "t", "prec", "values", "name", "getAttrs", "tags", "id", "attrs", "dash", "id", "callee", "parser", "name", "tags", "identifier", "doc", "_a", "callee", "cur", "node", "parser", "newline", "space", "slash", "question", "bracketL", "spec_identifier", "parser", "id", "doc", "top", "node", "name", "parser", "_a", "name", "config", "doc", "android", "base", "empty", "insert", "a", "elementName", "doc", "name", "identifier", "elt", "_a", "base", "config", "cur", "dialect", "autoCloseTags", "selfClosers", "_b", "to", "insert", "hash", "nodeSet", "Type", "content", "Line", "indent", "elt", "space", "count", "marks", "base", "empty", "off", "parser", "FragmentCursor", "eol", "none", "top", "rangeEnd", "t", "config", "nodeTypes", "name", "id", "rm", "spec", "a", "conc", "Element", "comment", "cur", "node", "m", "next", "parser", "heading", "doc", "number", "cur", "node", "content", "space", "config", "insert", "changes", "empty", "_a", "newline", "space", "hash", "dot", "backslash", "isHex", "spaces", "Context", "indent", "topIndent", "off", "spec_identifier", "parser", "cache", "ScopeNodes", "defID", "id", "gatherCompletions", "_a", "_b", "getScope", "doc", "top", "node", "name", "Identifier", "dontComplete", "localCompletionSource", "snippets", "base", "parser", "parser", "parser", "LineComment", "BlockComment", "String$1", "Number", "Bool", "ParenL", "BraceL", "BracketL", "Punctuation", "Identifier", "Type", "isAlpha", "keywords", "types", "defaults", "dialect", "_a", "cur", "doc", "id", "name", "top", "empty", "keyword", "parser", "language", "config", "eof", "Tag", "BracketL", "BraceL", "Context", "findColumn", "indentation", "indent", "off", "newlines", "parser", "parser", "identifier", "String", "Number", "newline", "carriageReturn", "space", "tab", "slash", "semicolon", "spec_identifier", "parser", "snippets", "cache", "ScopeNodes", "cur", "gatherCompletions", "getScope", "doc", "top", "node", "name", "Identifier", "dontComplete", "localCompletionSource", "parser", "kwCompletion", "keywords", "Dot", "count", "spec_idLine truncated
|
||||||
}
|
}
|
||||||
Vendored
+19
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (C) 2011-2026 Hakim El Hattab, http://hakim.se, and reveal.js contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
Reveal.js 6.0.2
|
||||||
|
Source: https://github.com/hakimel/reveal.js
|
||||||
|
Distribution: https://registry.npmjs.org/reveal.js/-/reveal.js-6.0.2.tgz
|
||||||
|
License: MIT (full copyright and permission notice in LICENSE)
|
||||||
|
Package integrity: sha512-JYIg5D9aoxoaLeb84O+OvAwsKWdIavVgEDScxtYEXFCT6t6TQrhNtSgogcjdCpdLsWglhJn3zyE3fUOwiH5KEg==
|
||||||
|
|
||||||
|
Unmodified distribution files, SHA-256:
|
||||||
|
reveal.js aa1bbbf2617b23a623b23612cb3c5bdb63de512e652bf20fcfa832b045d37844
|
||||||
|
reveal.css 615ee850cbbb98a0f688b60ed37b21819a3f54c9f3e6f20e33e63693ab74a0c0
|
||||||
|
LICENSE b2883e4b610bfa1b4d8fff84c4d4b825cc7d553cbd9fec4777c04068a2859dc0
|
||||||
|
|
||||||
|
Only the runtime and base CSS are distributed. No Markdown/highlight/notes
|
||||||
|
plugins, theme fonts, remote imports, or CDN requests are used. PagesWiki's
|
||||||
|
wrapper, sanitizer and theme styles are maintained separately under static/js
|
||||||
|
and static/css. Keep this notice and LICENSE with binary/image distributions.
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
.reveal .stretch,.reveal .r-stretch{max-width:none;max-height:none}.reveal pre.stretch code,.reveal pre.r-stretch code{box-sizing:border-box;height:100%;max-height:100%}.reveal .r-fit-text{white-space:nowrap;display:inline-block}.reveal .r-stack{grid-template-rows:100%;display:grid}.reveal .r-stack>*{grid-area:1/1;margin:auto}.reveal .r-vstack,.reveal .r-hstack{display:flex}.reveal .r-vstack img,.reveal .r-vstack video,.reveal .r-hstack img,.reveal .r-hstack video{object-fit:contain;min-width:0;min-height:0}.reveal .r-vstack{flex-direction:column;justify-content:center;align-items:center}.reveal .r-hstack{flex-direction:row;justify-content:center;align-items:center}.reveal .items-stretch{align-items:stretch}.reveal .items-start{align-items:flex-start}.reveal .items-center{align-items:center}.reveal .items-end{align-items:flex-end}.reveal .justify-between{justify-content:space-between}.reveal .justify-around{justify-content:space-around}.reveal .justify-start{justify-content:flex-start}.reveal .justify-center{justify-content:center}.reveal .justify-end{justify-content:flex-end}html.reveal-full-page{width:100%;height:100vh;height:calc(var(--vh,1vh) * 100);height:100dvh;overflow:hidden}.reveal-viewport{color:#000;--r-controls-spacing:12px;--r-overlay-header-height:40px;--r-overlay-margin:0px;--r-overlay-padding:6px;--r-overlay-gap:5px;background-color:#fff;height:100%;margin:0;line-height:1;position:relative;overflow:hidden}@media screen and (width<=1024px),(height<=768px){.reveal-viewport{--r-overlay-header-height:26px}}.reveal-viewport:fullscreen{width:100%!important;height:100%!important;top:0!important;left:0!important;transform:none!important}.reveal .fragment{transition:all .2s}.reveal .fragment:not(.custom){opacity:0;visibility:hidden;will-change:opacity}.reveal .fragment.visible{opacity:1;visibility:inherit}.reveal .fragment.disabled{transition:none}.reveal .fragment.grow{opacity:1;visibility:inherit}.reveal .fragment.grow.visible{transform:scale(1.3)}.reveal .fragment.shrink{opacity:1;visibility:inherit}.reveal .fragment.shrink.visible{transform:scale(.7)}.reveal .fragment.zoom-in{transform:scale(.1)}.reveal .fragment.zoom-in.visible{transform:none}.reveal .fragment.fade-out{opacity:1;visibility:inherit}.reveal .fragment.fade-out.visible{opacity:0;visibility:hidden}.reveal .fragment.semi-fade-out{opacity:1;visibility:inherit}.reveal .fragment.semi-fade-out.visible{opacity:.5;visibility:inherit}.reveal .fragment.strike{opacity:1;visibility:inherit}.reveal .fragment.strike.visible{text-decoration:line-through}.reveal .fragment.fade-up{transform:translateY(40px)}.reveal .fragment.fade-up.visible{transform:translate(0)}.reveal .fragment.fade-down{transform:translateY(-40px)}.reveal .fragment.fade-down.visible{transform:translate(0)}.reveal .fragment.fade-right{transform:translate(-40px)}.reveal .fragment.fade-right.visible{transform:translate(0)}.reveal .fragment.fade-left{transform:translate(40px)}.reveal .fragment.fade-left.visible{transform:translate(0)}.reveal .fragment.fade-in-then-out,.reveal .fragment.current-visible{opacity:0;visibility:hidden}.reveal .fragment.fade-in-then-out.current-fragment,.reveal .fragment.current-visible.current-fragment{opacity:1;visibility:inherit}.reveal .fragment.fade-in-then-semi-out{opacity:0;visibility:hidden}.reveal .fragment.fade-in-then-semi-out.visible{opacity:.5;visibility:inherit}.reveal .fragment.fade-in-then-semi-out.current-fragment,.reveal .fragment.highlight-red,.reveal .fragment.highlight-current-red,.reveal .fragment.highlight-green,.reveal .fragment.highlight-current-green,.reveal .fragment.highlight-blue,.reveal .fragment.highlight-current-blue{opacity:1;visibility:inherit}.reveal .fragment.highlight-red.visible{color:#ff2c2d}.reveal .fragment.highlight-green.visible{color:#17ff2e}.reveal .fragment.highlight-blue.visible{color:#1b91ff}.reveal .fragment.highlight-current-red.current-fragment{color:#ff2c2d}.reveal .fragment.highlight-current-green.current-fragment{color:#17ff2e}.reveal .fragment.highlight-current-blue.current-fragment{color:#1b91ff}.reveal:after{content:"";font-style:italic}.reveal iframe{z-index:1}.reveal a{position:relative}@keyframes bounce-right{0%,10%,25%,40%,50%{transform:translate(0)}20%{transform:translate(10px)}30%{transform:translate(-5px)}}@keyframes bounce-left{0%,10%,25%,40%,50%{transform:translate(0)}20%{transform:translate(-10px)}30%{transform:translate(5px)}}@keyframes bounce-down{0%,10%,25%,40%,50%{transform:translateY(0)}20%{transform:translateY(10px)}30%{transform:translateY(-5px)}}.reveal .controls{top:auto;bottom:var(--r-controls-spacing);right:var(--r-controls-spacing);z-index:11;color:#000;pointer-events:none;font-size:10px;display:none;position:absolute;left:auto}.reveal .controls button{cursor:pointer;color:currentColor;z-index:2;pointer-events:auto;font-size:inherit;visibility:hidden;opacity:0;-webkit-appearance:none;-webkit-tap-highlight-color:#0000;background-color:#0000;border:0;outline:0;padding:0;transitioLine truncated
|
||||||
Vendored
+40
@@ -0,0 +1,40 @@
|
|||||||
|
/*!
|
||||||
|
* reveal.js
|
||||||
|
* https://revealjs.com
|
||||||
|
* MIT licensed
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011-2026 Hakim El Hattab, https://hakim.se
|
||||||
|
*/
|
||||||
|
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.Reveal=t())})(this,function(){var e=(e,t)=>{for(let n in t)e[n]=t[n];return e},t=(e,t)=>Array.from(e.querySelectorAll(t)),n=(e,t,n)=>{n?e.classList.add(t):e.classList.remove(t)},r=e=>{if(typeof e==`string`){if(e===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},i=(e,t)=>{e.style.transform=t},a=(e,t)=>{let n=e.matches||e.matchesSelector||e.msMatchesSelector;return!!(n&&n.call(e,t))},o=(e,t)=>{if(e&&typeof e.closest==`function`)return e.closest(t);for(;e;){if(a(e,t))return e;e=e.parentElement}return null},s=e=>{e=e||document.documentElement;let t=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t&&t.apply(e)},c=(e,t,n,r=``)=>{let i=e.querySelectorAll(`.`+n);for(let t=0;t<i.length;t++){let n=i[t];if(n.parentNode===e)return n}let a=document.createElement(t);return a.className=n,a.innerHTML=r,e.appendChild(a),a},l=e=>{let t=document.createElement(`style`);return e&&e.length>0&&t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t},u=()=>{let e={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split(`=`).shift(),r=t.split(`=`).pop();return n&&r!==void 0&&(e[n]=r),t});for(let t in e){let n=e[t];e[t]=r(unescape(n))}return e.dependencies!==void 0&&delete e.dependencies,e},d=(e,t=0)=>{if(e){var n;let r,i=e.style.height;return e.style.height=`0px`,e.parentElement&&(e.parentElement.style.height=`auto`),r=t-(((n=e.parentElement)==null?void 0:n.offsetHeight)||0),e.style.height=i+`px`,e.parentElement&&e.parentElement.style.removeProperty(`height`),r}return t},f={mp4:`video/mp4`,m4a:`video/mp4`,ogv:`video/ogg`,mpeg:`video/mpeg`,webm:`video/webm`},p=(e=``)=>{let t=e.split(`.`).pop();return t?f[t]:void 0},m=(e=``)=>encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),h=navigator.userAgent,g=/(iphone|ipod|ipad|android)/gi.test(h)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;/chrome/i.test(h)&&/edge/i.test(h);var _=/android/gi.test(h),v=function(e){if(e){var t=function(e){return[].slice.call(e)},n=0,r=1,i=2,a=3,o=[],s=null,c=`requestAnimationFrame`in e?function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};e.cancelAnimationFrame(s);var n=function(){return u(o.filter((function(e){return e.dirty&&e.active})))};if(t.sync)return n();s=e.requestAnimationFrame(n)}:function(){},l=function(e){return function(t){o.forEach((function(t){return t.dirty=e})),c(t)}},u=function(e){e.filter((function(e){return!e.styleComputed})).forEach((function(e){e.styleComputed=m(e)})),e.filter(h).forEach(g);var t=e.filter(p);t.forEach(f),t.forEach((function(e){g(e),d(e)})),t.forEach(_)},d=function(e){return e.dirty=n},f=function(e){e.availableWidth=e.element.parentNode.clientWidth,e.currentWidth=e.element.scrollWidth,e.previousFontSize=e.currentFontSize,e.currentFontSize=Math.min(Math.max(e.minSize,e.availableWidth/e.currentWidth*e.previousFontSize),e.maxSize),e.whiteSpace=e.multiLine&&e.currentFontSize===e.minSize?`normal`:`nowrap`},p=function(e){return e.dirty!==i||e.dirty===i&&e.element.parentNode.clientWidth!==e.availableWidth},m=function(t){var n=e.getComputedStyle(t.element,null);return t.currentFontSize=parseFloat(n.getPropertyValue(`font-size`)),t.display=n.getPropertyValue(`display`),t.whiteSpace=n.getPropertyValue(`white-space`),!0},h=function(e){var t=!1;return!e.preStyleTestCompleted&&(/inline-/.test(e.display)||(t=!0,e.display=`inline-block`),e.whiteSpace!==`nowrap`&&(t=!0,e.whiteSpace=`nowrap`),e.preStyleTestCompleted=!0,t)},g=function(e){e.element.style.whiteSpace=e.whiteSpace,e.element.style.display=e.display,e.element.style.fontSize=e.currentFontSize+`px`},_=function(e){e.element.dispatchEvent(new CustomEvent(`fit`,{detail:{oldValue:e.previousFontSize,newValue:e.currentFontSize,scaleFactor:e.currentFontSize/e.previousFontSize}}))},v=function(e,t){return function(n){e.dirty=t,e.active&&c(n)}},y=function(e){return function(){o=o.filter((function(t){return t.element!==e.element})),e.observeMutations&&e.observer.disconnect(),e.element.style.whiteSpace=e.originalStyle.whiteSpace,e.element.style.display=e.originalStyle.display,e.element.style.fontSize=e.originalStyle.fontSize}},b=function(e){return function(){e.active||(e.active=!0,c())}},x=function(e){return function(){return e.active=!1}},S=function(e){e.observeMutations&&(e.observer=new MutationObserver(v(e,r)),e.observer.observe(e.element,e.observeMutations))},ee={minSize:16,maxSize:512,multiLine:!0,observeMutations:`MutationObserver`in e&&{subtree:!0,childList:!0,characterData:!0}},C=null,w=function(){e.clearTimeout(C),C=e.setTimeout(l(i),E.observeWindowDelay)},te=[`resize`,`orientationchange`];return Object.defineProperty(ELine truncated
|
||||||
|
<span class="slide-number-a">${e}</span>
|
||||||
|
<span class="slide-number-delimiter">${t}</span>
|
||||||
|
<span class="slide-number-b">${n}</span>
|
||||||
|
</a>`:`<a href="${r}">
|
||||||
|
<span class="slide-number-a">${e}</span>
|
||||||
|
</a>`}destroy(){this.element.remove()}},re=class{constructor(e){this.Reveal=e,this.onInput=this.onInput.bind(this),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this)}render(){this.element=document.createElement(`div`),this.element.className=`jump-to-slide`,this.jumpInput=document.createElement(`input`),this.jumpInput.type=`text`,this.jumpInput.className=`jump-to-slide-input`,this.jumpInput.placeholder=`Jump to slide`,this.jumpInput.addEventListener(`input`,this.onInput),this.jumpInput.addEventListener(`keydown`,this.onKeyDown),this.jumpInput.addEventListener(`blur`,this.onBlur),this.element.appendChild(this.jumpInput)}show(){this.indicesOnShow=this.Reveal.getIndices(),this.Reveal.getRevealElement().appendChild(this.element),this.jumpInput.focus()}hide(){this.isVisible()&&(this.element.remove(),this.jumpInput.value=``,clearTimeout(this.jumpTimeout),delete this.jumpTimeout)}isVisible(){return!!this.element.parentNode}jump(){clearTimeout(this.jumpTimeout),delete this.jumpTimeout;let e=this.jumpInput.value.trim(``),t;if(/^\d+$/.test(e)){let n=this.Reveal.getConfig().slideNumber;if(n===`c`||n===`c/t`){let n=this.Reveal.getSlides()[parseInt(e,10)-1];n&&(t=this.Reveal.getIndices(n))}}return t||(/^\d+\.\d+$/.test(e)&&(e=e.replace(`.`,`/`)),t=this.Reveal.location.getIndicesFromHash(e,{oneBasedIndex:!0})),!t&&/\S+/i.test(e)&&e.length>1&&(t=this.search(e)),t&&e!==``?(this.Reveal.slide(t.h,t.v,t.f),!0):(this.Reveal.slide(this.indicesOnShow.h,this.indicesOnShow.v,this.indicesOnShow.f),!1)}jumpAfter(e){clearTimeout(this.jumpTimeout),this.jumpTimeout=setTimeout(()=>this.jump(),e)}search(e){let t=RegExp(`\\b`+e.trim()+`\\b`,`i`),n=this.Reveal.getSlides().find(e=>t.test(e.innerText));return n?this.Reveal.getIndices(n):null}cancel(){this.Reveal.slide(this.indicesOnShow.h,this.indicesOnShow.v,this.indicesOnShow.f),this.hide()}confirm(){this.jump(),this.hide()}destroy(){this.jumpInput.removeEventListener(`input`,this.onInput),this.jumpInput.removeEventListener(`keydown`,this.onKeyDown),this.jumpInput.removeEventListener(`blur`,this.onBlur),this.element.remove()}onKeyDown(e){e.keyCode===13?this.confirm():e.keyCode===27&&(this.cancel(),e.stopImmediatePropagation())}onInput(e){this.jumpAfter(200)}onBlur(){setTimeout(()=>this.hide(),1)}},D=e=>{let t=e.match(/^#([0-9a-f]{3})$/i);if(t&&t[1]){let e=t[1];return{r:parseInt(e.charAt(0),16)*17,g:parseInt(e.charAt(1),16)*17,b:parseInt(e.charAt(2),16)*17}}let n=e.match(/^#([0-9a-f]{6})$/i);if(n&&n[1]){let e=n[1];return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}}let r=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(r)return{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10)};let i=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d]+|[\d]*.[\d]+)\s*\)$/i);return i?{r:parseInt(i[1],10),g:parseInt(i[2],10),b:parseInt(i[3],10),a:parseFloat(i[4])}:null},ie=e=>(typeof e==`string`&&(e=D(e)),e?(e.r*299+e.g*587+e.b*114)/1e3:null),ae=class{constructor(e){this.Reveal=e}render(){this.element=document.createElement(`div`),this.element.className=`backgrounds`,this.Reveal.getRevealElement().appendChild(this.element)}create(){this.element.innerHTML=``,this.element.classList.add(`no-transition`),this.Reveal.getHorizontalSlides().forEach(e=>{let n=this.createBackground(e,this.element);t(e,`section`).forEach(e=>{this.createBackground(e,n),n.classList.add(`stack`)})}),this.Reveal.getConfig().parallaxBackgroundImage?(this.element.style.backgroundImage=`url("`+this.Reveal.getConfig().parallaxBackgroundImage+`")`,this.element.style.backgroundSize=this.Reveal.getConfig().parallaxBackgroundSize,this.element.style.backgroundRepeat=this.Reveal.getConfig().parallaxBackgroundRepeat,this.element.style.backgroundPosition=this.Reveal.getConfig().parallaxBackgroundPosition,setTimeout(()=>{this.Reveal.getRevealElement().classList.add(`has-parallax-background`)},1)):(this.element.style.backgroundImage=``,this.Reveal.getRevealElement().classList.remove(`has-parallax-background`))}createBackground(e,t){let n=document.createElement(`div`);n.className=`slide-background `+e.className.replace(/present|past|future/,``);let r=document.createElement(`div`);return r.className=`slide-background-content`,n.appendChild(r),t.appendChild(n),e.slideBackgroundElement=n,e.slideBackgroundContentElement=r,this.sync(e),n}sync(e){let t=e.slideBackgroundElement,n=e.slideBackgroundContentElement,r={background:e.getAttribute(`data-background`),backgroundSize:e.getAttribute(`data-background-size`),backgroundImage:e.getAttribute(`data-background-image`),backgroundVideo:e.getAttribute(`data-background-video`),backgroundIframe:e.getAttribute(`data-background-iframe`),backgroundColor:e.getAttribute(`data-background-color`),backgroundGradient:e.getAttribute(`data-background-gradient`),backgroundRepeat:e.getAttribute(`data-background-repeat`),backgroundPosition:e.getAttribute(`data-background-position`),backgroundTransition:e.getAttribute(`data-back
Line truncated
|
||||||
|
<button class="navigate-right" aria-label="${e?`previous slide`:`next slide`}"><div class="controls-arrow"></div></button>
|
||||||
|
<button class="navigate-up" aria-label="above slide"><div class="controls-arrow"></div></button>
|
||||||
|
<button class="navigate-down" aria-label="below slide"><div class="controls-arrow"></div></button>`,this.Reveal.getRevealElement().appendChild(this.element),this.controlsLeft=t(n,`.navigate-left`),this.controlsRight=t(n,`.navigate-right`),this.controlsUp=t(n,`.navigate-up`),this.controlsDown=t(n,`.navigate-down`),this.controlsPrev=t(n,`.navigate-prev`),this.controlsNext=t(n,`.navigate-next`),this.controlsFullscreen=t(n,`.enter-fullscreen`),this.controlsRightArrow=this.element.querySelector(`.navigate-right`),this.controlsLeftArrow=this.element.querySelector(`.navigate-left`),this.controlsDownArrow=this.element.querySelector(`.navigate-down`)}configure(e,t){let n=e.controls===`speaker`||e.controls===`speaker-only`;this.element.style.display=e.controls&&(!n||this.Reveal.isSpeakerNotes())?`block`:`none`,this.element.setAttribute(`data-controls-layout`,e.controlsLayout),this.element.setAttribute(`data-controls-back-arrows`,e.controlsBackArrows)}bind(){let e=[`touchstart`,`click`];_&&(e=[`touchend`]),e.forEach(e=>{this.controlsLeft.forEach(t=>t.addEventListener(e,this.onNavigateLeftClicked,!1)),this.controlsRight.forEach(t=>t.addEventListener(e,this.onNavigateRightClicked,!1)),this.controlsUp.forEach(t=>t.addEventListener(e,this.onNavigateUpClicked,!1)),this.controlsDown.forEach(t=>t.addEventListener(e,this.onNavigateDownClicked,!1)),this.controlsPrev.forEach(t=>t.addEventListener(e,this.onNavigatePrevClicked,!1)),this.controlsNext.forEach(t=>t.addEventListener(e,this.onNavigateNextClicked,!1)),this.controlsFullscreen.forEach(t=>t.addEventListener(e,this.onEnterFullscreen,!1))})}unbind(){[`touchstart`,`touchend`,`click`].forEach(e=>{this.controlsLeft.forEach(t=>t.removeEventListener(e,this.onNavigateLeftClicked,!1)),this.controlsRight.forEach(t=>t.removeEventListener(e,this.onNavigateRightClicked,!1)),this.controlsUp.forEach(t=>t.removeEventListener(e,this.onNavigateUpClicked,!1)),this.controlsDown.forEach(t=>t.removeEventListener(e,this.onNavigateDownClicked,!1)),this.controlsPrev.forEach(t=>t.removeEventListener(e,this.onNavigatePrevClicked,!1)),this.controlsNext.forEach(t=>t.removeEventListener(e,this.onNavigateNextClicked,!1)),this.controlsFullscreen.forEach(t=>t.removeEventListener(e,this.onEnterFullscreen,!1))})}update(){let e=this.Reveal.availableRoutes();[...this.controlsLeft,...this.controlsRight,...this.controlsUp,...this.controlsDown,...this.controlsPrev,...this.controlsNext].forEach(e=>{e.classList.remove(`enabled`,`fragmented`),e.setAttribute(`disabled`,`disabled`)}),e.left&&this.controlsLeft.forEach(e=>{e.classList.add(`enabled`),e.removeAttribute(`disabled`)}),e.right&&this.controlsRight.forEach(e=>{e.classList.add(`enabled`),e.removeAttribute(`disabled`)}),e.up&&this.controlsUp.forEach(e=>{e.classList.add(`enabled`),e.removeAttribute(`disabled`)}),e.down&&this.controlsDown.forEach(e=>{e.classList.add(`enabled`),e.removeAttribute(`disabled`)}),(e.left||e.up)&&this.controlsPrev.forEach(e=>{e.classList.add(`enabled`),e.removeAttribute(`disabled`)}),(e.right||e.down)&&this.controlsNext.forEach(e=>{e.classList.add(`enabled`),e.removeAttribute(`disabled`)});let t=this.Reveal.getCurrentSlide();if(t){let e=this.Reveal.fragments.availableRoutes();e.prev&&this.controlsPrev.forEach(e=>{e.classList.add(`fragmented`,`enabled`),e.removeAttribute(`disabled`)}),e.next&&this.controlsNext.forEach(e=>{e.classList.add(`fragmented`,`enabled`),e.removeAttribute(`disabled`)});let n=this.Reveal.isVerticalSlide(t),r=n&&t.parentElement&&t.parentElement.querySelectorAll(`:scope > section`).length>1;n&&r?(e.prev&&this.controlsUp.forEach(e=>{e.classList.add(`fragmented`,`enabled`),e.removeAttribute(`disabled`)}),e.next&&this.controlsDown.forEach(e=>{e.classList.add(`fragmented`,`enabled`),e.removeAttribute(`disabled`)})):(e.prev&&this.controlsLeft.forEach(e=>{e.classList.add(`fragmented`,`enabled`),e.removeAttribute(`disabled`)}),e.next&&this.controlsRight.forEach(e=>{e.classList.add(`fragmented`,`enabled`),e.removeAttribute(`disabled`)}))}if(this.Reveal.getConfig().controlsTutorial){let t=this.Reveal.getIndices();!this.Reveal.hasNavigatedVertically()&&e.down?this.controlsDownArrow.classList.add(`highlight`):(this.controlsDownArrow.classList.remove(`highlight`),this.Reveal.getConfig().rtl?!this.Reveal.hasNavigatedHorizontally()&&e.left&&t.v===0?this.controlsLeftArrow.classList.add(`highlight`):this.controlsLeftArrow.classList.remove(`highlight`):!this.Reveal.hasNavigatedHorizontally()&&e.right&&t.v===0?this.controlsRightArrow.classList.add(`highlight`):this.controlsRightArrow.classList.remove(`highlight`))}}destroy(){this.unbind(),this.element.remove()}onNavigateLeftClicked(e){e.preventDefault(),this.Reveal.onUserInput(),this.Reveal.getConfig().navigationMode===`linear`?this.Reveal.prev():this.Reveal.left()}onNavigateRightClicked(e){e.preventDefault(),this.Reveal.onUserInput(),this.Reveal.getConfig().navigationMode===`linear`?this.Reveal.next():this.Reveal.right()}onNavigateUpClicked(e){e.preventDefault(),this.Reveal.onULine truncated
|
||||||
|
`+e))});let r=document.querySelector(`head`);r&&r.insertBefore(n,r.lastChild)},ye=class{constructor(e){this.Reveal=e,this.state=`idle`,this.registeredPlugins={},this.asyncDependencies=[]}load(e,t){return this.state=`loading`,e.forEach(this.registerPlugin.bind(this)),new Promise(e=>{let n=[],r=0;if(t.forEach(e=>{(!e.condition||e.condition())&&(e.async?this.asyncDependencies.push(e):n.push(e))}),n.length){r=n.length;let t=t=>{t&&typeof t.callback==`function`&&t.callback(),--r===0&&this.initPlugins().then(e)};n.forEach(e=>{typeof e.id==`string`?(this.registerPlugin(e),t(e)):typeof e.src==`string`?ve(e.src,()=>t(e)):(console.warn(`Unrecognized plugin format`,e),t())})}else this.initPlugins().then(e)})}initPlugins(){return new Promise(e=>{let t=Object.values(this.registeredPlugins),n=t.length;if(n===0)this.loadAsync().then(e);else{let r,i=()=>{--n===0?this.loadAsync().then(e):r()},a=0;r=()=>{let e=t[a++];if(typeof e.init==`function`){let t=e.init(this.Reveal);t&&typeof t.then==`function`?t.then(i):i()}else i()},r()}})}loadAsync(){return this.state=`loaded`,this.asyncDependencies.length&&this.asyncDependencies.forEach(e=>{ve(e.src,e.callback)}),Promise.resolve()}registerPlugin(e){arguments.length===2&&typeof arguments[0]==`string`?(e=arguments[1],e.id=arguments[0]):typeof e==`function`&&(e=e());let t=e.id;typeof t==`string`?this.registeredPlugins[t]===void 0?(this.registeredPlugins[t]=e,this.state===`loaded`&&typeof e.init==`function`&&e.init(this.Reveal)):console.warn(`reveal.js: "`+t+`" plugin has already been registered`):console.warn(`Unrecognized plugin format; can't find plugin.id`,e)}hasPlugin(e){return!!this.registeredPlugins[e]}getPlugin(e){return this.registeredPlugins[e]}getRegisteredPlugins(){return this.registeredPlugins}destroy(){Object.values(this.registeredPlugins).forEach(e=>{typeof e.destroy==`function`&&e.destroy()}),this.registeredPlugins={},this.asyncDependencies=[]}},be=class{constructor(e){this.Reveal=e,this.onSlidesClicked=this.onSlidesClicked.bind(this),this.iframeTriggerSelector=null,this.mediaTriggerSelector=`[data-preview-image], [data-preview-video]`,this.stateProps=[`previewIframe`,`previewImage`,`previewVideo`,`previewFit`],this.state={}}update(){this.iframeTriggerSelector=this.Reveal.getConfig().previewLinks?`a[href]:not([data-preview-link=false]), [data-preview-link]:not(a):not([data-preview-link=false])`:`[data-preview-link]:not([data-preview-link=false])`;let e=this.Reveal.getSlidesElement().querySelectorAll(this.iframeTriggerSelector).length>0,t=this.Reveal.getSlidesElement().querySelectorAll(this.mediaTriggerSelector).length>0;e||t?this.Reveal.getSlidesElement().addEventListener(`click`,this.onSlidesClicked,!1):this.Reveal.getSlidesElement().removeEventListener(`click`,this.onSlidesClicked,!1)}createOverlay(e){this.dom=document.createElement(`div`),this.dom.classList.add(`r-overlay`),this.dom.classList.add(e),this.viewport=document.createElement(`div`),this.viewport.classList.add(`r-overlay-viewport`),this.dom.appendChild(this.viewport),this.Reveal.getRevealElement().appendChild(this.dom)}previewIframe(e){if(typeof e!=`string`)return;let t;try{t=new URL(e,document.baseURI)}catch(e){return}if(t.protocol===`file:`&&window.location.protocol!==`file:`||![`http:`,`https:`,`file:`].includes(t.protocol)&&t.href!==`about:blank`)return;this.close(),this.state={previewIframe:e},this.createOverlay(`r-overlay-preview`),this.dom.dataset.state=`loading`,this.viewport.innerHTML=`<header class="r-overlay-header">
|
||||||
|
<a class="r-overlay-header-button r-overlay-external" target="_blank" rel="noopener"><span class="icon"></span></a>
|
||||||
|
<button class="r-overlay-header-button r-overlay-close"><span class="icon"></span></button>
|
||||||
|
</header>
|
||||||
|
<div class="r-overlay-spinner"></div>
|
||||||
|
<div class="r-overlay-content">
|
||||||
|
<iframe></iframe>
|
||||||
|
<small class="r-overlay-content-inner">
|
||||||
|
<span class="r-overlay-error x-frame-error">Unable to load iframe. This is likely due to the site's policy (x-frame-options).</span>
|
||||||
|
</small>
|
||||||
|
</div>`;let n=this.dom.querySelector(`iframe`);n.addEventListener(`load`,e=>{this.dom.dataset.state=`loaded`},!1),n.src=t.href,this.dom.querySelector(`.r-overlay-external`).href=t.href,this.dom.querySelector(`.r-overlay-close`).addEventListener(`click`,e=>{this.close(),e.preventDefault()},!1),this.dom.querySelector(`.r-overlay-external`).addEventListener(`click`,e=>{this.close()},!1),this.Reveal.dispatchEvent({type:`previewiframe`,data:{url:e}})}previewMedia(e,t,n){if(t!==`image`&&t!==`video`){console.warn(`Please specify a valid media type to preview (image|video)`);return}this.close(),n=n||`scale-down`,this.createOverlay(`r-overlay-preview`),this.dom.dataset.state=`loading`,this.dom.dataset.previewFit=n,this.viewport.innerHTML=`<header class="r-overlay-header">
|
||||||
|
<button class="r-overlay-header-button r-overlay-close">Esc <span class="icon"></span></button>
|
||||||
|
</header>
|
||||||
|
<div class="r-overlay-spinner"></div>
|
||||||
|
<div class="r-overlay-content"></div>`;let r=this.dom.querySelector(`.r-overlay-content`);if(t===`image`){this.state={previewImage:e,previewFit:n};let t=document.createElement(`img`,{});t.src=e,r.appendChild(t),t.addEventListener(`load`,()=>{this.dom.dataset.state=`loaded`},!1),t.addEventListener(`error`,()=>{this.dom.dataset.state=`error`,r.innerHTML=`<span class="r-overlay-error">Unable to load image.</span>`},!1),this.dom.style.cursor=`zoom-out`,this.dom.addEventListener(`click`,e=>{this.close()},!1),this.Reveal.dispatchEvent({type:`previewimage`,data:{url:e}})}else if(t===`video`){this.state={previewVideo:e,previewFit:n};let t=document.createElement(`video`);t.autoplay=this.dom.dataset.previewAutoplay!==`false`,t.controls=this.dom.dataset.previewControls!==`false`,t.loop=this.dom.dataset.previewLoop===`true`,t.muted=this.dom.dataset.previewMuted===`true`,t.playsInline=!0,t.src=e,r.appendChild(t),t.addEventListener(`loadeddata`,()=>{this.dom.dataset.state=`loaded`},!1),t.addEventListener(`error`,()=>{this.dom.dataset.state=`error`,r.innerHTML=`<span class="r-overlay-error">Unable to load video.</span>`},!1),this.Reveal.dispatchEvent({type:`previewvideo`,data:{url:e}})}else throw Error(`Please specify a valid media type to preview`);this.dom.querySelector(`.r-overlay-close`).addEventListener(`click`,e=>{this.close(),e.preventDefault()},!1)}previewImage(e,t){this.previewMedia(e,`image`,t)}previewVideo(e,t){this.previewMedia(e,`video`,t)}toggleHelp(e){typeof e==`boolean`?e?this.showHelp():this.close():this.dom?this.close():this.showHelp()}showHelp(){if(this.Reveal.getConfig().help){this.close(),this.createOverlay(`r-overlay-help`);let e=`<p class="title">Keyboard Shortcuts</p>`,t=this.Reveal.keyboard.getShortcuts(),n=this.Reveal.keyboard.getBindings();e+=`<table><th>KEY</th><th>ACTION</th>`;for(let n in t)e+=`<tr><td>${n}</td><td>${t[n]}</td></tr>`;for(let t in n)n[t].key&&n[t].description&&(e+=`<tr><td>${n[t].key}</td><td>${n[t].description}</td></tr>`);e+=`</table>`,this.viewport.innerHTML=`
|
||||||
|
<header class="r-overlay-header">
|
||||||
|
<button class="r-overlay-header-button r-overlay-close">Esc <span class="icon"></span></button>
|
||||||
|
</header>
|
||||||
|
<div class="r-overlay-content">
|
||||||
|
<div class="r-overlay-help-content">${e}</div>
|
||||||
|
</div>
|
||||||
|
`,this.dom.querySelector(`.r-overlay-close`).addEventListener(`click`,e=>{this.close(),e.preventDefault()},!1),this.Reveal.dispatchEvent({type:`showhelp`})}}isOpen(){return!!this.dom}close(){return this.dom?(this.dom.remove(),this.dom=null,this.state={},this.Reveal.dispatchEvent({type:`closeoverlay`}),!0):!1}getState(){return this.state}setState(e){this.stateProps.every(t=>this.state[t]===e[t])||(e.previewIframe?this.previewIframe(e.previewIframe):e.previewImage?this.previewImage(e.previewImage,e.previewFit):e.previewVideo?this.previewVideo(e.previewVideo,e.previewFit):this.close())}onSlidesClicked(e){let t=e.target,n=t.closest(this.iframeTriggerSelector),r=t.closest(this.mediaTriggerSelector);if(n){if(e.metaKey||e.shiftKey||e.altKey)return;let t=n.getAttribute(`data-preview-link`),r=typeof t==`string`&&t.startsWith(`http`)?t:n.getAttribute(`href`);r&&(this.previewIframe(r),e.preventDefault())}else if(r){if(r.hasAttribute(`data-preview-image`)){let t=r.dataset.previewImage||r.getAttribute(`src`);t&&(this.previewImage(t,r.dataset.previewFit),e.preventDefault())}else if(r.hasAttribute(`data-preview-video`)){let t=r.dataset.previewVideo||r.getAttribute(`src`);if(!t){let e=r.querySelector(`source`);e&&(t=e.getAttribute(`src`))}t&&(this.previewVideo(t,r.dataset.previewFit),e.preventDefault())}}}destroy(){this.close()}},F=40,I=1.03,xe=class{constructor(e){this.Reveal=e,this.touchStartX=0,this.touchStartY=0,this.touchStartCount=0,this.touchCaptured=!1,this.activePointers=new Map,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerCancel=this.onPointerCancel.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this)}bind(){let e=this.Reveal.getRevealElement();`onpointerdown`in window?(e.addEventListener(`pointerdown`,this.onPointerDown,!1),e.addEventListener(`pointermove`,this.onPointerMove,!1),e.addEventListener(`pointerup`,this.onPointerUp,!1),e.addEventListener(`pointercancel`,this.onPointerCancel,!1)):(e.addEventListener(`touchstart`,this.onTouchStart,!1),e.addEventListener(`touchmove`,this.onTouchMove,!1),e.addEventListener(`touchend`,this.onTouchEnd,!1))}unbind(){let e=this.Reveal.getRevealElement();e.removeEventListener(`pointerdown`,this.onPointerDown,!1),e.removeEventListener(`pointermove`,this.onPointerMove,!1),e.removeEventListener(`pointerup`,this.onPointerUp,!1),e.removeEventListener(`pointercancel`,this.onPointerCancel,!1),e.removeEventListener(`touchstart`,this.onTouchStart,!1),e.removeEventListener(`touchmove`,this.onTouchMove,!1),e.removeEventListener(`touchend`,this.onTouchEnd,!1)}isSwipePrevented(e){if(a(e,`video[controls], audio[controls]`))return!0;for(;e&&typeof e.hasAttribute==`function`;){if(e.hasAttribute(`data-prevent-swipe`))return!0;e=e.parentNode}return!1}isViewportZoomed(){if(!window.visualViewport||typeof window.visualViewport.scale!=`number`)return!1;let e=window.visualViewport.scale;return this.visualViewportBaseScale=this.visualViewportBaseScale===void 0?e:Math.min(this.visualViewportBaseScale,e),e/this.visualViewportBaseScale>I}onTouchStart(e){if(this.touchCaptured=!1,this.isSwipePrevented(e.target))return!0;this.touchStartX=e.touches[0].clientX,this.touchStartY=e.touches[0].clientY,this.touchStartCount=e.touches.length}onTouchMove(e){if(this.isSwipePrevented(e.target))return!0;let t=this.Reveal.getConfig();if(this.touchCaptured)_&&e.preventDefault();else{this.Reveal.onUserInput(e);let n=e.touches[0].clientX,r=e.touches[0].clientY;if(e.touches.length===1&&this.touchStartCount!==2){let i=this.Reveal.availableRoutes({includeFragments:!0}),a=n-this.touchStartX,o=r-this.touchStartY;a>F&&Math.abs(a)>Math.abs(o)?(this.touchCaptured=!0,t.navigationMode===`linear`?t.rtl?this.Reveal.next():this.Reveal.prev():this.Reveal.left()):a<-40&&Math.abs(a)>Math.abs(o)?(this.touchCaptured=!0,t.navigationMode===`linear`?t.rtl?this.Reveal.prev():this.Reveal.next():this.Reveal.right()):o>F&&i.up?(this.touchCaptured=!0,t.navigationMode===`linear`?this.Reveal.prev():this.Reveal.up()):o<-40&&i.down&&(this.touchCaptured=!0,t.navigationMode===`linear`?this.Reveal.next():this.Reveal.down()),t.embedded?(this.touchCaptured||this.Reveal.isVerticalSlide())&&e.preventDefault():e.preventDefault()}}}onTouchEnd(e){this.touchCaptured&&!this.Reveal.slideContent.isAllowedToPlayAudio()&&this.Reveal.startEmbeddedContent(this.Reveal.getCurrentSlide()),this.touchCaptured=!1}getActiveTouches(){return Array.from(this.activePointers.values(),e=>({clientX:e.clientX,clientY:e.clientY}))}onPointerDown(e){e.pointerType===`touch`&&(this.activePointers.set(e.pointerId,e),e.touches=this.getActiveTouches(),this.onTouchStart(e))}onPointerMove(e){e.pointerType===`touch`&&(this.activePointers.set(e.pointerId,e),e.touches=this.getActiveTouches(),this.onTouchMove(e))}onPointerUp(e){e.pointerType===`touch`&&(this.activePointers.delete(e.pointerId),
Line truncated
|
||||||
|
`):null}destroy(){this.element.remove()}},we=class{constructor(e,t){this.diameter=100,this.diameter2=this.diameter/2,this.thickness=6,this.playing=!1,this.progress=0,this.progressOffset=1,this.container=e,this.progressCheck=t,this.canvas=document.createElement(`canvas`),this.canvas.className=`playback`,this.canvas.width=this.diameter,this.canvas.height=this.diameter,this.canvas.style.width=this.diameter2+`px`,this.canvas.style.height=this.diameter2+`px`,this.context=this.canvas.getContext(`2d`),this.container.appendChild(this.canvas),this.render()}setPlaying(e){let t=this.playing;this.playing=e,!t&&this.playing?this.animate():this.render()}animate(){let e=this.progress;this.progress=this.progressCheck(),e>.8&&this.progress<.2&&(this.progressOffset=this.progress),this.render(),this.playing&&requestAnimationFrame(this.animate.bind(this))}render(){let e=this.playing?this.progress:0,t=this.diameter2-this.thickness,n=this.diameter2,r=this.diameter2;this.progressOffset+=(1-this.progressOffset)*.1;let i=-Math.PI/2+Math.PI*2*e,a=-Math.PI/2+this.progressOffset*(Math.PI*2);this.context.save(),this.context.clearRect(0,0,this.diameter,this.diameter),this.context.beginPath(),this.context.arc(n,r,t+4,0,Math.PI*2,!1),this.context.fillStyle=`rgba( 0, 0, 0, 0.4 )`,this.context.fill(),this.context.beginPath(),this.context.arc(n,r,t,0,Math.PI*2,!1),this.context.lineWidth=this.thickness,this.context.strokeStyle=`rgba( 255, 255, 255, 0.2 )`,this.context.stroke(),this.playing&&(this.context.beginPath(),this.context.arc(n,r,t,a,i,!1),this.context.lineWidth=this.thickness,this.context.strokeStyle=`#fff`,this.context.stroke()),this.context.translate(n-14,r-14),this.playing?(this.context.fillStyle=`#fff`,this.context.fillRect(0,0,10,28),this.context.fillRect(18,0,10,28)):(this.context.beginPath(),this.context.translate(4,0),this.context.moveTo(0,0),this.context.lineTo(24,14),this.context.lineTo(0,28),this.context.fillStyle=`#fff`,this.context.fill()),this.context.restore()}on(e,t){this.canvas.addEventListener(e,t,!1)}off(e,t){this.canvas.removeEventListener(e,t,!1)}destroy(){this.playing=!1,this.canvas.parentNode&&this.container.removeChild(this.canvas)}},Te={width:960,height:700,margin:.04,minScale:.2,maxScale:2,controls:!0,controlsTutorial:!0,controlsLayout:`bottom-right`,controlsBackArrows:`faded`,progress:!0,slideNumber:!1,showSlideNumber:`all`,hashOneBasedIndex:!1,hash:!1,respondToHashChanges:!0,jumpToSlide:!0,history:!1,keyboard:!0,keyboardCondition:null,disableLayout:!1,overview:!0,center:!0,touch:!0,loop:!1,rtl:!1,navigationMode:`default`,shuffle:!1,fragments:!0,fragmentInURL:!0,embedded:!1,help:!0,pause:!0,showNotes:!1,showHiddenSlides:!1,autoPlayMedia:null,preloadIframes:null,mouseWheel:!1,previewLinks:!1,viewDistance:3,mobileViewDistance:2,display:`block`,hideInactiveCursor:!0,hideCursorTime:5e3,sortFragmentsOnSync:!0,autoAnimate:!0,autoAnimateMatcher:null,autoAnimateEasing:`ease`,autoAnimateDuration:1,autoAnimateUnmatched:!0,autoAnimateStyles:[`opacity`,`color`,`background-color`,`padding`,`font-size`,`line-height`,`letter-spacing`,`border-width`,`border-color`,`border-radius`,`outline`,`outline-offset`],autoSlide:0,autoSlideStoppable:!0,autoSlideMethod:null,defaultTiming:null,postMessage:!0,postMessageEvents:!1,focusBodyOnPageVisibilityChange:!0,transition:`slide`,transitionSpeed:`default`,backgroundTransition:`fade`,parallaxBackgroundImage:``,parallaxBackgroundSize:``,parallaxBackgroundRepeat:``,parallaxBackgroundPosition:``,parallaxBackgroundHorizontal:null,parallaxBackgroundVertical:null,view:null,scrollLayout:`full`,scrollSnap:`mandatory`,scrollProgress:`auto`,scrollActivationWidth:435,pdfMaxPagesPerSlide:1/0,pdfSeparateFragments:!0,pdfPageHeightOffset:-1,dependencies:[],plugins:[]},Ee=`6.0.2`;function z(a,s){arguments.length<2&&(s=arguments[0],a=document.querySelector(`.reveal`));let l={},f={},p=!1,m=!1,h,_,v,y,b={hasNavigatedHorizontally:!1,hasNavigatedVertically:!1},x=[],S=1,T={layout:``,overview:``},D={},ie=`idle`,O=0,k,se=0,ce=-1,A=!1,j=new ee(l),M=new ne(l),N=new re(l),ve=new oe(l),F=new ae(l),I=new le(l),L=new ue(l),R=new de(l),z=new fe(l),B=new pe(l),V=new me(l),H=new he(l),U=new ge(l),De=new _e(l),W=new ye(l),G=new be(l),K=new Se(l),Oe=new xe(l),q=new Ce(l);function ke(e){if(!a)throw`Unable to find presentation root (<div class="reveal">).`;if(p)throw`Reveal.js has already been initialized.`;if(p=!0,D.wrapper=a,D.slides=a.querySelector(`.slides`),!D.slides)throw`Unable to find slides container (<div class="slides">).`;return f=P(P(P(P(P({},Te),f),s),e),u()),/print-pdf/gi.test(window.location.search)&&(f.view=`print`),Ae(),window.addEventListener(`load`,Y,!1),W.load(f.plugins,f.dependencies).then(je),new Promise(e=>l.on(`ready`,e))}function Ae(){f.embedded===!0?D.viewport=o(a,`.reveal-viewport`)||a:(D.viewport=document.body,document.documentElement.classList.add(`reveal-full-page`)),D.viewport.classList.add(`reveal-viewport`)}function je(){p!==!1&&(m=!0,Ne(),Pe(),Ve(),ze(),Be(),vt(),He(),F.update(!0),Me(),V
Line truncated
|
||||||
@@ -22,13 +22,15 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="/static/css/theme/base.css">
|
<link rel="stylesheet" href="/static/css/theme/base.css">
|
||||||
<link rel="stylesheet" href="/static/css/content-viewer.css">
|
<link rel="stylesheet" href="/static/css/content-viewer.css">
|
||||||
|
{{ if .CSVEditor }}<link rel="stylesheet" href="/static/css/csv-editor.css?v=1">{{ end }}
|
||||||
|
{{ if .SlidesEnabled }}<link rel="stylesheet" href="/static/css/slides.css?v=1"><script defer src="/static/js/slides.js?v=1"></script>{{ end }}
|
||||||
<link rel="stylesheet" href="{{ .ThemeCSS }}">
|
<link rel="stylesheet" href="{{ .ThemeCSS }}">
|
||||||
<script defer src="/static/js/content-viewer.js?v=macro-projection-1"></script>
|
<script defer src="/static/js/content-viewer.js?v=macro-projection-1"></script>
|
||||||
|
|
||||||
|
|
||||||
<script
|
<script
|
||||||
type="module"
|
type="module"
|
||||||
src="/static/vendor/codemirror/editor.bundle.js?v=command-ux-1"
|
src="/static/vendor/codemirror/editor.bundle.js?v=csv-edit-1"
|
||||||
></script>
|
></script>
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +41,7 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="mode-editor">
|
<body class="mode-editor{{ if .CSVEditor }} csv-editor{{ end }}">
|
||||||
|
|
||||||
<header class="topbar">
|
<header class="topbar">
|
||||||
|
|
||||||
@@ -129,6 +131,7 @@
|
|||||||
<div class="editor-head-right">
|
<div class="editor-head-right">
|
||||||
|
|
||||||
{{ if and (ne .EditType "code") (ne .EditType "plain") }}
|
{{ if and (ne .EditType "code") (ne .EditType "plain") }}
|
||||||
|
{{ if .SlidesEnabled }}<button type="button" class="editor-action-icon" data-editor-action="slides" aria-pressed="false" title="{{ T "slides.preview" }}" aria-label="{{ T "slides.preview" }}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 4h18v12H3zM12 16v5m-5 0 5-5 5 5M8 8h8m-8 4h5"/></svg></button>{{ end }}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="editor-format-icon {{ if eq .EditType "html" }}active{{ end }}"
|
class="editor-format-icon {{ if eq .EditType "html" }}active{{ end }}"
|
||||||
@@ -165,8 +168,8 @@
|
|||||||
aria-pressed="true"
|
aria-pressed="true"
|
||||||
aria-label="{{ T "editor.hide_preview" }}"
|
aria-label="{{ T "editor.hide_preview" }}"
|
||||||
title="{{ T "editor.hide_preview" }}"
|
title="{{ T "editor.hide_preview" }}"
|
||||||
data-hide-label="{{ T "editor.hide_preview" }}"
|
data-hide-label="{{ if .CSVEditor }}{{ T "editor.csv_source" }}{{ else }}{{ T "editor.hide_preview" }}{{ end }}"
|
||||||
data-show-label="{{ T "editor.show_preview" }}"
|
data-show-label="{{ if .CSVEditor }}{{ T "editor.csv_table" }}{{ else }}{{ T "editor.show_preview" }}{{ end }}"
|
||||||
>
|
>
|
||||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<rect x="3" y="4" width="18" height="16" rx="2"/>
|
<rect x="3" y="4" width="18" height="16" rx="2"/>
|
||||||
@@ -204,6 +207,7 @@
|
|||||||
data-base-revision="{{ .BaseRevision }}"
|
data-base-revision="{{ .BaseRevision }}"
|
||||||
data-domain="{{ .Context.Domain.UUID }}"
|
data-domain="{{ .Context.Domain.UUID }}"
|
||||||
data-owner="{{ if .AuthUser }}{{ .AuthUser.UUID }}{{ end }}"
|
data-owner="{{ if .AuthUser }}{{ .AuthUser.UUID }}{{ end }}"
|
||||||
|
data-csv="{{ .CSVEditor }}"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -215,7 +219,7 @@
|
|||||||
MODE
|
MODE
|
||||||
</span>
|
</span>
|
||||||
<span id="editor-format-status">
|
<span id="editor-format-status">
|
||||||
{{ .EditType }}
|
{{ if .CSVEditor }}CSV{{ else }}{{ .EditType }}{{ end }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -272,7 +276,8 @@ Ln 1, Col 1
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script src="/static/js/editor-core.js?v=priority-ux-1"></script>
|
<script src="/static/js/editor-core.js?v=priority-ux-1"></script>
|
||||||
<script src="/static/js/editor.js?v=priority-ux-1"></script>
|
{{ if .CSVEditor }}<script>window.PagesCSVSource = {{ .Body }};</script><script src="/static/js/csv-core.js?v=2"></script><script src="/static/js/csv-editor.js?v=2"></script>{{ end }}
|
||||||
|
<script src="/static/js/editor.js?v=slides-1"></script>
|
||||||
<script src="/static/js/path-actions.js"></script>
|
<script src="/static/js/path-actions.js"></script>
|
||||||
|
|
||||||
|
|
||||||
@@ -295,12 +300,13 @@ window.addEventListener(
|
|||||||
const cm =
|
const cm =
|
||||||
window.PagesWikiEditor.create(
|
window.PagesWikiEditor.create(
|
||||||
mount,
|
mount,
|
||||||
textarea.value,
|
window.PagesEditor?.text() ?? textarea.value,
|
||||||
"{{ .EditType }}",
|
"{{ .EditType }}",
|
||||||
{
|
{
|
||||||
keymap: mount.dataset.keymap,
|
keymap: mount.dataset.keymap,
|
||||||
syntax: mount.dataset.syntax === "true",
|
syntax: mount.dataset.syntax === "true",
|
||||||
autocomplete: mount.dataset.autocomplete === "true",
|
autocomplete: mount.dataset.autocomplete === "true",
|
||||||
|
preserveLineEndings: mount.dataset.csv === "true",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -308,7 +314,11 @@ window.addEventListener(
|
|||||||
cm
|
cm
|
||||||
|
|
||||||
cm.focus()
|
cm.focus()
|
||||||
setTimeout(() => cm.focus(), 0)
|
setTimeout(() => {
|
||||||
|
// Do not steal focus from a table cell or toolbar clicked while
|
||||||
|
// the editor was initializing.
|
||||||
|
if (document.activeElement === document.body || mount.contains(document.activeElement)) cm.focus()
|
||||||
|
}, 0)
|
||||||
|
|
||||||
window.PagesWikiGetEditorText =
|
window.PagesWikiGetEditorText =
|
||||||
() => window.PagesWikiCodeMirror.state.doc.toString()
|
() => window.PagesWikiCodeMirror.state.doc.toString()
|
||||||
|
|||||||
@@ -80,6 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ if .ObjectUUID }}
|
{{ if .ObjectUUID }}
|
||||||
|
{{ if and .SlidesEnabled (eq .ContentView.Kind "html") }}<a class="breadcrumb-action-icon" href="/v/slides{{ .Path }}" title="{{ T "slides.title" }}" aria-label="{{ T "slides.title" }}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 4h18v12H3zM12 16v5m-5 0 5-5 5 5M8 8h8m-8 4h5"/></svg></a>{{ end }}
|
||||||
<a class="breadcrumb-action-icon" href="/_/view/print/uuid:{{ .ObjectUUID }}" title="{{ T "viewer.print" }}" aria-label="{{ T "viewer.print" }}">
|
<a class="breadcrumb-action-icon" href="/_/view/print/uuid:{{ .ObjectUUID }}" title="{{ T "viewer.print" }}" aria-label="{{ T "viewer.print" }}">
|
||||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 9V4h10v5M7 17H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2M7 14h10v6H7z"></path></svg>
|
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 9V4h10v5M7 17H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2M7 14h10v6H7z"></path></svg>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{{ define "slides.gohtml" }}
|
||||||
|
<!doctype html><html lang="{{ .Locale }}"><head>
|
||||||
|
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<title>{{ .Title }} · {{ .WikiName }}</title>
|
||||||
|
<link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}">
|
||||||
|
<link rel="stylesheet" href="/static/css/slides.css?v=1"><script defer src="/static/js/slides.js?v=1"></script>
|
||||||
|
</head><body class="slides-page">
|
||||||
|
<header class="topbar"><a href="{{ .Path }}" aria-label="{{ T "slides.close" }}" title="{{ T "slides.close" }}">←</a><span>{{ .Path }}</span><button type="button" data-slides-fullscreen title="{{ T "slides.fullscreen" }}" aria-label="{{ T "slides.fullscreen" }}">⛶</button></header>
|
||||||
|
<main data-slides-viewer data-path="{{ .Path }}" data-error="{{ T "slides.error" }}"></main>
|
||||||
|
<textarea data-slides-source hidden>{{ .SlideSource }}</textarea>
|
||||||
|
</body></html>
|
||||||
|
{{ end }}
|
||||||
Reference in new issue
Block a user