h / templates /edit.html
Xlnk's picture
Upload 13 files
e767f32 verified
<!DOCTYPE html>
<html>
<head>
<title>Edit {{file}} | h by Xlnk</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fira+Code:wght@400;500&display=swap"
rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0d0d1f 100%);
min-height: 100vh;
font-family: 'Inter', system-ui, sans-serif;
color: #e2e8f0;
}
.navbar {
background: rgba(15, 23, 42, 0.9);
backdrop-filter: blur(20px);
border-bottom: 1px solid rgba(99, 102, 241, 0.2);
padding: 16px 30px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.nav-brand {
font-size: 1.5rem;
font-weight: 700;
background: linear-gradient(135deg, #818cf8, #c084fc);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
text-decoration: none;
}
.nav-links {
display: flex;
gap: 20px;
align-items: center;
}
.nav-links a {
color: #94a3b8;
text-decoration: none;
font-size: 0.9rem;
transition: color 0.3s ease;
}
.nav-links a:hover {
color: #818cf8;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 30px 20px;
}
.breadcrumb {
margin-bottom: 20px;
color: #64748b;
}
.breadcrumb a {
color: #818cf8;
text-decoration: none;
transition: color 0.3s ease;
}
.breadcrumb a:hover {
color: #a5b4fc;
}
.flash-messages {
margin-bottom: 20px;
}
.flash {
padding: 12px 16px;
border-radius: 12px;
font-size: 0.9rem;
margin-bottom: 10px;
animation: slideIn 0.3s ease;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.flash.error {
background: rgba(239, 68, 68, 0.15);
border: 1px solid rgba(239, 68, 68, 0.3);
color: #fca5a5;
}
.flash.success {
background: rgba(34, 197, 94, 0.15);
border: 1px solid rgba(34, 197, 94, 0.3);
color: #86efac;
}
.editor-wrap {
background: rgba(15, 23, 42, 0.8);
backdrop-filter: blur(20px);
border: 1px solid rgba(99, 102, 241, 0.15);
border-radius: 16px;
overflow: hidden;
}
.toolbar {
background: rgba(30, 41, 59, 0.8);
padding: 14px 20px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}
.file-path {
font-family: 'Fira Code', monospace;
color: #94a3b8;
font-size: 0.9rem;
}
textarea {
width: 100%;
height: calc(100vh - 280px);
min-height: 400px;
background: rgba(10, 15, 30, 0.6);
color: #e2e8f0;
border: none;
padding: 20px;
font-family: 'Fira Code', monospace;
font-size: 14px;
line-height: 1.6;
resize: vertical;
outline: none;
}
textarea:focus {
background: rgba(10, 15, 30, 0.8);
}
.actions {
display: flex;
gap: 10px;
}
.btn {
padding: 10px 18px;
border-radius: 10px;
border: none;
cursor: pointer;
font-weight: 600;
font-family: inherit;
font-size: 0.85rem;
transition: all 0.3s ease;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 6px;
}
.btn-save {
background: linear-gradient(135deg, #22c55e, #16a34a);
color: white;
}
.btn-save:hover {
transform: translateY(-2px);
box-shadow: 0 10px 30px rgba(34, 197, 94, 0.4);
}
.btn-cancel {
background: rgba(100, 116, 139, 0.2);
border: 1px solid rgba(100, 116, 139, 0.3);
color: #94a3b8;
}
.btn-cancel:hover {
background: rgba(100, 116, 139, 0.3);
color: #e2e8f0;
}
.btn-preview {
background: rgba(99, 102, 241, 0.2);
border: 1px solid rgba(99, 102, 241, 0.3);
color: #a5b4fc;
}
.btn-preview:hover {
background: rgba(99, 102, 241, 0.3);
}
.shortcut-hint {
color: #64748b;
font-size: 0.75rem;
text-align: center;
padding: 10px;
border-top: 1px solid rgba(99, 102, 241, 0.1);
}
.glow-orb {
position: fixed;
width: 400px;
height: 400px;
border-radius: 50%;
filter: blur(100px);
opacity: 0.15;
pointer-events: none;
z-index: -1;
}
.orb-1 {
background: #6366f1;
top: 30%;
right: -100px;
}
</style>
</head>
<body>
<div class="glow-orb orb-1"></div>
<nav class="navbar">
<a href="/my-sites" class="nav-brand">h by Xlnk</a>
<div class="nav-links">
<a href="/files/{{site_id}}">Back to Files</a>
<a href="/my-sites">My Sites</a>
</div>
</nav>
<div class="container">
<div class="breadcrumb">
<a href="/my-sites">My Sites</a> / <a href="/manage/{{site_id}}">{{site_id}}</a> / <a
href="/files/{{site_id}}">Files</a> /
<strong>{{file}}</strong>
</div>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-messages">
{% for category, message in messages %}
<div class="flash {{ category }}">{{ message }}</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<form method="post" action="/save/{{site_id}}/{{file}}">
<div class="editor-wrap">
<div class="toolbar">
<span class="file-path">📄 {{file}}</span>
<div class="actions">
<a href="/h/{{site_id}}/{{file}}" target="_blank" class="btn btn-preview">👁️ Preview</a>
<a href="/files/{{site_id}}" class="btn btn-cancel">Cancel</a>
<button type="submit" class="btn btn-save">💾 Save</button>
</div>
</div>
<textarea name="content" spellcheck="false" autofocus>{{content}}</textarea>
<div class="shortcut-hint">
💡 Press <strong>Ctrl+S</strong> to save | Use <strong>Tab</strong> to indent
</div>
</div>
</form>
</div>
<script>
// Ctrl+S to save
document.addEventListener('keydown', function (e) {
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
e.preventDefault();
document.querySelector('form').submit();
}
});
// Tab key support in textarea
document.querySelector('textarea').addEventListener('keydown', function (e) {
if (e.key === 'Tab') {
e.preventDefault();
const start = this.selectionStart;
const end = this.selectionEnd;
this.value = this.value.substring(0, start) + ' ' + this.value.substring(end);
this.selectionStart = this.selectionEnd = start + 2;
}
});
</script>
</body>
</html>