🐛 Koenig - Fixed pasting of plain text

refs https://github.com/TryGhost/Ghost/issues/9724
- `formatMarkdown` was previously changed to return a SafeString but that meant any direct usage of the helper had to account for not dealing with a basic String type
- changed `formatMarkdown` to return a basic String
- modified helper usage of `{{sanitize-html}}` to use triple-curlies
This commit is contained in:
Kevin Ansfield 2018-08-15 16:25:02 +01:00
parent 067fbd4c34
commit 8c2ff43707
3 changed files with 4 additions and 6 deletions

View File

@ -19,9 +19,7 @@ export function sanitizeHtml(params, options = {}) {
}
// sanitize html
html = html_sanitize(html, cajaSanitizers.url, cajaSanitizers.id);
return htmlSafe(html);
return html_sanitize(html, cajaSanitizers.url, cajaSanitizers.id);
}
export default helper(sanitizeHtml);

View File

@ -19,7 +19,7 @@
update=(action "updateHtml")
}}
{{else}}
<div class="koenig-card-html-rendered">{{sanitize-html payload.html}}</div>
<div class="koenig-card-html-rendered">{{{sanitize-html payload.html}}}</div>
<div class="koenig-card-click-overlay"></div>
{{/if}}
{{/koenig-card}}

View File

@ -11,7 +11,7 @@ describe('Integration: Helper: sanitize-html', function () {
it('renders html', function () {
this.set('inputValue', '<strong>bold</strong>');
this.render(hbs`{{sanitize-html inputValue}}`);
this.render(hbs`{{{sanitize-html inputValue}}}`);
expect(this.$().html().trim()).to.equal('<strong>bold</strong>');
});
@ -19,7 +19,7 @@ describe('Integration: Helper: sanitize-html', function () {
it('replaces scripts', function () {
this.set('inputValue', '<script></script>');
this.render(hbs`{{sanitize-html inputValue}}`);
this.render(hbs`{{{sanitize-html inputValue}}}`);
expect(this.$().html().trim()).to.equal('<pre class="js-embed-placeholder">Embedded JavaScript</pre>');
});