This commit is contained in:
Norman 2026-01-22 10:48:47 +08:00 committed by GitHub
commit bc6a1e3915
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 35 deletions

View file

@ -54,28 +54,10 @@ export function setupReadView(app: ExtendedApp, settings: CollapsibleCodeBlockSe
}
function updateCodeBlockVisibility(pre: HTMLElement, forceRefresh: boolean = false) {
const isCollapsed = pre.classList.contains('collapsed');
const markdownView = app.workspace.getActiveViewOfType(MarkdownView);
if (!markdownView?.previewMode?.containerEl) return;
const previewElement = markdownView.previewMode.containerEl;
const rect = pre.getBoundingClientRect();
const scrollTop = previewElement.scrollTop;
const elementTop = rect.top + scrollTop;
let curr = pre.nextElementSibling;
while (curr && !(curr instanceof HTMLPreElement)) {
if (curr instanceof HTMLElement) {
if (isCollapsed) {
curr.classList.add('element-hidden');
curr.classList.remove('element-visible', 'element-spacing');
} else {
curr.classList.remove('element-hidden');
curr.classList.add('element-visible');
}
}
curr = curr.nextElementSibling;
}
void pre.offsetHeight;

View file

@ -81,23 +81,6 @@ body[data-ccb-horizontal-scroll="true"] .markdown-preview-view pre.ccb-code-bloc
width: 0;
}
/* New styles for dynamic states */
.hidden {
display: none !important;
}
.element-hidden {
display: none !important;
}
.element-visible {
display: block;
}
.element-spacing {
margin-top: var(--element-spacing);
}
/* Custom properties for dynamic values */
:root {
--element-spacing: 0px;