Files
texrra-engine/examples/native_editor/index.html
T

55 lines
2.3 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Texrra 原生预览</title>
<style>
:root {
color-scheme: light;
font: 15px/1.5 system-ui, sans-serif;
color: #17222d;
background: #e9edf0;
}
* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-rows: auto 1fr; height: 100dvh; }
header {
display: flex; align-items: center; justify-content: space-between; gap: 1rem;
padding: .8rem 1.2rem; background: #152635; color: #f4f6f8;
}
header strong { letter-spacing: .02em; }
header a { color: #bde5ff; }
main { display: grid; grid-template-columns: minmax(270px, 5fr) minmax(300px, 7fr); min-height: 0; }
.edit { min-height: 0; display: grid; grid-template-rows: auto 1fr; background: white; }
.file { padding: .6rem 1rem; border-bottom: 1px solid #d9e0e6; font: 14px/1.5 ui-monospace, monospace; }
textarea {
width: 100%; height: 100%; resize: none; padding: 1rem; border: 0;
color: inherit; background: #fcfdfe; font: 14px/1.6 ui-monospace, monospace;
}
textarea:focus-visible { outline: 2px solid #1972a4; outline-offset: -2px; }
.preview { overflow: auto; padding: clamp(.65rem, 2vw, 1.5rem); }
.pages { display: grid; grid-template-columns: minmax(0, 820px); justify-content: center; gap: .9rem; }
.pages img { display: block; width: 100%; background: white; box-shadow: 0 2px 8px #2436452a; }
#error { white-space: pre-wrap; background: #fff0ec; color: #832619; padding: .85rem; }
@media (max-width: 700px) {
main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(180px, 2fr) minmax(200px, 3fr); }
header { flex-wrap: wrap; gap: .3rem 1rem; }
}
</style>
<header>
<strong>Texrra 原生预览</strong>
<span id="status" role="status">正在打开文档</span>
<a id="pdf" download hidden>下载 PDF</a>
</header>
<main>
<section class="edit" aria-label="源文件">
<label class="file" for="source" id="name">源文件</label>
<textarea id="source" spellcheck="false" disabled></textarea>
</section>
<section class="preview" aria-label="页面预览">
<pre id="error" role="alert" hidden></pre>
<div class="pages" id="pages"></div>
</section>
</main>
<script type="module" src="/app.js"></script>
</html>