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

@@ -74,19 +74,16 @@ export class LatexBlockComponent extends CaptionedBlockComponent<LatexBlockModel
}
})
);
}
this.disposables.addFromEvent(this, 'click', () => {
// should not open editor or select block in readonly mode
if (this.store.readonly) {
return;
}
private _handleClick() {
if (this.store.readonly) return;
if (this.isBlockSelected) {
this.toggleEditor();
} else {
this.selectBlock();
}
});
if (this.isBlockSelected) {
this.toggleEditor();
} else {
this.selectBlock();
}
}
removeEditor(portal: HTMLDivElement) {
@@ -95,7 +92,11 @@ export class LatexBlockComponent extends CaptionedBlockComponent<LatexBlockModel
override renderBlock() {
return html`
<div contenteditable="false" class="latex-block-container">
<div
contenteditable="false"
class="latex-block-container"
@click=${this._handleClick}
>
<div class="katex"></div>
</div>
`;