1+ import React from 'react'
12import {
23 BOLD_ITALIC_STAR ,
34 BOLD_ITALIC_UNDERSCORE ,
@@ -19,10 +20,9 @@ import {
1920import { MarkdownShortcutPlugin } from '@lexical/react/LexicalMarkdownShortcutPlugin'
2021import { $createHeadingNode , $isHeadingNode , HeadingNode , HeadingTagType } from '@lexical/rich-text'
2122import { ElementNode , LexicalNode } from 'lexical'
22- import React from 'react'
2323import { realmPlugin } from '../../RealmWithPlugins'
2424import { $createCodeBlockNode , CodeBlockNode } from '../codeblock/CodeBlockNode'
25- import { activePlugins$ , addComposerChild$ , addNestedEditorChild$ } from '../core'
25+ import { activePlugins$ , addComposerChild$ , addNestedEditorChild$ , addTableCellEditorChild$ } from '../core'
2626import { HEADING_LEVEL , allowedHeadingLevels$ } from '../headings'
2727import { $createHorizontalRuleNode , $isHorizontalRuleNode , HorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode'
2828
@@ -35,9 +35,11 @@ export const markdownShortcutPlugin = realmPlugin({
3535 const pluginIds = realm . getValue ( activePlugins$ )
3636 const allowedHeadingLevels : readonly HEADING_LEVEL [ ] = pluginIds . includes ( 'headings' ) ? realm . getValue ( allowedHeadingLevels$ ) : [ ]
3737 const transformers = pickTransformersForActivePlugins ( pluginIds , allowedHeadingLevels )
38+ const tableCellTransformers = transformers . filter ( ( t ) => ! LIST_TRANSFORMERS . has ( t ) )
3839 realm . pubIn ( {
3940 [ addComposerChild$ ] : ( ) => < MarkdownShortcutPlugin transformers = { transformers } /> ,
40- [ addNestedEditorChild$ ] : ( ) => < MarkdownShortcutPlugin transformers = { transformers } />
41+ [ addNestedEditorChild$ ] : ( ) => < MarkdownShortcutPlugin transformers = { transformers } /> ,
42+ [ addTableCellEditorChild$ ] : ( ) => < MarkdownShortcutPlugin transformers = { tableCellTransformers } />
4143 } )
4244 }
4345} )
@@ -72,6 +74,8 @@ const THEMATIC_BREAK: ElementTransformer = {
7274 type : 'element'
7375}
7476
77+ const LIST_TRANSFORMERS : ReadonlySet < Transformer > = new Set ( [ ORDERED_LIST , UNORDERED_LIST , CHECK_LIST ] )
78+
7579function pickTransformersForActivePlugins ( pluginIds : string [ ] , allowedHeadingLevels : readonly HEADING_LEVEL [ ] ) {
7680 const transformers : Transformer [ ] = [
7781 BOLD_ITALIC_STAR ,
0 commit comments