feat(materials): сохранять доску/фрагмент прямо на онлайн-уроке

Выделение области и сохранение страницы доски теперь доступны ученику ВО ВРЕМЯ живого урока
(classroom.html), не только в просмотре прошлых уроков.

- Вынес общий модуль /js/board-clip.js (BoardClip.savePage / saveRegion + кроп-оверлей),
  переиспользуется в classroom.html и my-lessons.html (убрал дубль ~120 строк из my-lessons).
- classroom.html: кнопки «Область» и «К себе» в ученической панели (#cr-student-nav),
  обёртки crSaveBoardPage/crSaveBoardRegion над живым _wb + контекст сессии.
- Бэкенд без изменений (используется существующий /api/files + /api/materials).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-06-04 11:48:51 +03:00
parent 116876d8ec
commit fcb8ef77bd
3 changed files with 188 additions and 132 deletions
+18
View File
@@ -2382,6 +2382,12 @@
<svg class="fs-exit" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="10" y1="14" x2="3" y2="21"/><line x1="21" y1="3" x2="14" y2="10"/></svg>
<span id="cr-fs-label">На весь экран</span>
</button>
<button class="cr-tool-btn" onclick="crSaveBoardRegion(this)" title="Сохранить часть доски в «Мои материалы»">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 2v14a2 2 0 0 0 2 2h14"/><path d="M18 22V8a2 2 0 0 0-2-2H2"/></svg>
</button>
<button class="cr-tool-btn" onclick="crSaveBoardPage(this)" title="Сохранить страницу доски в «Мои материалы»">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>
</button>
</div>
<!-- toolbar: teacher only -->
<div class="cr-toolbar" id="cr-toolbar" style="display:none">
@@ -3084,6 +3090,7 @@
<script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" crossorigin="anonymous" />
<script src="/js/whiteboard.js"></script>
<script src="/js/board-clip.js"></script>
<script src="/js/classroom-rtc.js"></script>
<script src="/js/api.js"></script>
<script src="/js/sound.js"></script>
@@ -6617,6 +6624,17 @@
document.addEventListener('fullscreenchange', _updateStudentFsBtn);
document.addEventListener('webkitfullscreenchange', _updateStudentFsBtn);
/* ── Сохранить доску/фрагмент в «Мои материалы» (ученик) ── */
function _crClipMeta() {
return {
sourceSessionId: _sessionId,
sourceTitle: (_session && _session.title) || 'Онлайн-урок',
pageNum: (typeof _wbCurrentPage !== 'undefined' ? _wbCurrentPage : null),
};
}
function crSaveBoardPage(btn) { if (window.BoardClip) BoardClip.savePage(_wb, _crClipMeta(), btn); }
function crSaveBoardRegion(btn) { if (window.BoardClip) BoardClip.saveRegion(_wb, _crClipMeta(), btn); }
/* ── Student page nav / follow ── */
async function wbStudentPrevPage() {
if (_wbCurrentPage <= 1) return;