Skip to content

Build your personal knowledge base with Trilium Notes

Improve css to fix tooltips

Meinzzzz050ddb8c55ed
diff --git a/packages/ckeditor5-math/src/ui/mainformview.ts b/packages/ckeditor5-math/src/ui/mainformview.ts
index 487a96de0f..52d3b05120 100644
--- a/packages/ckeditor5-math/src/ui/mainformview.ts
+++ b/packages/ckeditor5-math/src/ui/mainformview.ts
@@ -70,20 +70,10 @@ export default class MainFormView extends View {
tag: 'div',
attributes: {
class: [
- 'ck-math-scroll'
+ 'ck-math-view'
]
},
- children: [
- {
- tag: 'div',
- attributes: {
- class: [
- 'ck-math-view'
- ]
- },
- children
- }
- ]
+ children
},
{
tag: 'div',
diff --git a/packages/ckeditor5-math/theme/mathform.css b/packages/ckeditor5-math/theme/mathform.css
index fff2feef4b..a5d55f2f1b 100644
--- a/packages/ckeditor5-math/theme/mathform.css
+++ b/packages/ckeditor5-math/theme/mathform.css
@@ -1,25 +1,22 @@
/**
- * Math equation editor dialog styles
+ * Math Equation Editor Dialog Styles - Compact & Readable
*/
-/* Ensure MathLive UI (keyboard, popovers, autocomplete) appears above CKEditor balloon */
-.ML__keyboard,
-.ML__popover,
-.ML__menu,
-.ML__suggestions,
-.ML__autocomplete,
-[data-ml-root],
-/* MathLive LaTeX suggestions popover (by id, from DOM) */
-#mathlive-suggestion-popover,
-/* Potential class name variant for suggestions popover */
-.mathlive-suggestions-popover {
+/* === Z-INDEX: MathLive UI above CKEditor === */
+.ML__keyboard, .ML__popover, .ML__menu, .ML__suggestions, .ML__autocomplete,
+.ML__tooltip, .ML__sr-only, [data-ml-root], #mathlive-suggestion-popover,
+.mathlive-suggestions-popover, [data-ml-tooltip], .ML__base {
z-index: calc(var(--ck-z-panel) + 1000) !important;
}
+.ML__tooltip, [role="tooltip"], .ML__popover[role="tooltip"], .popover, [data-ml-tooltip] {
+ z-index: calc(var(--ck-z-panel) + 2000) !important;
+ position: fixed !important;
+}
+.ck.ck-balloon-panel, .ck.ck-balloon-panel .ck-balloon-panel__content {
+ overflow: visible !important;
+}
-/* ============================================================================
- Main Dialog Container
- ========================================================================= */
-
+/* === MAIN DIALOG === */
.ck.ck-math-form {
display: flex;
flex-direction: column;
@@ -27,217 +24,197 @@
box-sizing: border-box;
max-width: 80vw;
max-height: 80vh;
- overflow-x: hidden;
- /* Allow text/MathLive selection inside the dialog even though
- the global body style sets user-select: none; */
+ overflow: visible;
user-select: text;
}
-/* Mobile responsiveness */
-@media screen and (max-width: 600px) {
- .ck.ck-math-form {
- flex-wrap: wrap;
- }
-}
-
-/* ============================================================================
- Content Layout
- ========================================================================= */
-
-.ck-math-scroll {
- overflow: auto;
- flex: 1 1 auto;
- min-height: 0;
-}
-
+/* Scrollable content - vertical scroll, horizontal visible for tooltips */
.ck-math-view {
+ overflow-y: auto;
+ overflow-x: visible;
display: flex;
flex-direction: column;
flex: 1 1 auto;
gap: var(--ck-spacing-standard);
min-height: 0;
- min-width: 0;
width: 100%;
}
-.ck-math-button-row {
+/* === MATH INPUT === */
+.ck.ck-math-input {
display: flex;
- flex-shrink: 0;
+ flex-direction: column;
gap: var(--ck-spacing-standard);
- margin-top: var(--ck-spacing-standard);
width: fit-content;
+ min-width: 100%;
max-width: 100%;
- flex-wrap: wrap;
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow: visible !important;
}
-/* ============================================================================
- Shared Styles for Input Fields
- ========================================================================= */
-
-/* Base styling for both MathLive fields and textareas */
-.ck.ck-math-form math-field,
-.ck.ck-math-form textarea {
- box-sizing: border-box;
+/* === MATHLIVE EDITOR === */
+.ck.ck-math-input .ck-mathlive-container {
+ position: relative;
+ width: 100%;
+ min-height: 50px;
padding: var(--ck-spacing-small);
+ border: 1px solid var(--ck-color-input-border);
+ border-radius: var(--ck-border-radius);
background: var(--ck-color-input-background) !important;
- color: var(--ck-color-input-text, inherit);
- background: transparent !important;
- border: none !important;
- border-radius: 0;
- padding: 0;
- margin: 0;
- box-shadow: none !important;
- outline: none !important;
- outline-offset: 0 !important;
- transition: none !important;
- animation: none !important;
-}
-
-.ck.ck-math-input .ck-textarea,
-.ck.ck-math-input .ck-textarea:focus,
-.ck.ck-math-input .ck-textarea:hover {
- transition: none !important;
- box-shadow: none !important;
- animation: none !important;
-}
-
-.ck.ck-math-form math-field:focus-within,
-.ck.ck-math-form textarea:focus {
- outline: none !important;
- outline-offset: 0 !important;
- box-shadow: none !important;
- transition: none !important;
+ transition: border-color 120ms ease;
+ overflow: visible !important;
+ clip-path: none !important;
}
-
-/* MathLive-specific configuration */
-.ck.ck-math-form math-field {
- display: block !important;
- width: 100%;
- max-width: 100%;
- overflow-x: auto !important;
- font-size: 1.5em;
-
- /* MathLive theme customization */
- --selection-background-color: rgba(33, 150, 243, 0.2);
- --selection-color: inherit;
- --contains-highlight-background-color: rgba(0, 0, 0, 0.05);
+.ck.ck-math-input .ck-mathlive-container:focus-within {
+ border-color: var(--ck-color-focus-border);
}
-/* ============================================================================
- MathLive Visual Editor
- ========================================================================= */
-
-/* Position MathLive UI controls (keep default internal layout and sizing) */
-.ck.ck-math-form math-field::part(virtual-keyboard-toggle),
-.ck.ck-math-form math-field::part(menu-toggle) {
+/* Position keyboard & menu buttons */
+.ck-mathlive-container math-field::part(virtual-keyboard-toggle),
+.ck-mathlive-container 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) {
+.ck-mathlive-container math-field::part(virtual-keyboard-toggle) { right: 40px; }
+.ck-mathlive-container math-field::part(menu-toggle) {
right: 8px;
display: flex !important;
visibility: visible !important;
}
-/* ============================================================================
- Combined Math Input (MathLive + LaTeX Textarea)
- ========================================================================= */
-
-.ck.ck-math-input {
- display: flex;
- flex-direction: column;
- gap: var(--ck-spacing-standard);
- width: 100%;
- flex: 1 1 auto;
- min-height: 0;
-}
-
-.ck.ck-math-input .ck-mathlive-container {
- display: flex;
+/* Math field element */
+.ck.ck-math-form math-field {
+ display: block !important;
width: 100%;
- min-height: 50px;
- flex-shrink: 0;
- padding: var(--ck-spacing-small);
- border: 1px solid var(--ck-color-input-border, #ccc);
- border-radius: var(--ck-border-radius, 6px);
- background: var(--ck-color-input-background) !important;
- transition: border-color 120ms ease;
-}
-
-.ck.ck-math-input .ck-mathlive-container:focus-within {
- border-color: var(--ck-color-focus-border, #1a73e8);
+ font-size: 1.5em;
+ background: transparent !important;
+ color: var(--ck-color-input-text);
+ border: none !important;
+ padding: 0;
+ outline: none !important;
+ --selection-background-color: rgba(33, 150, 243, 0.2);
+ --selection-color: inherit;
+ --contains-highlight-background-color: rgba(0, 0, 0, 0.05);
}
+/* === LATEX TEXTAREA === */
.ck.ck-math-input .ck-latex-wrapper {
display: flex;
flex-direction: column;
- width: 100%;
- min-height: 60px;
- flex: 1 1 auto;
+ width: fit-content;
+ min-width: 100%;
+ max-width: 100%;
padding: var(--ck-spacing-small);
- border: 1px solid var(--ck-color-input-border, #ccc);
- border-radius: var(--ck-border-radius, 6px);
+ border: 1px solid var(--ck-color-input-border);
+ border-radius: var(--ck-border-radius);
background: var(--ck-color-input-background) !important;
transition: border-color 120ms ease;
+ box-sizing: border-box;
}
-
.ck.ck-math-input .ck-latex-wrapper:focus-within {
- border-color: var(--ck-color-focus-border, #1a73e8);
+ border-color: var(--ck-color-focus-border);
}
-
.ck.ck-math-input .ck-latex-label {
- display: block;
font-size: 12px;
font-weight: 600;
- color: var(--ck-color-text, #333);
+ color: var(--ck-color-text);
opacity: 0.8;
margin: 0 0 var(--ck-spacing-small) 0;
+ flex-shrink: 0;
}
-
.ck.ck-math-input .ck-latex-textarea {
- display: block;
- width: 100%;
+ width: fit-content;
min-width: 100%;
+ max-width: 100%;
min-height: 60px;
- max-height: 100%;
- flex: 1 1 auto;
+ max-height: calc(80vh - 300px);
resize: both;
overflow: auto;
- font-family: monospace;
+ font-family: 'Courier New', monospace;
+ font-size: 0.95em;
background: transparent !important;
+ color: var(--ck-color-input-text);
border: none !important;
padding: 0;
+ outline: none !important;
+ box-sizing: border-box;
}
-.ck.ck-math-input .ck-latex-textarea:focus {
- outline: none;
+/* === DISPLAY TOGGLE === */
+.ck-button-display-toggle {
+ align-self: flex-start;
+ padding: var(--ck-spacing-small) var(--ck-spacing-standard);
+ background: var(--ck-color-input-background);
+ color: var(--ck-color-text);
+ border: 1px solid var(--ck-color-input-border);
+ border-radius: var(--ck-border-radius);
+ cursor: pointer;
+ transition: all 0.2s ease;
}
+.ck-button-display-toggle:hover { background: var(--ck-color-focus-border); }
-/* ============================================================================
- Error State
- ========================================================================= */
-
-.ck-math-render-error {
- color: var(--ck-color-error-text, #db1d1d);
+/* === PREVIEW === */
+.ck-math-preview,
+.ck.ck-math-preview {
+ width: 100%;
+ min-height: 40px;
+ max-height: none !important;
+ height: auto !important;
padding: var(--ck-spacing-small);
- font-style: italic;
- font-size: 0.9em;
- border: 1px dashed var(--ck-color-error-text, #db1d1d);
- border-radius: 2px;
- background: var(--ck-color-base-background, #fff);
+ background: transparent !important;
+ border: none !important;
+ display: block;
+ text-align: left;
+ overflow-x: auto !important;
+ overflow-y: visible !important;
+ flex-shrink: 0;
}
-/* ============================================================================
- Preview Section
- ========================================================================= */
+/* Center equation when in display mode */
+.ck-math-preview[data-display="true"],
+.ck.ck-math-preview[data-display="true"] {
+ text-align: center;
+}
-.ck-math-preview {
- flex-shrink: 0;
- overflow-x: auto;
- overflow-y: hidden;
+.ck-math-preview.ck-error, .ck-math-render-error {
+ border-color: var(--ck-color-error-text);
+ background: var(--ck-color-base-background);
+ color: var(--ck-color-error-text);
+}
+
+/* === BUTTONS === */
+.ck-math-button-row {
+ display: flex;
+ gap: var(--ck-spacing-standard);
+ justify-content: flex-end;
+ margin-top: var(--ck-spacing-standard);
+}
+.ck-button-save, .ck-button-cancel {
+ padding: var(--ck-spacing-small) var(--ck-spacing-standard);
+ border: 1px solid var(--ck-color-input-border);
+ border-radius: var(--ck-border-radius);
+ cursor: pointer;
+ font-weight: 500;
+}
+.ck-button-save {
+ background: var(--ck-color-focus-border);
+ color: white;
+}
+.ck-button-cancel {
+ background: var(--ck-color-input-background);
+ color: var(--ck-color-text);
+}
+.ck-button-save:hover { opacity: 0.9; }
+.ck-button-cancel:hover { background: var(--ck-color-base-background); }
+
+/* === OVERFLOW FIX: Allow tooltips to escape === */
+.ck.ck-balloon-panel,
+.ck.ck-balloon-panel .ck-balloon-panel__content,
+.ck.ck-math-form,
+.ck-math-view,
+.ck.ck-math-input,
+.ck.ck-math-input .ck-mathlive-container {
+ overflow: visible !important;
+ clip-path: none !important;
}