diff --git a/internal/web/static/app.css b/internal/web/static/app.css index 5a9a411..d8dff25 100644 --- a/internal/web/static/app.css +++ b/internal/web/static/app.css @@ -237,6 +237,11 @@ body { .theme-card .swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15); } .theme-name { font-weight: 600; } .iconbtn:hover { color: var(--fg); border-color: var(--muted); } +/* #130: line wrap toggle, accent when active like other toggles */ +.iconbtn.wrap-toggle[aria-pressed="true"], +.btn-icon.wrap-toggle[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); } +html[data-wrap] .codebody { white-space: pre-wrap; } +html[data-wrap] .editor { white-space: pre-wrap; } .iconbtn.danger:hover { color: #ff8fa3; border-color: #ff8fa3; } .code-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; diff --git a/internal/web/templates/layout.html b/internal/web/templates/layout.html index 46337d6..ae1162b 100644 --- a/internal/web/templates/layout.html +++ b/internal/web/templates/layout.html @@ -46,6 +46,37 @@ // do not persist anything here: URL theme is a one-off override document.documentElement.dataset.preset = dark ? PAIRS[t].dark : PAIRS[t].light; })(); +// #130: shared line wrap preference (localStorage 'palette-wrap', default off) +(function () { + function wrapOn() { + try { return localStorage.getItem('palette-wrap') === '1'; } catch (e) { return false; } + } + function wrapApply(on) { + if (on) document.documentElement.setAttribute('data-wrap', '1'); + else document.documentElement.removeAttribute('data-wrap'); + document.querySelectorAll('.wrap-toggle').forEach(function (b) { + b.setAttribute('aria-pressed', on ? 'true' : 'false'); + }); + var s = document.getElementById('wrap-setting'); + if (s) s.checked = on; + } + window.paletteWrapToggle = function () { + var on = !wrapOn(); + try { localStorage.setItem('palette-wrap', on ? '1' : '0'); } catch (e) {} + wrapApply(on); + return on; + }; + document.addEventListener('DOMContentLoaded', function () { + wrapApply(wrapOn()); + document.querySelectorAll('.wrap-toggle').forEach(function (b) { + b.addEventListener('click', function () { window.paletteWrapToggle(); }); + }); + var s = document.getElementById('wrap-setting'); + if (s) s.addEventListener('change', function () { + if (s.checked !== wrapOn()) window.paletteWrapToggle(); + }); + }); +})(); {{end}} diff --git a/internal/web/templates/new.html b/internal/web/templates/new.html index 7e334be..bd299a4 100644 --- a/internal/web/templates/new.html +++ b/internal/web/templates/new.html @@ -16,6 +16,7 @@ +
diff --git a/internal/web/templates/paste.html b/internal/web/templates/paste.html index cfca561..1858aaa 100644 --- a/internal/web/templates/paste.html +++ b/internal/web/templates/paste.html @@ -6,6 +6,7 @@

{{if .Title}}{{.Title}}{{else}}Untitled paste{{end}}

{{if .CustomSlug}}/{{.CustomSlug}}{{end}}
+ raw copy {{if .DeletionToken}}delete{{end}} diff --git a/internal/web/templates/settings.html b/internal/web/templates/settings.html index f3c195d..fdb481d 100644 --- a/internal/web/templates/settings.html +++ b/internal/web/templates/settings.html @@ -13,6 +13,8 @@ Dark mode +

Editor

+