Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
226 lines
6.2 KiB
Go Template
226 lines
6.2 KiB
Go Template
{{ define "preview.gohtml" }}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Preview</title>
|
|
|
|
<link rel="stylesheet" href="/static/css/theme/base.css">
|
|
<link rel="stylesheet" href="/static/css/content-viewer.css">
|
|
<link rel="stylesheet" href="{{ .ThemeCSS }}">
|
|
<script defer src="/static/js/content-viewer.js"></script>
|
|
<script type="module" src="/static/js/code-highlight.js?v=1"></script>
|
|
|
|
<style>
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background: var(--bg);
|
|
color: var(--fg);
|
|
}
|
|
|
|
.preview-body {
|
|
padding: 1rem;
|
|
font-size: 0.95rem;
|
|
line-height: 1.55;
|
|
}
|
|
|
|
.preview-path {
|
|
margin-bottom: 0.75rem;
|
|
color: var(--muted);
|
|
font-family: "JetBrains Mono", monospace;
|
|
font-size: 0.82rem;
|
|
}
|
|
|
|
.preview-content {
|
|
overflow-wrap: anywhere;
|
|
}
|
|
|
|
.preview-content img {
|
|
max-width: 100%;
|
|
}
|
|
|
|
.preview-content pre {
|
|
overflow: auto;
|
|
padding: 0.75rem;
|
|
border: 1px solid var(--border-soft);
|
|
border-radius: 0.35rem;
|
|
background: var(--panel);
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
.preview-media,
|
|
.preview-pdf {
|
|
display: block;
|
|
width: 100%;
|
|
}
|
|
|
|
.preview-media {
|
|
max-height: calc(100vh - 6rem);
|
|
object-fit: contain;
|
|
}
|
|
|
|
.preview-pdf {
|
|
min-height: calc(100vh - 6rem);
|
|
border: 0;
|
|
}
|
|
|
|
.preview-table-wrap {
|
|
max-height: calc(100vh - 6rem);
|
|
overflow: auto;
|
|
}
|
|
|
|
.preview-table {
|
|
width: max-content;
|
|
min-width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.preview-table th,
|
|
.preview-table td {
|
|
padding: 0.3rem 0.5rem;
|
|
border: 1px solid var(--border-soft);
|
|
text-align: left;
|
|
}
|
|
|
|
.preview-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.preview-entry {
|
|
display: grid;
|
|
grid-template-columns: 1.4rem 1fr auto;
|
|
gap: 0.45rem;
|
|
align-items: center;
|
|
padding: 0.28rem 0.15rem;
|
|
border-bottom: 1px solid var(--border-soft);
|
|
text-decoration: none;
|
|
color: var(--fg);
|
|
}
|
|
|
|
.preview-entry:hover {
|
|
background: var(--row-hover);
|
|
}
|
|
|
|
.preview-icon {
|
|
color: var(--link);
|
|
}
|
|
|
|
.preview-icon.dir {
|
|
color: var(--accent);
|
|
}
|
|
|
|
.preview-name {
|
|
font-family: "JetBrains Mono", monospace;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.preview-meta {
|
|
color: var(--muted);
|
|
font-size: 0.82rem;
|
|
white-space: nowrap;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<main class="preview-body">
|
|
|
|
<div class="preview-path">
|
|
{{ .Path }}
|
|
</div>
|
|
|
|
{{ if .IsListing }}
|
|
|
|
<h3>Index</h3>
|
|
|
|
<div class="preview-list">
|
|
|
|
{{ range .Entries }}
|
|
|
|
<a
|
|
class="preview-entry"
|
|
href="{{ if .IsDir }}/v/browser{{ .Path }}{{ else }}{{ .Path }}{{ end }}"
|
|
target="_top"
|
|
>
|
|
|
|
<span class="preview-icon {{ if .IsDir }}dir{{ end }}">
|
|
{{ if .IsDir }}📁{{ else }}📄{{ end }}
|
|
</span>
|
|
|
|
<span class="preview-name">
|
|
{{ .Name }}
|
|
</span>
|
|
|
|
<span class="preview-meta">
|
|
{{ if .IsDir }}
|
|
{{ .ChildCount }} items
|
|
{{ else }}
|
|
{{ formatBytes .Size }}
|
|
{{ end }}
|
|
</span>
|
|
|
|
</a>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
{{ else }}
|
|
|
|
<article class="preview-content">
|
|
{{ if eq .ContentView.Kind "html" }}
|
|
{{ .RenderedHTML }}
|
|
{{ else if eq .ContentView.Kind "excalidraw" }}
|
|
{{ if .ContentView.ExcalidrawValid }}
|
|
<div class="excalidraw-plugin-host" data-excalidraw-plugin-host>
|
|
<iframe class="excalidraw-plugin-frame" data-excalidraw-plugin src="/_/adaptor/excalidraw/?url={{ .ContentView.RawURL | urlquery }}" sandbox="allow-scripts allow-same-origin" referrerpolicy="no-referrer" title="{{ .ContentView.Filename }}"></iframe>
|
|
<div class="excalidraw-viewer" data-excalidraw-viewer data-excalidraw-fallback hidden>
|
|
<div class="excalidraw-toolbar"><button type="button" data-excalidraw-fit>{{ T "viewer.fit_screen" }}</button></div>
|
|
<canvas data-excalidraw-canvas tabindex="0" aria-label="{{ .ContentView.Filename }}"></canvas>
|
|
<textarea data-excalidraw-source hidden>{{ .ContentView.Text }}</textarea>
|
|
</div>
|
|
</div>
|
|
{{ else }}<p>{{ .ContentView.ParseError }}</p><pre><code>{{ .ContentView.Text }}</code></pre>{{ end }}
|
|
{{ else if eq .ContentView.Kind "csv" }}
|
|
<div class="preview-table-wrap"><table class="preview-table">
|
|
{{ range $rowIndex, $row := .ContentView.CSVRows }}
|
|
<tr>{{ range $row }}{{ if eq $rowIndex 0 }}<th>{{ . }}</th>{{ else }}<td>{{ . }}</td>{{ end }}{{ end }}</tr>
|
|
{{ end }}
|
|
</table></div>
|
|
{{ if .ContentView.CSVTruncated }}<p>{{ T "viewer.csv_truncated" }}</p>{{ end }}
|
|
{{ else if eq .ContentView.Kind "code" }}
|
|
<pre data-window-url="{{ .ContentView.WindowURL }}" data-next-offset="{{ .ContentView.NextOffset }}"><code>{{ .ContentView.Text }}</code></pre>
|
|
{{ else if eq .ContentView.Kind "image" }}
|
|
<img class="preview-media" src="{{ .ContentView.RawURL }}" alt="{{ .ContentView.Filename }}">
|
|
{{ else if eq .ContentView.Kind "audio" }}
|
|
<audio class="preview-media" controls preload="metadata" src="{{ .ContentView.RawURL }}"></audio>
|
|
{{ else if eq .ContentView.Kind "video" }}
|
|
<video class="preview-media" controls playsinline preload="metadata" src="{{ .ContentView.RawURL }}"></video>
|
|
{{ else if eq .ContentView.Kind "pdf" }}
|
|
<iframe class="preview-pdf" src="{{ .ContentView.RawURL }}" title="{{ .ContentView.Filename }}"></iframe>
|
|
{{ else if eq .ContentView.Kind "archive" }}
|
|
<div data-archive-metadata data-metadata-url="{{ .ContentView.MetadataURL }}" data-metadata-status="{{ .ContentView.MetadataStatus }}" data-loading-label="{{ T "viewer.metadata_pending" }}" data-failed-label="{{ T "viewer.metadata_failed" }}" data-unavailable-label="{{ T "viewer.metadata_unavailable" }}" data-truncated-label="{{ T "viewer.archive_truncated" }}">
|
|
<p data-projection-status aria-live="polite">{{ if eq .ContentView.MetadataStatus "pending" }}{{ T "viewer.metadata_pending" }}{{ else if eq .ContentView.MetadataStatus "failed" }}{{ T "viewer.metadata_failed" }}{{ else if eq .ContentView.MetadataStatus "unavailable" }}{{ T "viewer.metadata_unavailable" }}{{ else }}{{ .ContentView.ParseError }}{{ end }}</p><button type="button" data-projection-retry hidden>{{ T "config.retry" }}</button>
|
|
<table class="preview-table"><thead><tr><th>{{ T "viewer.entry" }}</th><th>{{ T "viewer.size" }}</th></tr></thead><tbody data-archive-entries>{{ range .ContentView.ArchiveEntries }}<tr><td><a href="{{ .URL }}">{{ .Name }}</a></td><td>{{ .Size }}</td></tr>{{ end }}</tbody></table>
|
|
</div>
|
|
{{ else }}
|
|
<p>{{ .ContentView.Filename }}</p>
|
|
<a href="{{ .ContentView.RawURL }}" download="{{ .ContentView.Filename }}">Download</a>
|
|
{{ end }}
|
|
</article>
|
|
|
|
{{ end }}
|
|
|
|
</main>
|
|
|
|
</body>
|
|
</html>
|
|
{{ end }}
|