Content sort: autosave without reload; keep page state across reloads

- drag & drop now saves in the background (700 ms debounce) without reloading:
  sections stay open, scroll position is kept; on failure it retries every 3 s,
  and navigator.sendBeacon flushes unsaved changes on page leave
- removed the explicit save button (autosave only), status indicator shows
  «Изменения не сохранены… / Сохранение… / Порядок сохранён»
- new global ui-state.js: restores open <details> and scroll position after any
  reload/redirect within the same page (applies to all pages, not just /learn)
- auto-expand a collapsed chapter/section while hovering during drag
This commit is contained in:
2026-09-16 19:00:03 +03:00
parent 6ba5efa02d
commit d24e92005a
5 changed files with 157 additions and 21 deletions

View File

@@ -357,3 +357,13 @@ th.th-filterable { padding-bottom: 0.35rem; }
.drop-before { box-shadow: 0 -3px 0 0 var(--c-text); }
.drop-after { box-shadow: 0 3px 0 0 var(--c-text); }
.drop-into { outline: 2px dashed var(--c-border); outline-offset: 3px; border-radius: 0.35rem; }
/* индикатор сохранения порядка материалов */
.sort-status {
position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
display: flex; align-items: center; gap: 0.6rem;
max-width: min(24rem, calc(100vw - 2rem));
background: var(--c-surface); border: 1px solid var(--c-border);
border-radius: 0.5rem; padding: 0.5rem 0.75rem;
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15); font-size: 0.85rem;
}