diff --git a/README.de.md b/README.de.md index a7cca53..1cee1db 100644 --- a/README.de.md +++ b/README.de.md @@ -38,6 +38,31 @@ Den [gehosteten Editor](https://werkbaum.javagil.de) öffnen — links Text bearbeiten, rechts entsteht das Diagramm live. Toggles: transponierte (schmale) Darstellung, verworfene Elemente einblenden. +### Diagramm aus einer URL laden + +Der Editor kann seinen Notationstext über den Query-Parameter `sourceUrl` aus +einer externen Textdatei beziehen — praktisch zum Teilen eines Plans oder wenn +die Quelle in Git oder einem Wiki gepflegt wird: + +**▶ [Live-Beispiel](https://werkbaum.javagil.de/?sourceUrl=https://raw.githubusercontent.com/mhoennig/werkbaum/main/docs/example-plan.txt)** +— lädt [`docs/example-plan.txt`](docs/example-plan.txt): + +``` +https://werkbaum.javagil.de/?sourceUrl=https://raw.githubusercontent.com/mhoennig/werkbaum/main/docs/example-plan.txt +``` + +Der geladene Text wird als **eigenes Dokument** geführt, dessen **Name die URL** +ist — eigene Dokumente bleiben unberührt, und derselbe Link aktualisiert dieses +eine Dokument, statt Kopien anzuhäufen. Die URL ist die Quelle der Wahrheit: Sie +wird bei jedem Laden neu geholt, lokale Änderungen daran überleben ein Neuladen +also nicht. + +**Einschränkung — CORS:** Der Browser lädt fremde Hosts nur, wenn sie +`Access-Control-Allow-Origin` senden. `raw.githubusercontent.com` und +GitLab-Raw-Links tun das; ein beliebiger Webserver oft nicht. Scheitert das +Laden, bleibt der bisherige Stand stehen und eine Warnung nennt die Ursache. +Zugelassen sind nur `http`/`https`. + ### Lokal ausführen Die Editor-Quelle liegt jetzt als ES-Module unter `frontend/src/`, gebündelt mit diff --git a/README.md b/README.md index 68ed5bf..8760528 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,29 @@ Open the [hosted editor](https://werkbaum.javagil.de) — edit text on the left, the diagram is built live on the right. Toggles: transposed (narrow) layout, show discarded elements. +### Loading a diagram from a URL + +The editor can pull its notation text from an external text file via the +`sourceUrl` query parameter — handy for sharing a plan or keeping the source in +Git or a wiki: + +**▶ [Live example](https://werkbaum.javagil.de/?sourceUrl=https://raw.githubusercontent.com/mhoennig/werkbaum/main/docs/example-plan.txt)** +— loads [`docs/example-plan.txt`](docs/example-plan.txt): + +``` +https://werkbaum.javagil.de/?sourceUrl=https://raw.githubusercontent.com/mhoennig/werkbaum/main/docs/example-plan.txt +``` + +The loaded text becomes its own document whose **name is the URL**, so your own +documents stay untouched; the same link updates that one document instead of +piling up copies. The URL is the source of truth — it is re-fetched on every +load, so local edits to it do not survive a reload. + +**Caveat — CORS:** the browser only fetches a foreign host if it sends +`Access-Control-Allow-Origin`. `raw.githubusercontent.com` and GitLab raw links +do; an arbitrary web server often does not. If loading fails the previous +content stays and a warning explains why. Only `http`/`https` are allowed. + ### Running it locally The editor source now lives as ES modules under `frontend/src/`, bundled by diff --git a/docs/example-plan.txt b/docs/example-plan.txt new file mode 100644 index 0000000..7518b16 --- /dev/null +++ b/docs/example-plan.txt @@ -0,0 +1,22 @@ +%% Werkbaum example plan — meant to be loaded via ?sourceUrl= +%% Full notation reference: docs/SPEC.md + +[~] Online shop relaunch (XL) https://example.com/shop + - [x] Discovery (M) + - [x] User interviews (S) @maria + - [x] Competitor scan (XS) + - [~] Checkout (XL) + - [/] Shopping cart (M) @tom + - [x] Add and remove items (S) + - [/] Discount codes (S) + - [!] Payment provider (L) @maria @tom %% effort still unclear + | [ ] Stripe (M) + - [ ] Sandbox account (XS) + - [ ] Webhook handling (S) + | [?] PayPal (M) + | [-] Build our own PSP (XXL) %% far too expensive + - [ ] Order confirmation mail (S) + - [?] Hosting (M) + | Managed cloud (S) https://hostsharing.net + | On-premise (L) + - [^] Landing page (S) @lena