diff --git a/blocksuite/affine/blocks/latex/src/latex-block.ts b/blocksuite/affine/blocks/latex/src/latex-block.ts index a78a58528c..7fee1a3a40 100644 --- a/blocksuite/affine/blocks/latex/src/latex-block.ts +++ b/blocksuite/affine/blocks/latex/src/latex-block.ts @@ -74,19 +74,16 @@ export class LatexBlockComponent extends CaptionedBlockComponent { - // 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 +
`; diff --git a/blocksuite/affine/inlines/latex/src/latex-node/latex-editor-menu.ts b/blocksuite/affine/inlines/latex/src/latex-node/latex-editor-menu.ts index 76cb39f7e1..7e6ebf7b59 100644 --- a/blocksuite/affine/inlines/latex/src/latex-node/latex-editor-menu.ts +++ b/blocksuite/affine/inlines/latex/src/latex-node/latex-editor-menu.ts @@ -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('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`
- +
+ +
this.abortController.abort()}