Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 69d3c63

Browse files
committed
🐛 Koenig - Fixed pasting of plain text
refs TryGhost/Ghost#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
1 parent ad6b7c9 commit 69d3c63

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

lib/koenig-editor/addon/helpers/sanitize-html.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export function sanitizeHtml(params, options = {}) {
1919
}
2020

2121
// sanitize html
22-
html = html_sanitize(html, cajaSanitizers.url, cajaSanitizers.id);
23-
24-
return htmlSafe(html);
22+
return html_sanitize(html, cajaSanitizers.url, cajaSanitizers.id);
2523
}
2624

2725
export default helper(sanitizeHtml);

lib/koenig-editor/addon/templates/components/koenig-card-html.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
update=(action "updateHtml")
2020
}}
2121
{{else}}
22-
<div class="koenig-card-html-rendered">{{sanitize-html payload.html}}</div>
22+
<div class="koenig-card-html-rendered">{{{sanitize-html payload.html}}}</div>
2323
<div class="koenig-card-click-overlay"></div>
2424
{{/if}}
2525
{{/koenig-card}}

tests/integration/helpers/sanitize-html-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ describe('Integration: Helper: sanitize-html', function () {
1111
it('renders html', function () {
1212
this.set('inputValue', '<strong>bold</strong>');
1313

14-
this.render(hbs`{{sanitize-html inputValue}}`);
14+
this.render(hbs`{{{sanitize-html inputValue}}}`);
1515

1616
expect(this.$().html().trim()).to.equal('<strong>bold</strong>');
1717
});
1818

1919
it('replaces scripts', function () {
2020
this.set('inputValue', '<script></script>');
2121

22-
this.render(hbs`{{sanitize-html inputValue}}`);
22+
this.render(hbs`{{{sanitize-html inputValue}}}`);
2323

2424
expect(this.$().html().trim()).to.equal('<pre class="js-embed-placeholder">Embedded JavaScript</pre>');
2525
});

0 commit comments

Comments
 (0)