mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 09:22:49 +03:00
f61aa662c1
refs #7429 - ☢️ 👷🏻♀️ This PR removes the dependency on Ghost-Editor and replaces it with the Mobiledoc DOM renderer. It includes new DOM based default cards and atoms.
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
var SimpleDom = require('simple-dom'),
|
|
Renderer = require('mobiledoc-dom-renderer').default,
|
|
config = require('../config'),
|
|
defaults = require(config.get('paths').internalAppPath + 'default-cards'),
|
|
options = {
|
|
dom: new SimpleDom.Document(),
|
|
cards: defaults.cards,
|
|
atoms: defaults.atoms
|
|
};
|
|
|
|
// function getCards() {
|
|
// return config.get('internalApps').reduce(
|
|
// function (cards, appName) {
|
|
// var app = require(path.join(config.get('paths').internalAppPath, appName));
|
|
// if (app.hasOwnProperty('cards')) {
|
|
// cards = cards.concat(app.cards);
|
|
// }
|
|
// return cards;
|
|
// }, [ ]);
|
|
// }
|
|
// function getAtoms() {
|
|
// return config.get('internalApps').reduce(
|
|
// function (atoms, appName) {
|
|
// var app = require(path.join(config.get('paths').internalAppPath, appName));
|
|
// if (app.hasOwnProperty('atoms')) {
|
|
// atoms = atoms.concat(app.atoms);
|
|
// }
|
|
// return atoms;
|
|
// }, [ ]);
|
|
// }
|
|
|
|
module.exports = {
|
|
render: function (mobiledoc) {
|
|
var renderer = new Renderer(options),
|
|
rendered = renderer.render(mobiledoc),
|
|
serializer = new SimpleDom.HTMLSerializer([]),
|
|
html = serializer.serializeChildren(rendered.result);
|
|
return html;
|
|
}
|
|
};
|