chore(collection/presentation): address requested changes

This commit is contained in:
Elian Doran 2025-10-16 15:32:16 +03:00
parent 04eeb28c09
commit 5d8ca1ecf7
No known key found for this signature in database
4 changed files with 12 additions and 21 deletions

View File

@ -439,7 +439,7 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
}
export function openInCurrentNoteContext(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent | React.PointerEvent<HTMLCanvasElement> | null, notePath: string, viewScope?: ViewScope) {
const ntxId = $(evt?.target as any)
const ntxId = $(evt?.target as Element)
.closest("[data-ntx-id]")
.attr("data-ntx-id");

View File

@ -119,11 +119,10 @@ function ButtonOverlay({ containerRef, api }: { containerRef: RefObject<HTMLDivE
function Presentation({ presentation, setApi } : { presentation: PresentationModel, setApi: (api: Reveal.Api | undefined) => void }) {
const containerRef = useRef<HTMLDivElement>(null);
const apiRef = useRef<Reveal.Api>(null);
const isFirstRenderRef = useRef(true);
const [revealApi, setRevealApi] = useState<Reveal.Api>();
useEffect(() => {
if (apiRef.current || !containerRef.current) return;
if (!containerRef.current) return;
const api = new Reveal(containerRef.current, {
transition: "slide",
@ -138,23 +137,20 @@ function Presentation({ presentation, setApi } : { presentation: PresentationMod
},
});
api.initialize().then(() => {
apiRef.current = api;
setRevealApi(revealApi);
setApi(api);
});
return () => {
api.destroy();
apiRef.current = null;
setRevealApi(undefined);
setApi(undefined);
}
}, [ ]);
}, []);
useEffect(() => {
if (!isFirstRenderRef.current) {
apiRef.current?.sync();
}
isFirstRenderRef.current = false;
}, [ presentation ]);
revealApi?.sync();
}, [ presentation, revealApi ]);
return (
<div ref={containerRef} className="reveal">

View File

@ -1,11 +1,6 @@
export const DEFAULT_THEME = "white";
interface ThemeDefinition {
name: string;
loadTheme: () => Promise<typeof import("*.css?raw")>;
}
const themes: Record<string, ThemeDefinition> = {
const themes = {
black: {
name: "Black",
loadTheme: () => import("reveal.js/dist/theme/black.css?raw")

View File

@ -359,7 +359,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);
if (item.content && note.getContent() !== item.content) {
console.log(`Updating content of ${item.id}.`);
log.info(`Updating content of ${item.id}.`);
note.setContent(item.content);
}
@ -369,7 +369,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
// If the note exists but doesn't have a branch in the expected parent,
// create the missing branch to ensure it's in the correct location
if (!branch) {
console.log("Creating missing branch for note", item.id, "under parent", parentNoteId);
log.info(`Creating missing branch for note ${item.id} under parent ${parentNoteId}.`);
branch = new BBranch({
noteId: item.id,
parentNoteId: parentNoteId,
@ -473,7 +473,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
}).save();
} else if (attr.name === "docName" || (existingAttribute.noteId.startsWith("_help") && attr.name === "iconClass")) {
if (existingAttribute.value !== attr.value) {
console.log(`Updating attribute ${attrId} from "${existingAttribute.value}" to "${attr.value}"`);
log.info(`Updating attribute ${attrId} from "${existingAttribute.value}" to "${attr.value}"`);
existingAttribute.value = attr.value ?? "";
existingAttribute.save();
}