css important may backfire

This commit is contained in:
JK 2026-06-04 21:31:18 +02:00
parent e427438d1f
commit 3dc3333ab6
3 changed files with 31 additions and 19 deletions

View file

@ -240,7 +240,8 @@ export const setOutline = async (doc: PDFDocument, outlines: readonly PDFOutline
for (let i = 0; i < length; i += 1) {
const outline = outlines[i];
const outlineRef = refMap.get(outline)!;
const outlineRef = refMap.get(outline);
if (!outlineRef) continue;
const destOrAction = (() => {
// if (typeof outline.to === 'string') {
@ -265,22 +266,29 @@ export const setOutline = async (doc: PDFDocument, outlines: readonly PDFOutline
if ('children' in outline && outline.children.length > 0) {
createOutline(outline.children, outlineRef);
return {
First: refMap.get(outline.children[0])!,
Last: refMap.get(outline.children[outline.children.length - 1])!,
Count: getOpeningCount(outline.children) * (outline.open ? 1 : -1)
};
const firstRef = refMap.get(outline.children[0]);
const lastRef = refMap.get(outline.children[outline.children.length - 1]);
if (firstRef && lastRef) {
return {
First: firstRef,
Last: lastRef,
Count: getOpeningCount(outline.children) * (outline.open ? 1 : -1)
};
}
}
return {};
})();
const prevRef = i > 0 ? refMap.get(outlines[i - 1]) : undefined;
const nextRef = i < length - 1 ? refMap.get(outlines[i + 1]) : undefined;
doc.context.assign(
outlineRef,
doc.context.obj({
Title: PDFHexString.fromText(outline.title),
Parent: parent,
...(i > 0 ? { Prev: refMap.get(outlines[i - 1])! } : {}),
...(i < length - 1 ? { Next: refMap.get(outlines[i + 1])! } : {}),
...(prevRef ? { Prev: prevRef } : {}),
...(nextRef ? { Next: nextRef } : {}),
...childrenDict,
...destOrAction,
F: (outline.italic ? 1 : 0) | (outline.bold ? 2 : 0)
@ -299,10 +307,11 @@ export const setOutline = async (doc: PDFDocument, outlines: readonly PDFOutline
doc.context.obj({
Type: 'Outlines',
...(rootCount > 0
? {
First: refMap.get(outlines[0])!,
Last: refMap.get(outlines[outlines.length - 1])!
}
? (() => {
const firstRef = refMap.get(outlines[0]);
const lastRef = refMap.get(outlines[outlines.length - 1]);
return firstRef && lastRef ? { First: firstRef, Last: lastRef } : {};
})()
: {}),
Count: rootCount
})

View file

@ -138,11 +138,12 @@ class TikzLivePreviewOverlay {
// Drag functionality
handleEl.onmousedown = (e: MouseEvent) => {
if (!this.overlayEl) return;
this.isDragging = true;
this.startX = e.clientX;
this.startY = e.clientY;
this.startLeft = this.overlayEl!.offsetLeft;
this.startTop = this.overlayEl!.offsetTop;
this.startLeft = this.overlayEl.offsetLeft;
this.startTop = this.overlayEl.offsetTop;
e.preventDefault();
};
@ -154,8 +155,10 @@ class TikzLivePreviewOverlay {
let newLeft = this.startLeft + dx;
let newTop = this.startTop + dy;
const maxLeft = doc.defaultView!.innerWidth - this.overlayEl.offsetWidth;
const maxTop = doc.defaultView!.innerHeight - this.overlayEl.offsetHeight;
const view = doc.defaultView;
if (!view) return;
const maxLeft = view.innerWidth - this.overlayEl.offsetWidth;
const maxTop = view.innerHeight - this.overlayEl.offsetHeight;
newLeft = Math.max(0, Math.min(newLeft, maxLeft));
newTop = Math.max(0, Math.min(newTop, maxTop));

View file

@ -79,7 +79,7 @@
}
.theorem-callout-font-family-inherit {
font-family: inherit !important;
font-family: inherit;
}
.math-booster-title-form,
@ -278,8 +278,8 @@
}
.math-booster-dependency-validation svg {
width: 16px !important;
height: 16px !important;
width: 16px;
height: 16px;
}
.math-booster-dependency-validation.valid {