/** * Math equation editor dialog styles * Complete version with scrolling fixes for preview and input */ /* ============================================================================ 1. Main Layout Containers (The Skeleton) ========================================================================= */ .ck.ck-math-form { display: flex; flex-direction: column; padding: var(--ck-spacing-standard); box-sizing: border-box; max-width: 80vw; height: 100%; /* Never wider than screen */ overflow-x: hidden; /* Prevent the main window from scrolling horizontally */ } /* Mobile responsiveness */ @media screen and (max-width: 600px) { .ck.ck-math-form { flex-wrap: wrap; } } .ck-math-view { display: flex; flex-direction: column; flex: 1 1 auto; gap: var(--ck-spacing-standard); min-height: fit-content; min-width: 0; width: 100%; } .ck-math-button-row { display: flex; flex-shrink: 0; gap: var(--ck-spacing-standard); margin-top: var(--ck-spacing-standard); width: fit-content; max-width: 100%; flex-wrap: wrap; } /* ============================================================================ 2. Shared Styling (Applies to Input AND Preview) ========================================================================= */ /* This targets both the top input AND the bottom preview */ .ck.ck-math-form math-field, .ck.ck-math-form textarea { box-sizing: border-box; padding: var(--ck-spacing-small); background: var(--ck-color-input-background) !important; color: var(--ck-color-input-text, inherit); font-size: var(--ck-font-size-base); border: none !important; border-radius: var(--ck-border-radius, 6px); outline: 3px solid transparent; outline-offset: 6px; } /* SPECIFIC FIX FOR PREVIEW SCROLLING */ .ck.ck-math-form math-field { display: block !important; width: 100%; /* 3. Stop it from growing infinite */ max-width: 100%; /* 4. Enable scrollbars for the red matrix area */ overflow-x: auto !important; /* Theme overrides */ --selection-background-color: rgba(33, 150, 243, 0.2); --selection-color: inherit; --contains-highlight-background-color: rgba(0, 0, 0, 0.05); } /* ============================================================================ 3. MathLive Input Specifics (The Top Box) ========================================================================= */ /* Wrapper for the editable input at the top */ .ck.ck-mathlive-input { display: inline-block; flex: 0 0 auto; width: 100%; max-width: 100%; /* Safety */ min-height: fit-content; max-height: 80vh; overflow: auto; padding-bottom: var(--ck-spacing-small); resize: none; } /* Shadow DOM Layout adjustments (Keep your existing logic) */ .ck.ck-math-form math-field::part(container), .ck.ck-math-form math-field::part(content), .ck.ck-math-form math-field::part(field) { display: flex; flex-direction: column; flex: 1 1 auto; height: 100%; align-items: flex-start; justify-content: flex-start; } /* UI Buttons positions */ .ck.ck-math-form math-field::part(virtual-keyboard-toggle), .ck.ck-math-form math-field::part(menu-toggle) { position: absolute; top: 8px; } .ck.ck-math-form math-field::part(virtual-keyboard-toggle) { right: 40px; } .ck.ck-math-form math-field::part(menu-toggle) { right: 8px; display: flex !important; visibility: visible !important; } /* ============================================================================ 4. Raw LaTeX Integration (The Middle Box) ========================================================================= */ .ck-math-view .ck-labeled-field-view { display: flex; flex-direction: column; flex: 0 0 auto; min-width: 100%; /* Allow the middle box to shrink if needed */ width: 100%; max-width: 100%; min-height: 140px; max-height: 70vh; resize: both; overflow: auto; background: transparent; } /* Hide label */ .ck-math-view .ck-labeled-field-view .ck-label { display: none !important; } /* Internal wrapper */ .ck-math-view .ck-labeled-field-view .ck-labeled-field-view__input-wrapper { display: flex; flex-direction: column; flex: 1 1 auto; width: 100%; min-height: 100px; height: auto; padding: 0; border: none; background: transparent; box-shadow: none; } /* The Textarea */ .ck-math-view .ck-labeled-field-view textarea { display: block; flex: 1 1 auto; width: 100% !important; height: 100%; min-height: 140px; resize: none !important; border-radius: 0 !important; box-shadow: none !important; transition: none !important; } .ck-math-view .ck-labeled-field-view textarea:hover, .ck-math-view .ck-labeled-field-view textarea:focus { background: var(--ck-color-input-background) !important; outline: none !important; box-shadow: none !important; }