mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-11 22:13:20 +03:00
🐛 Fixed unnecessary "unsaved changes" modal when using HR cards
no issue - the `hr` mobiledoc card does not specify an `absoluteToRelative` or `relativeToAbsolute` transformer function so falls back to the default transformer - the default transformer function's arguments were not correct which meant that the UrlUtils object was replacing the card's typical empty-object payload - the card's payload changing when saving mobiledoc was triggering the editor's unsaved changes warning because the API response no longer matched what was in the editor
This commit is contained in:
parent
6e024331eb
commit
8b787ac803
@ -1,7 +1,7 @@
|
|||||||
let urlUtils;
|
let urlUtils;
|
||||||
|
|
||||||
module.exports = function createCard(card) {
|
module.exports = function createCard(card) {
|
||||||
const defaultTransformer = function (payload) {
|
const defaultTransformer = function (urlUtils, payload) {
|
||||||
return payload;
|
return payload;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,4 +13,16 @@ describe('HR card', function () {
|
|||||||
|
|
||||||
serializer.serialize(card.render(opts)).should.match('<hr>');
|
serializer.serialize(card.render(opts)).should.match('<hr>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('transforms urls absolute to relative', function () {
|
||||||
|
let payload = {};
|
||||||
|
const transformed = card.absoluteToRelative(payload, {});
|
||||||
|
transformed.should.deepEqual({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('transforms urls relative to absolute', function () {
|
||||||
|
let payload = {};
|
||||||
|
const transformed = card.relativeToAbsolute(payload, {});
|
||||||
|
transformed.should.deepEqual({});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user