feat(lessons): «Мои материалы» — ученик сохраняет материалы урока к себе
Ученик на странице «Мои уроки» может сохранить к себе страницу доски (PNG) и свою заметку из прошлой онлайн-сессии. Копия хранится у ученика и переживает удаление сессии учителем. - Миграция 060: student_materials (kind board/note/link/image, denormalized source_title, source_session_id ON DELETE SET NULL). - API /api/materials (GET/POST/DELETE, авторизация + проверка владельца) + helpers в js/api.js. - my-lessons.html: кнопки «К себе» на доске и заметке (Whiteboard.exportBlob → /api/files → saveMaterial). - Новая страница /my-materials (просмотр/открыть/скачать/удалить) + пункт сайдбара (ученик). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3595,6 +3595,22 @@ class Whiteboard {
|
||||
}, 'image/png');
|
||||
}
|
||||
|
||||
/* Same composite as exportPNG, but hands the PNG Blob to a callback
|
||||
(used to save a board page into the student's personal materials). */
|
||||
exportBlob(cb) {
|
||||
const off = document.createElement('canvas');
|
||||
off.width = Whiteboard.VW; off.height = Whiteboard.VH;
|
||||
const ctx = off.getContext('2d');
|
||||
const [sw, sh, sz, spx, spy] = [this._cssW, this._cssH, this._zoom, this._panVX, this._panVY];
|
||||
this._cssW = Whiteboard.VW; this._cssH = Whiteboard.VH;
|
||||
this._zoom = 1; this._panVX = 0; this._panVY = 0;
|
||||
this._renderBg(ctx);
|
||||
if (this._template && this._template !== 'blank') this._renderTemplate(ctx);
|
||||
for (const s of this._strokes) this._renderStroke(ctx, s);
|
||||
this._cssW = sw; this._cssH = sh; this._zoom = sz; this._panVX = spx; this._panVY = spy;
|
||||
off.toBlob(cb, 'image/png');
|
||||
}
|
||||
|
||||
_renderMinimap() {
|
||||
if (!this._mmCanvas) return;
|
||||
const visible = this._zoom > 1.04;
|
||||
|
||||
Reference in New Issue
Block a user