diff --git a/core/test/unit/api/v2/utils/serializers/input/posts_spec.js b/core/test/unit/api/v2/utils/serializers/input/posts_spec.js index a7ee328bfb..908c9e8ad6 100644 --- a/core/test/unit/api/v2/utils/serializers/input/posts_spec.js +++ b/core/test/unit/api/v2/utils/serializers/input/posts_spec.js @@ -448,6 +448,28 @@ describe('Unit: v2/utils/serializers/input/posts', function () { postData.mobiledoc.should.not.equal(mobiledoc); postData.mobiledoc.should.equal('{"version":"0.3.1","atoms":[],"cards":[],"markups":[],"sections":[[1,"p",[[0,[],0,"this is great feature"]]]]}'); }); + + it('preserves html cards in transformed html', function () { + const apiConfig = {}; + const frame = { + options: { + source: 'html' + }, + data: { + posts: [ + { + id: 'id1', + html: '

this is great feature

\n
My Custom HTML
\n

custom html preserved!

', + } + ] + } + }; + + serializers.input.posts.edit(apiConfig, frame); + + let postData = frame.data.posts[0]; + postData.mobiledoc.should.equal('{"version":"0.3.1","atoms":[],"cards":[["html",{"html":"
My Custom HTML
"}]],"markups":[],"sections":[[1,"p",[[0,[],0,"this is great feature"]]],[10,0],[1,"p",[[0,[],0,"custom html preserved!"]]]]}'); + }); }); describe('Ensure relations format', function () { diff --git a/package.json b/package.json index b54fe0c98d..45a57da3d7 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "xml": "1.0.1" }, "optionalDependencies": { - "@tryghost/html-to-mobiledoc": "0.3.0", + "@tryghost/html-to-mobiledoc": "0.4.0", "sharp": "0.21.3", "sqlite3": "4.0.6" }, diff --git a/yarn.lock b/yarn.lock index 236c7d55de..c320b03856 100644 --- a/yarn.lock +++ b/yarn.lock @@ -111,13 +111,13 @@ dependencies: lodash-es "^4.17.11" -"@tryghost/html-to-mobiledoc@0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@tryghost/html-to-mobiledoc/-/html-to-mobiledoc-0.3.0.tgz#6985fac775000c0ea96c3a36e3275c68a8b83f7e" - integrity sha512-X69oETTdfjSwi99t0tMkRzwNBrNBOV4elhS0kpDuvfQ/zKhuzlRgjvsGIvzX8zG0/NYm1ZlUaOpgBRz6i6P17w== +"@tryghost/html-to-mobiledoc@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@tryghost/html-to-mobiledoc/-/html-to-mobiledoc-0.4.0.tgz#2dd7111c10213634bfd39dc00d5171abe0f2a321" + integrity sha512-YIBqjfXy2l51/zMpNuHilDkZizxF7WYRkATKqh7uKy2UJs+yeJq9gwQBojAvwDOc8Lmdwj/sJGLlg5jWs9dRCA== dependencies: - "@tryghost/kg-parser-plugins" "^0.4.1" - "@tryghost/mobiledoc-kit" "^0.11.2-ghost.1" + "@tryghost/kg-parser-plugins" "^0.5.0" + "@tryghost/mobiledoc-kit" "^0.11.2-ghost.3" jsdom "14.1.0" "@tryghost/kg-clean-basic-html@^0.1.1": @@ -125,10 +125,10 @@ resolved "https://registry.yarnpkg.com/@tryghost/kg-clean-basic-html/-/kg-clean-basic-html-0.1.1.tgz#a065a5771c29af47d7e681fc6ac2db445b839daf" integrity sha512-pHszGBQMo6r9YTg9VTDJsn0+i+rRNTs09dAMI8ZbD11AP0ten5XJxIqLQuDJJwIrchZ91J2rl+LMgnQo1yIyNw== -"@tryghost/kg-parser-plugins@^0.4.1": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@tryghost/kg-parser-plugins/-/kg-parser-plugins-0.4.1.tgz#d504976e2ec9eb5fdfdca19fecf3a03a94aebf08" - integrity sha512-J1Gn91hIG2pxgwWymPnKcsWsF4BB08tR+Qdg9uqyE5JGwIGGQdNTxgbXSRaMOcHorlmNKqb0bZlnk2l2d/AAYA== +"@tryghost/kg-parser-plugins@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@tryghost/kg-parser-plugins/-/kg-parser-plugins-0.5.0.tgz#def06ea586e1a075105531f289d49f9c91996203" + integrity sha512-0Vq0lfSXKkn8mLYb4Wz0VlK7pNtrhoioPQnG8o+/Juu8r4CHtHiLgGqTPWzPntd4wXNnBLAS3SppPE5GRM1Wng== dependencies: "@tryghost/kg-clean-basic-html" "^0.1.1" @@ -184,10 +184,10 @@ ghost-ignition "^3.1.0" lodash "^4.17.11" -"@tryghost/mobiledoc-kit@^0.11.2-ghost.1": - version "0.11.2-ghost.1" - resolved "https://registry.yarnpkg.com/@tryghost/mobiledoc-kit/-/mobiledoc-kit-0.11.2-ghost.1.tgz#7088eb9eef06b4ccdd6c221613f20d01b106f939" - integrity sha512-oc5zAQiEzq0oSUb3NpAXHvfcQ+FOjzQ+1sRNv2QwSJ+JftanpdFvgmc9BwX8dZAlHA/NOnrIeTW1Q2Ip9Nm2Ag== +"@tryghost/mobiledoc-kit@^0.11.2-ghost.3": + version "0.11.2-ghost.3" + resolved "https://registry.yarnpkg.com/@tryghost/mobiledoc-kit/-/mobiledoc-kit-0.11.2-ghost.3.tgz#15d5ad0ce0b2c4322ba5e2fc87f641dcb387e8ff" + integrity sha512-R07zG7vLViPt2SmJSQXPTdgakfsra9GcP+O2saa0SYzfdTE/+3+hMo0PgJSwcyCx898mJmQv6L1lgu7N7qjihw== dependencies: mobiledoc-dom-renderer "0.6.5" mobiledoc-text-renderer "0.3.2"