Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 1x 1x 1x 25x 25x | import { EditorView } from '@codemirror/view';
import type { Extension } from '@codemirror/state';
export const scrollerTheme = EditorView.theme({
'& .cm-scroller': {
height: '100% !important',
},
});
let lastDimensionKey: string | null = null;
let lastDimensionTheme: Extension | null = null;
export function getDimensionTheme(
height: string | null,
minHeight: string | null,
maxHeight: string | null,
width: string | null,
minWidth: string | null,
maxWidth: string | null,
): Extension | null {
Eif (!height && !minHeight && !maxHeight && !width && !minWidth && !maxWidth) {
return null;
}
const cacheKey = JSON.stringify({ height, minHeight, maxHeight, width, minWidth, maxWidth });
if (cacheKey === lastDimensionKey) {
return lastDimensionTheme;
}
lastDimensionKey = cacheKey;
lastDimensionTheme = EditorView.theme({
'&': {
height,
minHeight,
maxHeight,
width,
minWidth,
maxWidth,
},
});
return lastDimensionTheme;
}
|