diff --git a/src/css/injected.scss b/src/css/injected.scss index 11bc6e5c..bbace617 100644 --- a/src/css/injected.scss +++ b/src/css/injected.scss @@ -1469,6 +1469,35 @@ html.transparencyEffects color: var(--text-primary) !important; box-shadow: none; } + +// Engage lesson/course Lexical editor ships inline light-mode colours on canvas + text nodes. +[class*="Canvas__canvas___"] { + background-color: transparent !important; + background-image: none !important; + color: var(--text-primary) !important; +} + +[class*="LexicalEditor__editor-container___"], +[class*="LexicalEditor__editor-inner___"], +[class*="LexicalEditor__editor-input___"], +[class*="LexicalEditor__editor-paragraph___"], +[class*="LexicalEditor__editor-text-bold___"], +[class*="LexicalEditor__editor-text-italic___"], +[class*="LexicalEditor__editor-text-underline___"], +[class*="TextModuleBody__lexicalEditor___"] { + color: var(--text-primary) !important; +} + +[class*="Module__module___"], +[class*="Module__content___"] { + background: transparent !important; + color: inherit !important; +} + +.dark [class*="LexicalEditor__editor-input___"] img[data-lexical-decorator] { + filter: invert(1) hue-rotate(180deg); +} + .course .composer { background: transparent !important; overflow: hidden; diff --git a/src/resources/update-video.webm b/src/resources/update-video.webm index e4f8dc9c..1bde0bc5 100644 Binary files a/src/resources/update-video.webm and b/src/resources/update-video.webm differ diff --git a/src/seqta/ui/sidebar/mountCustomSidebar.ts b/src/seqta/ui/sidebar/mountCustomSidebar.ts index 156e6e46..442fcd26 100644 --- a/src/seqta/ui/sidebar/mountCustomSidebar.ts +++ b/src/seqta/ui/sidebar/mountCustomSidebar.ts @@ -128,8 +128,8 @@ function onCustomSidebarCaptureClick(event: MouseEvent) { } const key = li.dataset.key; - if (!key) return; - const item = sidebarState.findByKey(key); + const path = li.dataset.path; + const item = sidebarState.resolveItem(key, path); if (item) sidebarState.activateItem(item, menuEl); } diff --git a/src/seqta/ui/sidebar/parseNativeMenu.test.ts b/src/seqta/ui/sidebar/parseNativeMenu.test.ts index 45f1ba3c..62462a20 100644 --- a/src/seqta/ui/sidebar/parseNativeMenu.test.ts +++ b/src/seqta/ui/sidebar/parseNativeMenu.test.ts @@ -1,7 +1,11 @@ /** * @jest-environment jsdom */ -import { getPagePathFromHash, parseNativeMenu } from "./parseNativeMenu"; +import { + findNativeMenuEntry, + getPagePathFromHash, + parseNativeMenu, +} from "./parseNativeMenu"; describe("parseNativeMenu", () => { it("parses top-level items and nested folders", () => { @@ -67,4 +71,46 @@ describe("parseNativeMenu", () => { expect(items.map((i) => i.key)).toEqual(["home"]); }); + + it("findNativeMenuEntry prefers path over duplicate data-key", () => { + document.body.innerHTML = ` +
+ `; + + const menu = document.getElementById("menu")!; + const course = findNativeMenuEntry(menu, { + key: "4804:11066", + id: null, + path: "/courses/4804:11066", + label: "Course", + }); + const assessments = findNativeMenuEntry(menu, { + key: "4804:11066", + id: null, + path: "/assessments/4804:11066", + label: "Assessments", + }); + + expect(course?.dataset.path).toBe("/courses/4804:11066"); + expect(assessments?.dataset.path).toBe("/assessments/4804:11066"); + }); }); diff --git a/src/seqta/ui/sidebar/parseNativeMenu.ts b/src/seqta/ui/sidebar/parseNativeMenu.ts index c05be243..2ce6369c 100644 --- a/src/seqta/ui/sidebar/parseNativeMenu.ts +++ b/src/seqta/ui/sidebar/parseNativeMenu.ts @@ -97,13 +97,6 @@ export function findNativeMenuEntry( if (byId instanceof HTMLElement) return byId; } - if (item.key) { - const byKey = list.querySelector( - `li[data-key="${CSS.escape(item.key)}"], section[data-key="${CSS.escape(item.key)}"]`, - ); - if (byKey instanceof HTMLElement) return byKey; - } - if (item.path) { const byPath = list.querySelector( `li[data-path="${CSS.escape(item.path)}"], section[data-path="${CSS.escape(item.path)}"]`, @@ -111,6 +104,13 @@ export function findNativeMenuEntry( if (byPath instanceof HTMLElement) return byPath; } + if (item.key) { + const byKey = list.querySelector( + `li[data-key="${CSS.escape(item.key)}"], section[data-key="${CSS.escape(item.key)}"]`, + ); + if (byKey instanceof HTMLElement) return byKey; + } + if (item.label) { const candidates = list.querySelectorAll