@@ -28,6 +28,7 @@ import {
28
28
importVisitors$ ,
29
29
jsxComponentDescriptors$ ,
30
30
jsxIsAvailable$ ,
31
+ lexicalTheme$ ,
31
32
nestedEditorChildren$ ,
32
33
rootEditor$ ,
33
34
usedLexicalNodes$
@@ -37,15 +38,14 @@ import LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary.js'
37
38
import { LexicalNestedComposer } from '@lexical/react/LexicalNestedComposer.js'
38
39
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'
39
40
import classNames from 'classnames'
40
- import { lexicalTheme } from '../../styles/lexicalTheme'
41
41
import { exportLexicalTreeToMdast } from '../../exportMarkdownFromLexical'
42
42
import { importMdastTreeToLexical } from '../../importMarkdownToLexical'
43
43
import styles from '../../styles/ui.module.css'
44
44
import { SharedHistoryPlugin } from './SharedHistoryPlugin'
45
45
import { mergeRegister } from '@lexical/utils'
46
46
import { VoidEmitter } from '../../utils/voidEmitter'
47
47
import { isPartOftheEditorUI } from '../../utils/isPartOftheEditorUI'
48
- import { useCellValues , usePublisher } from '@mdxeditor/gurx'
48
+ import { useCellValues , usePublisher , useRealm } from '@mdxeditor/gurx'
49
49
import { DirectiveNode } from '../directives'
50
50
import { LexicalJsxNode } from '../jsx/LexicalJsxNode'
51
51
@@ -181,6 +181,7 @@ export const NestedLexicalEditor = function <T extends Mdast.RootContent>(props:
181
181
const updateMdastNode = useMdastNodeUpdater < T > ( )
182
182
const removeNode = useLexicalNodeRemove ( )
183
183
const content = getContent ( mdastNode )
184
+ const realm = useRealm ( )
184
185
185
186
const [
186
187
rootEditor ,
@@ -191,7 +192,8 @@ export const NestedLexicalEditor = function <T extends Mdast.RootContent>(props:
191
192
directiveDescriptors ,
192
193
codeBlockEditorDescriptors ,
193
194
jsxIsAvailable ,
194
- nestedEditorChildren
195
+ nestedEditorChildren ,
196
+ lexicalTheme
195
197
] = useCellValues (
196
198
rootEditor$ ,
197
199
importVisitors$ ,
@@ -201,15 +203,16 @@ export const NestedLexicalEditor = function <T extends Mdast.RootContent>(props:
201
203
directiveDescriptors$ ,
202
204
codeBlockEditorDescriptors$ ,
203
205
jsxIsAvailable$ ,
204
- nestedEditorChildren$
206
+ nestedEditorChildren$ ,
207
+ lexicalTheme$
205
208
)
206
209
207
210
const setEditorInFocus = usePublisher ( editorInFocus$ )
208
211
209
212
const [ editor ] = React . useState ( ( ) => {
210
213
const editor = createEditor ( {
211
214
nodes : usedLexicalNodes ,
212
- theme : lexicalTheme
215
+ theme : realm . getValue ( lexicalTheme$ )
213
216
} )
214
217
return editor
215
218
} )
@@ -261,6 +264,7 @@ export const NestedLexicalEditor = function <T extends Mdast.RootContent>(props:
261
264
updateMdastNode ( getUpdatedMdastNode ( structuredClone ( mdastNode ) as any , content as any ) )
262
265
} )
263
266
}
267
+
264
268
return mergeRegister (
265
269
editor . registerCommand (
266
270
FOCUS_COMMAND ,
@@ -330,7 +334,7 @@ export const NestedLexicalEditor = function <T extends Mdast.RootContent>(props:
330
334
] )
331
335
332
336
return (
333
- < LexicalNestedComposer initialEditor = { editor } >
337
+ < LexicalNestedComposer initialEditor = { editor } initialTheme = { lexicalTheme } >
334
338
< RichTextPlugin
335
339
contentEditable = {
336
340
< ContentEditable { ...contentEditableProps } className = { classNames ( styles . nestedEditor , contentEditableProps ?. className ) } />
0 commit comments