ux: Redesign-Pass (impeccable)
- Editor als Hero mit Empty-State-Affordance (Paste-Glyph + Key-Hints) - Dateiname mit auto/eigen-Indikator und Flash bei Auto-Update - Live-Statusbadge 'HTML->Markdown konvertiert' mit Puls - Verfeinerte OKLCH-Palette (getoente Neutrals, ein Accent), Type-Hierarchie - Header-Wordmark + Keyboard-Legende - Motion (ease-out-quint) mit prefers-reduced-motion, :focus-visible, aria-live Toast - Responsive (Mobile-Layout), Danger-Flash bei leerem Speichern - PRODUCT.md + DESIGN.md (HD Design-System dokumentiert) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# clip2md — Design System
|
||||
|
||||
Register: **product**. Color strategy: **Restrained** (tinted neutrals + one accent ≤10%).
|
||||
Theme: **dark**. Scene: Nutzer legt spätabends oder tagsüber am Monitor schnell einen langen
|
||||
Thread ab; eine ruhige, dunkle, blendfreie Fläche hält den Fokus auf dem Text, nicht auf dem UI.
|
||||
|
||||
## Color (OKLCH)
|
||||
|
||||
Neutrals sind zur Marken-Hue (kühles Blau-Grau, ~265) getönt — nie reines `#000`/`#fff`.
|
||||
|
||||
| Token | OKLCH | Rolle |
|
||||
| --- | --- | --- |
|
||||
| `--bg` | `0.17 0.014 265` | App-Hintergrund (tief) |
|
||||
| `--surface` | `0.215 0.016 265` | Editor-Fläche |
|
||||
| `--raised` | `0.255 0.018 265` | Bars, Buttons |
|
||||
| `--line` | `0.32 0.02 265` | Ruhige Rahmen |
|
||||
| `--line-strong`| `0.42 0.024 265` | Aktive Rahmen |
|
||||
| `--text` | `0.95 0.006 265` | Primärtext |
|
||||
| `--muted` | `0.68 0.012 265` | Sekundärtext, Labels |
|
||||
| `--faint` | `0.5 0.012 265` | Tertiär, Legende |
|
||||
| `--accent` | `0.74 0.15 152` | Grün — Primäraktion, Fokus, „konvertiert" |
|
||||
| `--accent-ink` | `0.22 0.05 152` | Text auf Accent |
|
||||
| `--danger` | `0.66 0.16 25` | Fehler-Toast, destruktiv |
|
||||
|
||||
Accent trägt <10% der Fläche: Save-Button, Fokus-Ring, „konvertiert"-Badge. Sonst Neutrals.
|
||||
|
||||
## Typography
|
||||
|
||||
- **Sans (UI-Chrome):** Inter / system-ui. Labels, Buttons, Legende.
|
||||
- **Mono (Daten):** ui-monospace / JetBrains Mono. Editor, Dateiname, Zähler — alles, was „Inhalt" ist.
|
||||
- Scale mit ≥1.25-Kontrast: 11 (legende) · 12.5 (meta) · 14 (body/editor) · 15 (buttons) · 18 (wordmark).
|
||||
- Editor-Zeilenhöhe 1.65, `tab-size: 2`, Body-Zeilen bleiben durch die Mono-Fläche natürlich lesbar.
|
||||
|
||||
## Elevation & Layout
|
||||
|
||||
- Drei Ebenen: `bg` (App) → `surface` (Editor, das Herzstück, bekommt den Raum) → `raised` (Bars/Buttons).
|
||||
- Keine Cards, keine Schatten außer einem weichen Toast-Drop. Trennung über 1px-Linien und Ton, nicht Boxen.
|
||||
- Spacing-Rhythmus variiert bewusst: großzügig um den Editor, kompakt in der Toolbar.
|
||||
- Radius 10–12px, konsistent.
|
||||
|
||||
## Motion
|
||||
|
||||
- Ease-out-quint (`cubic-bezier(0.22, 1, 0.36, 1)`), 120–240ms. Kein Bounce.
|
||||
- Nur Opacity/Transform animieren. Toast slidet ein, Button-Press senkt 1px, „konvertiert"-Badge pulst einmal kurz, auto-aktualisierter Dateiname flasht dezent.
|
||||
- `prefers-reduced-motion`: alle nicht-essenziellen Transitions aus.
|
||||
|
||||
## Accessibility
|
||||
|
||||
- `:focus-visible` Ring in Accent, überall. Touch-Ziele ≥40px.
|
||||
- Toasts über `aria-live="polite"`. Editor & Felder korrekt gelabelt.
|
||||
- Kontrast: Text/`bg` und Accent-Ink/Accent über WCAG AA.
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
# clip2md — Product Context
|
||||
|
||||
**register: product**
|
||||
|
||||
## Product Purpose
|
||||
|
||||
Ein winziges, self-hosted Utility: langen oder formatierten Text (Reddit-Thread, Website,
|
||||
Artikel) reinpasten und in unter zwei Sekunden als sauberes `.md` speichern — ohne Umwege,
|
||||
ohne Login, ohne Server-Roundtrip. Ein einziger Screen, tastaturgetrieben.
|
||||
|
||||
## Users
|
||||
|
||||
Till (Heidrich Digital) und Team. Power-User, die schnell Web-Inhalte in ihr Markdown-Archiv
|
||||
(Obsidian, Outline, Repos) überführen. Nutzung am Desktop, oft nebenbei zwischen Lesen und
|
||||
Ablegen. Erwartung: reagiert sofort, kein Nachdenken, Keyboard-first (`⌘V`, `⌘S`).
|
||||
|
||||
## Brand & Tone
|
||||
|
||||
Heidrich Digital: ruhig, präzise, editorial-minimalistisch, anti-AI-slop. Deutsch, sachlich,
|
||||
auf Augenhöhe. Kein Marketing-Geschrei, keine Emojis im UI. Das Tool soll sich wie ein
|
||||
scharfes, wertiges Werkzeug anfühlen, nicht wie ein SaaS-Dashboard.
|
||||
|
||||
## Strategic Principles
|
||||
|
||||
- **Frictionless.** Der schnellste Weg von Zwischenablage zu `.md`. Jeder Klick, der wegfällt, ist ein Gewinn.
|
||||
- **Clientseitig & privat.** Nichts verlässt den Browser. Kein CDN, keine Third-Party-Requests (DSGVO-sauber, offline-fähig).
|
||||
- **Keyboard-first.** Maus optional. `⌘V` konvertiert, `⌘S` speichert.
|
||||
- **Ehrliches Feedback.** Der Nutzer sieht, was passiert ist (konvertiert vs. roh), ohne dass es aufdringlich wird.
|
||||
|
||||
## Anti-References
|
||||
|
||||
- Generische SaaS-Cards mit Icon + Heading + Text.
|
||||
- Hero-Metric-Kacheln, Gradient-Text, Glassmorphism.
|
||||
- Überladene Toolbars. Dieses Tool hat genau die Knöpfe, die es braucht.
|
||||
- Bunte „freundliche" Farbverläufe. Ruhe schlägt Effekt.
|
||||
+358
-150
@@ -3,240 +3,419 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Paste to Markdown — reinpasten, ein Klick, .md speichern." />
|
||||
<meta name="color-scheme" content="dark" />
|
||||
<meta name="description" content="clip2md — reinpasten, ein Klick, als Markdown speichern. Clientseitig, privat." />
|
||||
<meta name="theme-color" content="#22262f" />
|
||||
<title>clip2md — Paste to Markdown</title>
|
||||
<style>
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--bg: oklch(0.19 0.012 265);
|
||||
--bg-2: oklch(0.235 0.014 265);
|
||||
--bg-3: oklch(0.28 0.016 265);
|
||||
--line: oklch(0.36 0.018 265);
|
||||
--text: oklch(0.94 0.008 265);
|
||||
--muted: oklch(0.66 0.014 265);
|
||||
--accent: oklch(0.74 0.15 155);
|
||||
--accent-ink:oklch(0.20 0.05 155);
|
||||
--danger: oklch(0.68 0.15 25);
|
||||
--radius: 12px;
|
||||
/* Neutrals tinted toward a cool 265 hue — never pure black/white. */
|
||||
--bg: oklch(0.17 0.014 265);
|
||||
--surface: oklch(0.215 0.016 265);
|
||||
--raised: oklch(0.255 0.018 265);
|
||||
--raised-hi: oklch(0.31 0.02 265);
|
||||
--line: oklch(0.32 0.02 265);
|
||||
--line-strong: oklch(0.42 0.024 265);
|
||||
--text: oklch(0.95 0.006 265);
|
||||
--muted: oklch(0.68 0.012 265);
|
||||
--faint: oklch(0.52 0.012 265);
|
||||
--accent: oklch(0.74 0.15 152);
|
||||
--accent-dim: oklch(0.74 0.15 152 / 0.16);
|
||||
--accent-ink: oklch(0.22 0.05 152);
|
||||
--danger: oklch(0.66 0.16 25);
|
||||
|
||||
--r-sm: 8px;
|
||||
--r: 11px;
|
||||
--r-lg: 14px;
|
||||
|
||||
--ease: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
--font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
--font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
|
||||
--font-mono: ui-monospace, "JetBrains Mono", "SF Mono", "Fira Code", Menlo, Consolas, monospace;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { height: 100%; }
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg);
|
||||
background:
|
||||
radial-gradient(120% 80% at 50% -20%, oklch(0.24 0.02 265) 0%, transparent 60%),
|
||||
var(--bg);
|
||||
color: var(--text);
|
||||
font-family: var(--font-ui);
|
||||
font-size: 14px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100dvh;
|
||||
}
|
||||
header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
padding: 18px 22px 14px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
header h1 {
|
||||
font-size: 17px;
|
||||
font-weight: 650;
|
||||
letter-spacing: -0.01em;
|
||||
margin: 0;
|
||||
}
|
||||
header h1 .dot { color: var(--accent); }
|
||||
header .sub {
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
header .spacer { flex: 1; }
|
||||
header .hint {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
header .hint kbd {
|
||||
background: var(--bg-3);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 5px;
|
||||
padding: 1px 6px;
|
||||
font-size: 11px;
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
border-radius: var(--r-sm);
|
||||
}
|
||||
|
||||
/* ---------- Header ---------- */
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.mark {
|
||||
width: 26px; height: 26px;
|
||||
border-radius: 7px;
|
||||
display: grid; place-items: center;
|
||||
background: var(--accent);
|
||||
color: var(--accent-ink);
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
letter-spacing: -0.03em;
|
||||
flex: none;
|
||||
}
|
||||
.wordmark {
|
||||
font-size: 18px;
|
||||
font-weight: 640;
|
||||
letter-spacing: -0.02em;
|
||||
margin: 0;
|
||||
}
|
||||
.wordmark b { color: var(--accent); font-weight: 640; }
|
||||
.tagline {
|
||||
font-size: 12.5px;
|
||||
color: var(--muted);
|
||||
margin-left: 2px;
|
||||
}
|
||||
.tagline code {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11.5px;
|
||||
color: var(--text);
|
||||
background: var(--raised);
|
||||
padding: 1px 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
header .spacer { flex: 1; }
|
||||
.legend {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
font-size: 12px;
|
||||
color: var(--faint);
|
||||
}
|
||||
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
|
||||
kbd {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
background: var(--raised);
|
||||
border: 1px solid var(--line);
|
||||
border-bottom-width: 2px;
|
||||
border-radius: 5px;
|
||||
padding: 1px 5px;
|
||||
min-width: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ---------- Toolbar ---------- */
|
||||
.bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 22px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
background: var(--bg-2);
|
||||
flex-wrap: wrap;
|
||||
padding: 14px 24px;
|
||||
}
|
||||
.fname {
|
||||
flex: 1;
|
||||
min-width: 220px;
|
||||
min-width: 200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: var(--bg);
|
||||
gap: 10px;
|
||||
background: var(--raised);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
padding: 0 4px 0 14px;
|
||||
transition: border-color .15s;
|
||||
border-radius: var(--r);
|
||||
padding: 0 6px 0 14px;
|
||||
transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
|
||||
}
|
||||
.fname:focus-within {
|
||||
border-color: var(--line-strong);
|
||||
box-shadow: 0 0 0 3px var(--accent-dim);
|
||||
}
|
||||
.fname.flash { animation: flash .5s var(--ease); }
|
||||
@keyframes flash {
|
||||
0% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
|
||||
100% { border-color: var(--line); box-shadow: 0 0 0 3px transparent; }
|
||||
}
|
||||
.fname:focus-within { border-color: var(--accent); }
|
||||
.fname .lbl {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
margin-right: 10px;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--faint);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.fname input {
|
||||
flex: 1;
|
||||
min-width: 40px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: var(--text);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 14px;
|
||||
padding: 11px 0;
|
||||
padding: 12px 0;
|
||||
}
|
||||
.fname .ext {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 14px;
|
||||
color: var(--muted);
|
||||
padding: 0 12px;
|
||||
}
|
||||
.fname .tag {
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: var(--faint);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
padding: 3px 9px;
|
||||
white-space: nowrap;
|
||||
transition: color .18s, border-color .18s;
|
||||
}
|
||||
.fname .tag.auto { color: var(--accent); border-color: var(--accent-dim); }
|
||||
|
||||
button {
|
||||
font-family: var(--font-ui);
|
||||
font-size: 14px;
|
||||
font-weight: 550;
|
||||
font-size: 15px;
|
||||
font-weight: 560;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--bg-3);
|
||||
background: var(--raised);
|
||||
color: var(--text);
|
||||
border-radius: var(--radius);
|
||||
padding: 11px 16px;
|
||||
border-radius: var(--r);
|
||||
padding: 11px 18px;
|
||||
cursor: pointer;
|
||||
transition: background .15s, border-color .15s, transform .05s;
|
||||
transition: background .16s var(--ease), border-color .16s, transform .05s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
button:hover { background: var(--line); }
|
||||
button:hover { background: var(--raised-hi); border-color: var(--line-strong); }
|
||||
button:active { transform: translateY(1px); }
|
||||
button.primary {
|
||||
background: var(--accent);
|
||||
color: var(--accent-ink);
|
||||
border-color: var(--accent);
|
||||
font-weight: 650;
|
||||
font-weight: 660;
|
||||
box-shadow: 0 1px 0 oklch(0.6 0.13 152) inset;
|
||||
}
|
||||
button.primary:hover { filter: brightness(1.06); background: var(--accent); }
|
||||
button.ghost { background: transparent; }
|
||||
button.ghost:hover { background: var(--bg-3); }
|
||||
button.primary:hover { filter: brightness(1.05); background: var(--accent); border-color: var(--accent); }
|
||||
button.icon {
|
||||
padding: 11px 13px;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
}
|
||||
button.icon:hover { color: var(--text); background: var(--raised); }
|
||||
|
||||
/* ---------- Editor ---------- */
|
||||
main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
padding: 16px 22px;
|
||||
padding: 4px 24px 18px;
|
||||
position: relative;
|
||||
}
|
||||
.editor-wrap {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
}
|
||||
#editor {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
resize: none;
|
||||
background: var(--bg-2);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
padding: 18px 20px;
|
||||
border-radius: var(--r-lg);
|
||||
padding: 22px 24px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 14px;
|
||||
line-height: 1.65;
|
||||
outline: none;
|
||||
tab-size: 2;
|
||||
transition: border-color .15s;
|
||||
transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
|
||||
}
|
||||
#editor:focus { border-color: var(--accent); }
|
||||
#editor::placeholder { color: var(--muted); }
|
||||
#editor:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--accent-dim); }
|
||||
#editor::placeholder { color: transparent; } /* empty-state overlay handles this */
|
||||
|
||||
/* Empty state — invites the paste, disappears once there's content. */
|
||||
.empty {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 18px;
|
||||
text-align: center;
|
||||
pointer-events: none;
|
||||
padding: 24px;
|
||||
opacity: 1;
|
||||
transition: opacity .24s var(--ease);
|
||||
}
|
||||
main.has-content .empty { opacity: 0; }
|
||||
.empty .glyph {
|
||||
width: 60px; height: 60px;
|
||||
border-radius: 16px;
|
||||
display: grid; place-items: center;
|
||||
background: var(--raised);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--accent);
|
||||
}
|
||||
.empty .glyph svg { width: 28px; height: 28px; }
|
||||
.empty h2 {
|
||||
margin: 0;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--text);
|
||||
}
|
||||
.empty p {
|
||||
margin: 0;
|
||||
max-width: 46ch;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.6;
|
||||
color: var(--muted);
|
||||
}
|
||||
.empty .keys {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
color: var(--faint);
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
/* ---------- Status bar ---------- */
|
||||
footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 10px 22px 14px;
|
||||
border-top: 1px solid var(--line);
|
||||
gap: 16px;
|
||||
padding: 11px 24px 16px;
|
||||
font-size: 12.5px;
|
||||
color: var(--muted);
|
||||
color: var(--faint);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
footer .count { font-family: var(--font-mono); color: var(--muted); }
|
||||
footer .spacer { flex: 1; }
|
||||
footer .count { font-family: var(--font-mono); }
|
||||
footer .src { color: var(--accent); font-weight: 600; }
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
opacity: 0;
|
||||
transform: translateY(2px);
|
||||
transition: opacity .2s var(--ease), transform .2s var(--ease);
|
||||
}
|
||||
.badge.show { opacity: 1; transform: none; }
|
||||
.badge .led {
|
||||
width: 7px; height: 7px; border-radius: 50%;
|
||||
background: var(--faint);
|
||||
}
|
||||
.badge.ok .led { background: var(--accent); }
|
||||
.badge.pulse .led { animation: pulse .6s var(--ease); }
|
||||
@keyframes pulse {
|
||||
0% { box-shadow: 0 0 0 0 var(--accent-dim); }
|
||||
100% { box-shadow: 0 0 0 9px transparent; }
|
||||
}
|
||||
|
||||
/* ---------- Toast ---------- */
|
||||
.toast {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 26px;
|
||||
transform: translateX(-50%) translateY(20px);
|
||||
background: var(--bg-3);
|
||||
border: 1px solid var(--line);
|
||||
bottom: 28px;
|
||||
transform: translateX(-50%) translateY(16px);
|
||||
background: var(--raised-hi);
|
||||
border: 1px solid var(--line-strong);
|
||||
color: var(--text);
|
||||
padding: 11px 18px;
|
||||
border-radius: 10px;
|
||||
font-size: 13.5px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity .2s, transform .2s;
|
||||
box-shadow: 0 8px 30px oklch(0 0 0 / 0.4);
|
||||
transition: opacity .2s var(--ease), transform .24s var(--ease);
|
||||
box-shadow: 0 12px 40px oklch(0 0 0 / 0.5);
|
||||
z-index: 50;
|
||||
max-width: 90vw;
|
||||
}
|
||||
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
|
||||
.toast.err { border-color: var(--danger); }
|
||||
|
||||
@media (max-width: 640px) {
|
||||
header, .bar, main, footer { padding-left: 14px; padding-right: 14px; }
|
||||
header .hint { display: none; }
|
||||
.bar { gap: 8px; }
|
||||
button { padding: 11px 13px; }
|
||||
/* ---------- Responsive ---------- */
|
||||
@media (max-width: 760px) {
|
||||
header { padding: 14px 16px; }
|
||||
.legend { display: none; }
|
||||
.tagline { display: none; }
|
||||
.bar { padding: 12px 16px; gap: 8px; flex-wrap: wrap; }
|
||||
.fname { order: -1; flex-basis: 100%; }
|
||||
main { padding: 2px 16px 14px; }
|
||||
footer { padding: 10px 16px 14px; gap: 12px; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after { transition: none !important; animation: none !important; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>clip<span class="dot">2</span>md</h1>
|
||||
<span class="sub">Reinpasten → ein Klick → als <code>.md</code> speichern.</span>
|
||||
<div class="mark">m↓</div>
|
||||
<h1 class="wordmark">clip<b>2</b>md</h1>
|
||||
<span class="tagline">reinpasten → <code>.md</code></span>
|
||||
<span class="spacer"></span>
|
||||
<span class="hint">Speichern <kbd>⌘/Strg</kbd> + <kbd>S</kbd> · Roh einfügen <kbd>⌘/Strg</kbd> + <kbd>⇧</kbd> + <kbd>V</kbd></span>
|
||||
<nav class="legend" aria-hidden="true">
|
||||
<span><kbd>⌘</kbd><kbd>V</kbd> einfügen</span>
|
||||
<span><kbd>⌘</kbd><kbd>S</kbd> speichern</span>
|
||||
<span><kbd>⌘</kbd><kbd>⇧</kbd><kbd>V</kbd> roh</span>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="bar">
|
||||
<label class="fname">
|
||||
<span class="lbl">Dateiname</span>
|
||||
<label class="fname" id="fnameBox">
|
||||
<span class="lbl">Datei</span>
|
||||
<input id="filename" type="text" spellcheck="false" autocomplete="off" aria-label="Dateiname" />
|
||||
<span class="ext">.md</span>
|
||||
<span class="tag auto" id="fnameTag">auto</span>
|
||||
</label>
|
||||
<button id="save" class="primary">Speichern</button>
|
||||
<button id="copy" class="ghost">Kopieren</button>
|
||||
<button id="clear" class="ghost">Leeren</button>
|
||||
<button id="copy" class="icon" title="Markdown kopieren" aria-label="Markdown kopieren">Kopieren</button>
|
||||
<button id="clear" class="icon" title="Editor leeren" aria-label="Editor leeren">Leeren</button>
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<textarea id="editor" spellcheck="false" autocapitalize="off" autocorrect="off"
|
||||
placeholder="Hier reinpasten — ein langer Reddit-Thread, eine Website, formatierter Text…
|
||||
|
||||
Formatiertes HTML (Copy aus dem Browser) wird automatisch zu sauberem Markdown. Reiner Text bleibt wie er ist.
|
||||
|
||||
Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
<main id="main">
|
||||
<div class="editor-wrap">
|
||||
<textarea id="editor" spellcheck="false" autocapitalize="off" autocorrect="off"
|
||||
aria-label="Markdown-Editor"></textarea>
|
||||
<div class="empty" id="empty" aria-hidden="true">
|
||||
<div class="glyph">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="8" y="3" width="8" height="4" rx="1.4"/>
|
||||
<path d="M16 5h2a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2"/>
|
||||
<path d="M9 13h6M9 16.5h4"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h2>Reinpasten</h2>
|
||||
<p>Langen Reddit-Thread, eine Website oder formatierten Text hier einfügen.
|
||||
Formatiertes HTML wird automatisch zu sauberem Markdown, reiner Text bleibt roh.</p>
|
||||
<div class="keys"><kbd>⌘</kbd><kbd>V</kbd><span>einfügen</span> · <kbd>⌘</kbd><kbd>S</kbd><span>speichern</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<span class="count"><span id="words">0</span> Wörter · <span id="chars">0</span> Zeichen</span>
|
||||
<span id="srcInfo" class="src"></span>
|
||||
<span class="badge" id="srcBadge"><span class="led"></span><span id="srcText"></span></span>
|
||||
<span class="spacer"></span>
|
||||
<span>clip2md · Heidrich Digital</span>
|
||||
<span>clientseitig · nichts wird gesendet</span>
|
||||
</footer>
|
||||
|
||||
<div id="toast" class="toast"></div>
|
||||
<div id="toast" class="toast" role="status" aria-live="polite"></div>
|
||||
|
||||
<script src="vendor/turndown.js"></script>
|
||||
<script src="vendor/turndown-plugin-gfm.js"></script>
|
||||
@@ -259,17 +438,20 @@ Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
turndown.use(window.turndownPluginGfm.gfm);
|
||||
}
|
||||
} catch (e) { /* gfm optional */ }
|
||||
// Drop noise that clutters pasted web pages.
|
||||
turndown.remove(["script", "style", "noscript", "iframe", "svg"]);
|
||||
|
||||
var editor = document.getElementById("editor");
|
||||
var main = document.getElementById("main");
|
||||
var filename = document.getElementById("filename");
|
||||
var fnameBox = document.getElementById("fnameBox");
|
||||
var fnameTag = document.getElementById("fnameTag");
|
||||
var wordsEl = document.getElementById("words");
|
||||
var charsEl = document.getElementById("chars");
|
||||
var srcInfo = document.getElementById("srcInfo");
|
||||
var srcBadge = document.getElementById("srcBadge");
|
||||
var srcText = document.getElementById("srcText");
|
||||
var toastEl = document.getElementById("toast");
|
||||
|
||||
var filenameEdited = false; // becomes true once the user types in the field
|
||||
var filenameEdited = false;
|
||||
var toastTimer = null;
|
||||
|
||||
// ---- Helpers --------------------------------------------------------
|
||||
@@ -291,21 +473,17 @@ Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
function slugify(s) {
|
||||
if (!s) return "";
|
||||
s = s.replace(/[äöüßÄÖÜ]/g, function (c) { return UMLAUT[c] || c; });
|
||||
s = s.normalize("NFKD").replace(/[̀-ͯ]/g, ""); // strip accents
|
||||
s = s.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "");
|
||||
s = s.normalize("NFKD").replace(/[̀-ͯ]/g, "");
|
||||
s = s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
||||
return s.slice(0, 60).replace(/-+$/g, "");
|
||||
}
|
||||
|
||||
function deriveTitle(md) {
|
||||
var lines = md.split(/\r?\n/);
|
||||
// Prefer the first ATX heading.
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var m = lines[i].match(/^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$/);
|
||||
if (m && m[1].trim()) return m[1].trim();
|
||||
}
|
||||
// Otherwise the first non-empty, non-decorative line.
|
||||
for (var j = 0; j < lines.length; j++) {
|
||||
var t = lines[j].trim();
|
||||
if (!t) continue;
|
||||
@@ -320,9 +498,22 @@ Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
return today() + (slug ? "-" + slug : "-clip");
|
||||
}
|
||||
|
||||
function refreshFilename() {
|
||||
function refreshFilename(flash) {
|
||||
if (filenameEdited) return;
|
||||
filename.value = computeFilename(editor.value);
|
||||
var next = computeFilename(editor.value);
|
||||
if (next !== filename.value) {
|
||||
filename.value = next;
|
||||
if (flash) {
|
||||
fnameBox.classList.remove("flash");
|
||||
void fnameBox.offsetWidth; // reflow to restart animation
|
||||
fnameBox.classList.add("flash");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setFnameTag() {
|
||||
if (filenameEdited) { fnameTag.textContent = "eigen"; fnameTag.classList.remove("auto"); }
|
||||
else { fnameTag.textContent = "auto"; fnameTag.classList.add("auto"); }
|
||||
}
|
||||
|
||||
function updateCounts() {
|
||||
@@ -332,63 +523,81 @@ Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
wordsEl.textContent = w.toLocaleString("de-DE");
|
||||
}
|
||||
|
||||
function refreshAll() { updateCounts(); refreshFilename(); }
|
||||
function updateEmpty() {
|
||||
main.classList.toggle("has-content", editor.value.length > 0);
|
||||
}
|
||||
|
||||
function showSource(text, ok, pulse) {
|
||||
srcText.textContent = text;
|
||||
srcBadge.classList.toggle("ok", !!ok);
|
||||
srcBadge.classList.add("show");
|
||||
if (pulse) {
|
||||
srcBadge.classList.remove("pulse");
|
||||
void srcBadge.offsetWidth;
|
||||
srcBadge.classList.add("pulse");
|
||||
}
|
||||
}
|
||||
function hideSource() { srcBadge.classList.remove("show", "ok", "pulse"); }
|
||||
|
||||
function refreshAll(flash) { updateCounts(); refreshFilename(flash); updateEmpty(); }
|
||||
|
||||
// ---- Smart paste ----------------------------------------------------
|
||||
// Cmd/Ctrl+Shift+V forces a raw (plain-text) paste.
|
||||
var forceRaw = false;
|
||||
|
||||
editor.addEventListener("paste", function (e) {
|
||||
var cd = e.clipboardData || window.clipboardData;
|
||||
if (!cd) return; // let the browser handle it
|
||||
if (!cd) return;
|
||||
var html = cd.getData("text/html");
|
||||
var text = cd.getData("text/plain");
|
||||
|
||||
var out, source;
|
||||
var out, badge, ok;
|
||||
if (!forceRaw && html && html.trim()) {
|
||||
try {
|
||||
out = turndown.turndown(html).replace(/\n{3,}/g, "\n\n").trim();
|
||||
source = "HTML → Markdown konvertiert";
|
||||
badge = "HTML → Markdown konvertiert"; ok = true;
|
||||
} catch (err) {
|
||||
out = text; source = "Roh eingefügt (Konvertierung fehlgeschlagen)";
|
||||
out = text; badge = "Roh eingefügt (Konvertierung fehlgeschlagen)"; ok = false;
|
||||
}
|
||||
} else {
|
||||
out = text;
|
||||
source = forceRaw ? "Roh eingefügt (erzwungen)" : "Roh eingefügt (kein HTML)";
|
||||
badge = forceRaw ? "Roh eingefügt (erzwungen)" : "Roh eingefügt";
|
||||
ok = false;
|
||||
}
|
||||
forceRaw = false;
|
||||
if (out == null) return;
|
||||
|
||||
e.preventDefault();
|
||||
insertAtCursor(out);
|
||||
srcInfo.textContent = source;
|
||||
refreshAll();
|
||||
toast(source);
|
||||
showSource(badge, ok, true);
|
||||
refreshAll(true);
|
||||
});
|
||||
|
||||
function insertAtCursor(str) {
|
||||
var start = editor.selectionStart, end = editor.selectionEnd;
|
||||
var before = editor.value.slice(0, start);
|
||||
var after = editor.value.slice(end);
|
||||
editor.value = before + str + after;
|
||||
editor.value = editor.value.slice(0, start) + str + editor.value.slice(end);
|
||||
var pos = start + str.length;
|
||||
editor.selectionStart = editor.selectionEnd = pos;
|
||||
}
|
||||
|
||||
editor.addEventListener("input", function () {
|
||||
srcInfo.textContent = "";
|
||||
refreshAll();
|
||||
hideSource();
|
||||
refreshAll(false);
|
||||
});
|
||||
|
||||
// ---- Filename field -------------------------------------------------
|
||||
filename.addEventListener("input", function () {
|
||||
filenameEdited = filename.value.trim().length > 0;
|
||||
setFnameTag();
|
||||
});
|
||||
// Empty field → hand control back to auto.
|
||||
filename.addEventListener("blur", function () {
|
||||
if (!filename.value.trim()) { filenameEdited = false; setFnameTag(); refreshFilename(false); }
|
||||
});
|
||||
|
||||
// ---- Save -----------------------------------------------------------
|
||||
function save() {
|
||||
var content = editor.value;
|
||||
if (!content.trim()) { toast("Nichts zu speichern.", true); return; }
|
||||
if (!content.trim()) { toast("Nichts zu speichern.", true); flashEditor(); return; }
|
||||
var name = (filename.value.trim() || computeFilename(content));
|
||||
name = name.replace(/[\/\\:*?"<>|]+/g, "-").replace(/\s+/g, "-");
|
||||
if (!/\.md$/i.test(name)) name += ".md";
|
||||
@@ -396,15 +605,15 @@ Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
var blob = new Blob([content], { type: "text/markdown;charset=utf-8" });
|
||||
var url = URL.createObjectURL(blob);
|
||||
var a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
a.href = url; a.download = name;
|
||||
document.body.appendChild(a); a.click(); document.body.removeChild(a);
|
||||
setTimeout(function () { URL.revokeObjectURL(url); }, 1000);
|
||||
toast("Gespeichert: " + name);
|
||||
toast("Gespeichert · " + name);
|
||||
}
|
||||
function flashEditor() {
|
||||
editor.style.borderColor = "var(--danger)";
|
||||
setTimeout(function () { editor.style.borderColor = ""; }, 500);
|
||||
}
|
||||
|
||||
document.getElementById("save").addEventListener("click", save);
|
||||
|
||||
// ---- Copy -----------------------------------------------------------
|
||||
@@ -430,8 +639,7 @@ Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
if (editor.value && !confirm("Editor wirklich leeren?")) return;
|
||||
editor.value = "";
|
||||
filenameEdited = false;
|
||||
srcInfo.textContent = "";
|
||||
refreshAll();
|
||||
hideSource(); setFnameTag(); refreshAll(false);
|
||||
editor.focus();
|
||||
});
|
||||
|
||||
@@ -441,14 +649,14 @@ Dann ⌘/Strg+S oder „Speichern“."></textarea>
|
||||
if (mod && !e.shiftKey && !e.altKey && (e.key === "s" || e.key === "S")) {
|
||||
e.preventDefault(); save(); return;
|
||||
}
|
||||
// Arm a raw paste for the next paste event.
|
||||
if (mod && e.shiftKey && (e.key === "v" || e.key === "V")) {
|
||||
forceRaw = true; // paste handler consumes and resets it
|
||||
forceRaw = true;
|
||||
}
|
||||
});
|
||||
|
||||
// ---- Init -----------------------------------------------------------
|
||||
refreshAll();
|
||||
setFnameTag();
|
||||
refreshAll(false);
|
||||
editor.focus();
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user