Fix note-field space bar hijacking video, rework Outline topics as documents

- Lesson page's global keyboard shortcuts (space/arrows for play-pause/
  seek/volume) fired regardless of focus, so typing a space in the notes
  textarea toggled the video instead of typing. Now skipped entirely
  whenever a text field/select has focus.
- Outline topics no longer spawn their own top-level collection each time.
  A topic is now a document inside one fixed, user-configured collection
  (Settings -> Outline Integration -> Default collection), and a lesson's
  note becomes a child document nested under its topic - matching how
  notes actually get organized in a real Outline instance instead of
  cluttering the collections list with one per topic.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-22 12:27:00 -04:00
co-authored by Claude Sonnet 5
parent 5fe3fafc7a
commit 145f91a647
4 changed files with 168 additions and 36 deletions
+13 -4
View File
@@ -606,11 +606,11 @@
const topicStatus = document.getElementById('outline-topic-status');
if (topicSelect) {
fetch('/api/outline/collections')
fetch('/api/outline/topics')
.then(r => r.json())
.then(data => {
const newOption = topicSelect.querySelector('option[value="__new__"]');
(data.collections || []).forEach(function(c) {
(data.topics || []).forEach(function(c) {
const opt = document.createElement('option');
opt.value = c.id;
opt.textContent = c.name;
@@ -624,7 +624,7 @@
newTopicInput.value = INITIAL_TOPIC_NAME;
}
if (data.error && topicStatus) {
topicStatus.textContent = 'Outline not reachable - topic list may be incomplete';
topicStatus.textContent = data.error;
}
})
.catch(() => {});
@@ -805,8 +805,17 @@
}, 3000);
}
// Keyboard shortcuts
// Keyboard shortcuts - skip while typing in the note (or any
// other text field), so space/arrow keys type normally instead
// of hijacking video playback.
function isTypingTarget(el) {
if (!el) return false;
const tag = el.tagName;
return tag === 'TEXTAREA' || tag === 'INPUT' || tag === 'SELECT' || el.isContentEditable;
}
document.addEventListener('keydown', function(e) {
if (isTypingTarget(e.target)) return;
if (activeMedia && !e.ctrlKey && !e.altKey && !e.metaKey) {
switch(e.key) {
case ' ':