Skip to content

Commit

Permalink
Make iframe as an additional safe tag in story.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwu2018 committed Aug 18, 2023
1 parent 9aa269f commit 0a02810
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#### next release (8.3.3)

- Allow a story to use iframe tag
- [The next improvement]

#### 8.3.2 - 2023-08-11
Expand Down
3 changes: 1 addition & 2 deletions lib/ReactViews/Story/StoryPanel/StoryBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ const StoryBody = ({
{ showExternalLinkWarning: true },
false,
{
ALLOWED_TAGS: ["iframe"],
ALLOWED_ATTR: ["src", "width", "height"]
ADD_TAGS: ["iframe"]
}
)}
</Text>
Expand Down
8 changes: 4 additions & 4 deletions test/ReactViews/Story/StoryPanel/StoryBodySpec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
describe("StoryBody", function () {
let testRenderer: ReactTestRenderer;

it("should include embedded media using iframe tag with allowed attributes only", function () {
it("should include embedded media using iframe tag", function () {
const theStory = {
id: "some id",
title: "test",
text: 'Story with video. <iframe title="Special Title" width="560" height="315" src="https://some.video.link"></iframe>'
text: 'Story with video. <iframe title="My Title" width="560" height="315" src="https://some.video.link"></iframe>'
};

act(() => {
Expand All @@ -37,13 +37,13 @@ describe("StoryBody", function () {

const theIframeInstance = theInstance.children[1] as ReactTestInstance;
expect(theIframeInstance.type).toBe("iframe");
expect(theIframeInstance.props.title).toBe(undefined);
expect(theIframeInstance.props.title).toBe("My Title");
expect(theIframeInstance.props.src).toBe("https://some.video.link");
expect(theIframeInstance.props.width).toBe("560");
expect(theIframeInstance.props.height).toBe("315");
});

it("should exclude embedded media using tags other than iframe", function () {
it("should exclude embedded media using tags other unsafe tag", function () {
const theStory = {
id: "some id",
title: "test",
Expand Down

0 comments on commit 0a02810

Please sign in to comment.