-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(richtext-lexical): mdx support (#9160)
Supports bi-directional import/export between MDX <=> Lexical. JSX will be mapped to lexical blocks back and forth. This will allow editing our mdx docs in payload while keeping mdx as the source of truth --------- Co-authored-by: Germán Jabloñski <43938777+GermanJablo@users.noreply.github.com>
- Loading branch information
1 parent
324af8a
commit d4f1add
Showing
79 changed files
with
7,547 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/payload/src/bin/generateImportMap/getFromImportMap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { PayloadComponent } from '../../config/types.js' | ||
import type { ImportMap } from './index.js' | ||
|
||
import { parsePayloadComponent } from './parsePayloadComponent.js' | ||
|
||
export const getFromImportMap = <TOutput>(args: { | ||
importMap: ImportMap | ||
PayloadComponent: PayloadComponent | ||
schemaPath?: string | ||
silent?: boolean | ||
}): TOutput => { | ||
const { importMap, PayloadComponent, schemaPath, silent } = args | ||
|
||
const { exportName, path } = parsePayloadComponent(PayloadComponent) | ||
|
||
const key = path + '#' + exportName | ||
|
||
const importMapEntry = importMap[key] | ||
|
||
if (!importMapEntry && !silent) { | ||
// eslint-disable-next-line no-console | ||
console.error( | ||
`getFromImportMap: PayloadComponent not found in importMap`, | ||
{ | ||
key, | ||
PayloadComponent, | ||
schemaPath, | ||
}, | ||
'You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime.', | ||
) | ||
} | ||
|
||
return importMapEntry | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.