fix: latex editor max-height (#12520)

Closes: BS-3538

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
  - Improved click handling for LaTeX blocks, making interactions more consistent and maintainable.
  - Updated LaTeX editor menu layout to enhance vertical scrolling, ensuring better usability with large content.

- **Style**
  - Added a maximum height and vertical scrolling to the LaTeX editor for improved user experience with lengthy formulas.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Saul-Mirone
2025-05-26 06:14:17 +00:00
parent 7aacfee789
commit 8ba4584b88
2 changed files with 28 additions and 17 deletions

View File

@@ -57,6 +57,9 @@ export class LatexEditorMenu extends SignalWatcher(
font-family: ${unsafeCSSVar('fontCodeFamily')};
border: 1px solid transparent;
max-height: 400px;
overflow-y: auto;
}
.latex-editor:focus-within {
border: 1px solid ${unsafeCSSVar('blue700')};
@@ -97,6 +100,10 @@ export class LatexEditorMenu extends SignalWatcher(
return this.querySelector<RichText>('rich-text');
}
private readonly _getVerticalScrollContainer = () => {
return this.querySelector('.latex-editor');
};
private _updateHighlightTokens(text: string) {
const editorTheme = this.std.get(ThemeProvider).theme;
const theme = editorTheme === ColorScheme.Dark ? 'dark-plus' : 'light-plus';
@@ -171,11 +178,14 @@ export class LatexEditorMenu extends SignalWatcher(
override render() {
return html`<div class="latex-editor-container">
<div class="latex-editor">
<rich-text
.yText=${this.yText}
.attributesSchema=${this.inlineManager.getSchema()}
.attributeRenderer=${this.inlineManager.getRenderer()}
></rich-text>
<div class="latex-editor-content">
<rich-text
.yText=${this.yText}
.attributesSchema=${this.inlineManager.getSchema()}
.attributeRenderer=${this.inlineManager.getRenderer()}
.verticalScrollContainerGetter=${this._getVerticalScrollContainer}
></rich-text>
</div>
</div>
<div class="latex-editor-confirm">
<span @click=${() => this.abortController.abort()}