2019-02-21 11:46:55 +07:00
|
|
|
const common = require('../../common');
|
|
|
|
|
2017-12-14 12:09:54 +01:00
|
|
|
module.exports = {
|
|
|
|
get mobiledocConverter() {
|
|
|
|
return require('./mobiledoc-converter');
|
|
|
|
},
|
|
|
|
|
|
|
|
get markdownConverter() {
|
|
|
|
return require('./markdown-converter');
|
2019-01-18 11:29:56 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get htmlToMobiledocConverter() {
|
2019-02-21 11:46:55 +07:00
|
|
|
try {
|
|
|
|
return require('@tryghost/html-to-mobiledoc').toMobiledoc;
|
|
|
|
} catch (err) {
|
2019-06-03 14:20:23 +02:00
|
|
|
return () => {
|
|
|
|
throw new common.errors.InternalServerError({
|
|
|
|
message: 'Unable to convert from source HTML to Mobiledoc',
|
|
|
|
context: 'The html-to-mobiledoc package was not installed',
|
|
|
|
help: 'Please review any errors from the install process by checking the Ghost logs',
|
|
|
|
code: 'HTML_TO_MOBILEDOC_INSTALLATION',
|
|
|
|
err: err
|
|
|
|
});
|
|
|
|
};
|
2019-02-21 11:46:55 +07:00
|
|
|
}
|
2017-12-14 12:09:54 +01:00
|
|
|
}
|
|
|
|
};
|