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:
@@ -11,6 +11,7 @@
|
||||
<script th:src="@{/js/htmx.min.js}" defer></script>
|
||||
<script th:src="@{/js/highlight.min.js}" defer></script>
|
||||
<script th:src="@{/js/tablekit.js}" defer></script>
|
||||
<script th:src="@{/js/ui-state.js}" defer></script>
|
||||
<script>
|
||||
(function(){
|
||||
var t = localStorage.getItem('lms-theme') || 'light';
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
Перетаскивайте за значок ⠿, чтобы менять порядок глав, разделов и статей, а также
|
||||
переносить разделы в другую главу и статьи — в другой раздел.
|
||||
</div>
|
||||
<div th:if="${currentUser != null and currentUser.admin}" id="sort-status" class="sort-status" hidden>
|
||||
<span id="sort-status-text">Изменения не сохранены…</span>
|
||||
</div>
|
||||
|
||||
<div th:if="${notice}" class="alert alert-success" th:text="${notice}"></div>
|
||||
<div th:if="${error}" class="alert alert-error" th:text="${error}"></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user