mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Standardised mobiledocLib renderer access
no issue - avoid accessing `mobiledocLib.mobiledocHtmlRenderer` directly to access the `render()` method in favor of using `mobiledocLib.render()` instead - standardising on this pattern should help avoid accidentally requiring the full library before we have a need to render
This commit is contained in:
parent
e136ecb09f
commit
2036747bef
5 changed files with 6 additions and 6 deletions
|
@ -271,10 +271,10 @@ class PostsImporter extends BaseImporter {
|
|||
});
|
||||
|
||||
model.mobiledoc = JSON.stringify(mobiledoc);
|
||||
model.html = mobiledocLib.mobiledocHtmlRenderer.render(JSON.parse(model.mobiledoc));
|
||||
model.html = mobiledocLib.render(JSON.parse(model.mobiledoc));
|
||||
} else if (model.html && !model.lexical) {
|
||||
model.mobiledoc = JSON.stringify(mobiledocLib.htmlToMobiledocConverter(model.html));
|
||||
model.html = mobiledocLib.mobiledocHtmlRenderer.render(JSON.parse(model.mobiledoc));
|
||||
model.html = mobiledocLib.render(JSON.parse(model.mobiledoc));
|
||||
}
|
||||
|
||||
this.sanitizePostsMeta(model);
|
||||
|
|
|
@ -39,7 +39,7 @@ module.exports = createIrreversibleMigration(async (knex) => {
|
|||
continue;
|
||||
}
|
||||
|
||||
const html = mobiledocLib.mobiledocHtmlRenderer.render(mobiledoc);
|
||||
const html = mobiledocLib.render(mobiledoc);
|
||||
|
||||
const updatedAttrs = {
|
||||
html: html
|
||||
|
|
|
@ -59,7 +59,7 @@ module.exports = createTransactionalMigration(
|
|||
}
|
||||
|
||||
try {
|
||||
html = mobiledocLib.mobiledocHtmlRenderer.render(JSON.parse(mobiledoc));
|
||||
html = mobiledocLib.render(JSON.parse(mobiledoc));
|
||||
} catch (err) {
|
||||
logging.warn(`Invalid mobiledoc content structure for ${id}, unable to render. Skipping`);
|
||||
continue;
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = createIrreversibleMigration(async (knex) => {
|
|||
continue;
|
||||
}
|
||||
|
||||
const html = mobiledocLib.mobiledocHtmlRenderer.render(mobiledoc);
|
||||
const html = mobiledocLib.render(mobiledoc);
|
||||
|
||||
const updatedAttrs = {
|
||||
html
|
||||
|
|
|
@ -742,7 +742,7 @@ Post = ghostBookshelf.Model.extend({
|
|||
)
|
||||
) {
|
||||
try {
|
||||
this.set('html', mobiledocLib.mobiledocHtmlRenderer.render(JSON.parse(this.get('mobiledoc'))));
|
||||
this.set('html', mobiledocLib.render(JSON.parse(this.get('mobiledoc'))));
|
||||
} catch (err) {
|
||||
throw new errors.ValidationError({
|
||||
message: tpl(messages.invalidMobiledocStructure),
|
||||
|
|
Loading…
Add table
Reference in a new issue