Updated data-generator to create lexical rather than mobiledoc posts

closes https://linear.app/tryghost/issue/ONC-96

- better matches Ghost's current usage
- avoids mismatch in expected data when `post_revisions` is populated in future
This commit is contained in:
Kevin Ansfield 2024-06-17 11:43:04 +01:00
parent f85656460f
commit 428e10f147

View File

@ -62,23 +62,34 @@ class PostsImporter extends TableImporter {
slug: `${slugify(title)}-${faker.random.numeric(3)}`, slug: `${slugify(title)}-${faker.random.numeric(3)}`,
status, status,
visibility, visibility,
mobiledoc: JSON.stringify({ lexical: JSON.stringify({
version: '0.3.1', root: {
atoms: [], children: content.map(paragraph => (
cards: [], {
markups: [['em']], children: [
sections: content.map(paragraph => [ {
1, detail: 0,
'p', format: 0,
[ mode: 'normal',
[ style: '',
0, text: paragraph,
[], type: 'extended-text',
0, version: 1
paragraph }
] ],
] direction: 'ltr',
]) format: '',
indent: 0,
type: 'paragraph',
version: 1
}
)),
direction: 'ltr',
format: '',
indent: 0,
type: 'root',
version: 1
}
}), }),
html: content.map(paragraph => `<p>${paragraph}</p>`).join(''), html: content.map(paragraph => `<p>${paragraph}</p>`).join(''),
plaintext: content.join('\n\n'), plaintext: content.join('\n\n'),