Fix editor full-screen and add parent-side doc viewer
Build and Push Docker Image / build-and-push (push) Successful in 45s
Build and Push Docker Image / build-and-push (push) Successful in 45s
Student editor: - Add body.docs-editor-open class when editor opens; hide hero, nav, confetti so nothing bleeds behind the fixed overlay Admin docs panel: - New "Documents" sidebar entry listing all submitted docs with student name, date, and unread badge - Click any doc to open it in OnlyOffice in view (read-only) mode - Download button for offline access - /api/docs/bykey/:key/editor-config server route for admin viewer Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6a5ac46294
commit
ad3e0bc7be
5 files changed
+128
-2
No files matched your search
@@ -2546,6 +2546,20 @@ app.get('/api/docs/config', (req, res) => {
|
||||
res.json({ onlyofficeUrl: ONLYOFFICE_URL, serverUrl: SERVER_URL });
|
||||
});
|
||||
|
||||
// Returns a fully-signed OnlyOffice editor config — lookup by doc key (for admin)
|
||||
app.get('/api/docs/bykey/:key/editor-config', (req, res) => {
|
||||
const doc = db.prepare(`SELECT d.*, s.name AS student_name FROM documents d JOIN students s ON s.id = d.student_id WHERE d.doc_key = ?`).get(req.params.key);
|
||||
if (!doc) return res.status(404).json({ error: 'Not found' });
|
||||
const config = {
|
||||
document: { fileType: 'docx', key: doc.doc_key, title: doc.title, url: `${SERVER_URL}/api/docs/file/${doc.filename}`, permissions: { edit: false, download: true, print: true } },
|
||||
editorConfig: { user: { id: 'parent', name: 'Parent' }, mode: 'view', lang: 'en', customization: { logo: { visible: false }, compactHeader: true, toolbarNoTabs: true } },
|
||||
type: 'desktop', height: '100%', width: '100%',
|
||||
};
|
||||
const token = jwtSign(config);
|
||||
if (token) config.token = token;
|
||||
res.json({ onlyofficeUrl: ONLYOFFICE_URL, config });
|
||||
});
|
||||
|
||||
// Returns a fully-signed OnlyOffice editor config for a specific document
|
||||
app.get('/api/docs/:id/editor-config', (req, res) => {
|
||||
const doc = db.prepare(`SELECT d.*, s.name AS student_name FROM documents d JOIN students s ON s.id = d.student_id WHERE d.id = ?`).get(req.params.id);
|
||||
|
||||
Reference in new issue
Block a user