@@ -13,6 +13,7 @@ import { useCreateBlockNote } from '@blocknote/react';
1313import { HocuspocusProvider } from '@hocuspocus/provider' ;
1414import { useEffect } from 'react' ;
1515import { useTranslation } from 'react-i18next' ;
16+ import { createGlobalStyle } from 'styled-components' ;
1617import * as Y from 'yjs' ;
1718
1819import { Box , TextErrors } from '@/components' ;
@@ -49,6 +50,16 @@ import XLMultiColumn from './xl-multi-column';
4950const multiColumnLocales = XLMultiColumn ?. locales ;
5051const withMultiColumn = XLMultiColumn ?. withMultiColumn ;
5152
53+ /*
54+ * Force position:fixed on emoji picker to prevent it from being hidden under the left sidebar
55+ * when zooming in/out. Without this, the picker's position could end up under the left sidebar.
56+ */
57+ const BlockNoteEmojiPickerStyle = createGlobalStyle `
58+ div[data-floating-ui-focusable]:has(.bn-grid-suggestion-menu) {
59+ position: fixed !important;
60+ }
61+ ` ;
62+
5263const baseBlockNoteSchema = withPageBreak (
5364 BlockNoteSchema . create ( {
5465 blockSpecs : {
@@ -177,33 +188,36 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
177188 } , [ setEditor , editor ] ) ;
178189
179190 return (
180- < Box
181- $padding = { { top : 'md' } }
182- $background = "white"
183- $css = { cssEditor ( readOnly ) }
184- className = "--docs--editor-container"
185- >
186- { errorAttachment && (
187- < Box $margin = { { bottom : 'big' , top : 'none' , horizontal : 'large' } } >
188- < TextErrors
189- causes = { errorAttachment . cause }
190- canClose
191- $textAlign = "left"
192- />
193- </ Box >
194- ) }
195-
196- < BlockNoteView
197- editor = { editor }
198- formattingToolbar = { false }
199- slashMenu = { false }
200- editable = { ! readOnly }
201- theme = "light"
191+ < >
192+ < BlockNoteEmojiPickerStyle />
193+ < Box
194+ $padding = { { top : 'md' } }
195+ $background = "white"
196+ $css = { cssEditor ( readOnly ) }
197+ className = "--docs--editor-container"
202198 >
203- < BlockNoteSuggestionMenu />
204- < BlockNoteToolbar />
205- </ BlockNoteView >
206- </ Box >
199+ { errorAttachment && (
200+ < Box $margin = { { bottom : 'big' , top : 'none' , horizontal : 'large' } } >
201+ < TextErrors
202+ causes = { errorAttachment . cause }
203+ canClose
204+ $textAlign = "left"
205+ />
206+ </ Box >
207+ ) }
208+
209+ < BlockNoteView
210+ editor = { editor }
211+ formattingToolbar = { false }
212+ slashMenu = { false }
213+ editable = { ! readOnly }
214+ theme = "light"
215+ >
216+ < BlockNoteSuggestionMenu />
217+ < BlockNoteToolbar />
218+ </ BlockNoteView >
219+ </ Box >
220+ </ >
207221 ) ;
208222} ;
209223
0 commit comments