Fixed flex creating a large gap between the footer and the contents

This commit is contained in:
Signynt 2024-11-30 18:35:00 +01:00
parent 0be0da594b
commit c177259ded
2 changed files with 19 additions and 9 deletions

22
main.ts
View file

@ -23,17 +23,23 @@ export default class VirtualFooterPlugin extends Plugin {
await this.injectFooterToPreview(view);
} else if (state.mode === 'source' && !state.source) {
// Remove the padding from the content area to append the footer
const cmContent = view.containerEl.querySelector('.cm-editor .cm-content') as HTMLDivElement;
if (cmContent) {
cmContent.classList.add('virtual-footer-cm-padding');
}
const [content, container] = [
view.containerEl.querySelector('.cm-editor .cm-content'),
view.containerEl.querySelector('.markdown-source-view.mod-cm6 .cm-contentContainer')
] as HTMLDivElement[];
content?.classList.add('virtual-footer-cm-padding');
container?.classList.add('virtual-footer-remove-flex');
await this.injectFooterToEditor(view);
} else {
// Remove the custom styling from the content area
const cmContent = view.containerEl.querySelector('.cm-editor .cm-content') as HTMLDivElement;
if (cmContent) {
cmContent.classList.remove('virtual-footer-cm-padding');
}
const [content, container] = [
view.containerEl.querySelector('.cm-editor .cm-content'),
view.containerEl.querySelector('.markdown-source-view.mod-cm6 .cm-contentContainer')
] as HTMLDivElement[];
content?.classList.remove('virtual-footer-cm-padding');
container?.classList.remove('virtual-footer-remove-flex');
await this.removeFooter(view);
}
};

View file

@ -6,4 +6,8 @@
.virtual-footer-cm-padding {
padding-bottom: var(--p-spacing) !important;
}
}
.virtual-footer-remove-flex {
flex: 0 1 auto !important;
}