diff --git a/src/core/components/array-model.jsx b/src/core/components/array-model.jsx index 725c0918..db9c9486 100644 --- a/src/core/components/array-model.jsx +++ b/src/core/components/array-model.jsx @@ -46,7 +46,7 @@ export default class ArrayModel extends Component { properties.size ? properties.entrySeq().map( ( [ key, v ] ) => ) : null } { - !description ? null : + !description ? (properties.size ?
: null) : } diff --git a/src/core/components/online-validator-badge.jsx b/src/core/components/online-validator-badge.jsx index 36fab756..3878b29c 100644 --- a/src/core/components/online-validator-badge.jsx +++ b/src/core/components/online-validator-badge.jsx @@ -101,7 +101,7 @@ class ValidatorImage extends React.Component { if (this.state.error) { return {"Error"} } else if (!this.state.loaded) { - return {"Loading..."} + return null } return {this.props.alt} } diff --git a/src/core/components/providers/markdown.jsx b/src/core/components/providers/markdown.jsx index a4cbf3f9..9707ece6 100644 --- a/src/core/components/providers/markdown.jsx +++ b/src/core/components/providers/markdown.jsx @@ -46,6 +46,7 @@ const sanitizeOptions = { "td": [ "colspan" ], "*": [ "class" ] }, + allowedSchemesByTag: { img: [ "http", "https", "data" ] }, textFilter: function(text) { return text.replace(/"/g, "\"") } diff --git a/test/components/markdown.js b/test/components/markdown.js index c3a716a3..cf208510 100644 --- a/test/components/markdown.js +++ b/test/components/markdown.js @@ -24,6 +24,18 @@ describe("Markdown component", function() { const el = render() expect(el.html()).toEqual(`

\n
`) }) + + it("allows image elements with https scheme", function() { + const str = `![Image alt text](https://image.source "Image title")` + const el = render() + expect(el.html()).toEqual(`

\n
`) + }) + + it("allows image elements with data scheme", function() { + const str = `` + const el = render() + expect(el.html()).toEqual(`

` + str + `

\n
`) + }) it("allows heading elements", function() { const str = ` @@ -51,6 +63,18 @@ describe("Markdown component", function() { expect(el.html()).toEqual(`

`) }) + it("allows image elements with https scheme", function() { + const str = `![Image alt text](https://image.source "Image title")` + const el = render() + expect(el.html()).toEqual(`

`) + }) + + it("allows image elements with data scheme", function() { + const str = `` + const el = render() + expect(el.html()).toEqual(`
` + str + `
`) + }) + it("allows heading elements", function() { const str = ` # h1