mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-01 23:37:43 +03:00
Moved default-cards app to lib/mobiledoc (#9341)
refs #9178, refs https://github.com/TryGhost/Ghost/pull/9338
This commit is contained in:
parent
a3091a3012
commit
50b65bca0c
@ -16,8 +16,7 @@
|
||||
"internal": [
|
||||
"private-blogging",
|
||||
"subscribers",
|
||||
"amp",
|
||||
"default-cards"
|
||||
"amp"
|
||||
]
|
||||
},
|
||||
"routeKeywords": {
|
||||
|
@ -1,12 +1,12 @@
|
||||
var SimpleDom = require('simple-dom'),
|
||||
Renderer = require('mobiledoc-dom-renderer').default,
|
||||
config = require('../../../config'),
|
||||
common = require('../../../lib/common'),
|
||||
defaults = require(config.get('paths').internalAppPath + 'default-cards'),
|
||||
common = require('../../common'),
|
||||
atoms = require('../atoms'),
|
||||
cards = require('../cards'),
|
||||
options = {
|
||||
dom: new SimpleDom.Document(),
|
||||
cards: defaults.cards,
|
||||
atoms: defaults.atoms,
|
||||
cards: cards,
|
||||
atoms: atoms,
|
||||
unknownCardHandler: function (args) {
|
||||
common.logging.error(new common.errors.InternalServerError({
|
||||
message: 'Mobiledoc card \'' + args.env.name + '\' not found.'
|
@ -11,7 +11,7 @@ var _ = require('lodash'),
|
||||
htmlToText = require('html-to-text'),
|
||||
ghostBookshelf = require('./base'),
|
||||
config = require('../config'),
|
||||
defaultCardsApp = require('../apps/default-cards'),
|
||||
converters = require('../lib/mobiledoc/converters'),
|
||||
urlService = require('../services/url'),
|
||||
Post,
|
||||
Posts;
|
||||
@ -216,7 +216,7 @@ Post = ghostBookshelf.Model.extend({
|
||||
ghostBookshelf.Model.prototype.onSaving.call(this, model, attr, options);
|
||||
|
||||
if (mobiledoc) {
|
||||
this.set('html', defaultCardsApp.converters.mobiledocConverter.render(JSON.parse(mobiledoc)));
|
||||
this.set('html', converters.mobiledocConverter.render(JSON.parse(mobiledoc)));
|
||||
}
|
||||
|
||||
if (this.hasChanged('html') || !this.get('plaintext')) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
var should = require('should'), // jshint ignore:line
|
||||
card = require('../../../../../server/apps/default-cards/atoms/soft-return'),
|
||||
card = require('../../../../../server/lib/mobiledoc/atoms/soft-return'),
|
||||
SimpleDom = require('simple-dom'),
|
||||
opts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
var should = require('should'), // jshint ignore:line
|
||||
card = require('../../../../../server/apps/default-cards/cards/hr'),
|
||||
card = require('../../../../../server/lib/mobiledoc/cards/hr'),
|
||||
SimpleDom = require('simple-dom'),
|
||||
opts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
var should = require('should'), // jshint ignore:line
|
||||
card = require('../../../../../server/apps/default-cards/cards/html'),
|
||||
card = require('../../../../../server/lib/mobiledoc/cards/html'),
|
||||
SimpleDom = require('simple-dom'),
|
||||
opts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
var should = require('should'), // jshint ignore:line
|
||||
card = require('../../../../../server/apps/default-cards/cards/image'),
|
||||
card = require('../../../../../server/lib/mobiledoc/cards/image'),
|
||||
SimpleDom = require('simple-dom'),
|
||||
opts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
var should = require('should'), // jshint ignore:line
|
||||
card = require('../../../../../server/apps/default-cards/cards/markdown'),
|
||||
card = require('../../../../../server/lib/mobiledoc/cards/markdown'),
|
||||
SimpleDom = require('simple-dom'),
|
||||
opts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
var should = require('should'), // jshint ignore:line
|
||||
converter = require('../../../../../server/apps/default-cards/converters/mobiledoc-converter');
|
||||
converter = require('../../../../../server/lib/mobiledoc/converters/mobiledoc-converter');
|
||||
|
||||
describe('Convert mobiledoc to HTML ', function () {
|
||||
var mobiledoc = {
|
@ -47,13 +47,12 @@ describe('Apps', function () {
|
||||
settingsEditStub.callCount.should.eql(0);
|
||||
|
||||
// Test that activate is called 4 times, and install 0 time
|
||||
loaderActivateStub.callCount.should.eql(4);
|
||||
loaderActivateStub.callCount.should.eql(3);
|
||||
loaderInstallStub.callCount.should.eql(0);
|
||||
|
||||
// Test that the 4 internal apps are loaded as expected
|
||||
availableApps.should.be.an.Array().with.lengthOf(4);
|
||||
availableApps.should.be.an.Array().with.lengthOf(3);
|
||||
availableApps.should.containEql('amp');
|
||||
availableApps.should.containEql('default-cards');
|
||||
availableApps.should.containEql('private-blogging');
|
||||
availableApps.should.containEql('subscribers');
|
||||
|
||||
@ -81,13 +80,12 @@ describe('Apps', function () {
|
||||
settingsEditStub.firstCall.args[0].settings[0].value.should.eql(['testA', 'testB']);
|
||||
|
||||
// Test that activate is called 6 times, and install only 1 time
|
||||
loaderActivateStub.callCount.should.eql(6);
|
||||
loaderActivateStub.callCount.should.eql(5);
|
||||
loaderInstallStub.callCount.should.eql(1);
|
||||
|
||||
// Test that the 4 internal apps are loaded as expected
|
||||
availableApps.should.be.an.Array().with.lengthOf(6);
|
||||
availableApps.should.be.an.Array().with.lengthOf(5);
|
||||
availableApps.should.containEql('amp');
|
||||
availableApps.should.containEql('default-cards');
|
||||
availableApps.should.containEql('private-blogging');
|
||||
availableApps.should.containEql('subscribers');
|
||||
availableApps.should.containEql('testA');
|
||||
|
Loading…
Reference in New Issue
Block a user