fix(richtext-lexical): newlines in mdx props were stripped, even though objects inside props may expect there to be newlines (#10215)
This commit is contained in:
@@ -159,9 +159,6 @@ export function linesFromStartToContentAndPropsString({
|
||||
}
|
||||
}
|
||||
|
||||
// Replace all \n with spaces
|
||||
propsString = propsString.replace(/\n/g, ' ').trim()
|
||||
|
||||
const afterEndLine = linesCopy[endLineIndex].trim().slice(endlineLastCharIndex)
|
||||
|
||||
return {
|
||||
|
||||
@@ -1401,6 +1401,27 @@ Some line [Start of link
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
input: `
|
||||
<PackageInstallOptions
|
||||
update
|
||||
packageId="Line"
|
||||
someObject={{test: \`Line 1
|
||||
|
||||
Line 2\`}}
|
||||
ignored>
|
||||
</PackageInstallOptions>
|
||||
`,
|
||||
inputAfterConvertFromEditorJSON: `<PackageInstallOptions packageId="Line" update someObject={{"test":"Line 1\\n\\nLine 2"}}/>`,
|
||||
blockNode: {
|
||||
fields: {
|
||||
blockType: 'PackageInstallOptions',
|
||||
packageId: 'Line',
|
||||
someObject: { test: 'Line 1\n\nLine 2' },
|
||||
update: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
const INPUT_AND_OUTPUT: Tests = INPUT_AND_OUTPUTBase //.filter((test) => test.debugFlag)
|
||||
|
||||
@@ -10,6 +10,7 @@ export const PackageInstallOptions: Block = {
|
||||
someNestedObject: props?.someNestedObject,
|
||||
uniqueId: props?.uniqueId,
|
||||
update: props?.update,
|
||||
someObject: props?.someObject,
|
||||
}
|
||||
},
|
||||
export: ({ fields, lexicalToMarkdown }) => {
|
||||
@@ -20,6 +21,7 @@ export const PackageInstallOptions: Block = {
|
||||
someNestedObject: fields?.someNestedObject,
|
||||
uniqueId: fields?.uniqueId,
|
||||
update: fields?.update,
|
||||
someObject: fields?.someObject,
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -27,12 +29,16 @@ export const PackageInstallOptions: Block = {
|
||||
fields: [
|
||||
{
|
||||
name: 'packageId',
|
||||
type: 'text',
|
||||
type: 'textarea',
|
||||
},
|
||||
{
|
||||
name: 'global',
|
||||
type: 'checkbox',
|
||||
},
|
||||
{
|
||||
name: 'someObject',
|
||||
type: 'json',
|
||||
},
|
||||
{
|
||||
name: 'update',
|
||||
type: 'checkbox',
|
||||
|
||||
Reference in New Issue
Block a user