Skip to content

Commit

Permalink
docs: ensure only single demo iframes are selected
Browse files Browse the repository at this point in the history
  • Loading branch information
frshwtr committed Mar 4, 2024
1 parent 2e99d70 commit 78194f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/o2-storybook-composition/addons/html/src/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {PanelContent} from './components/PanelContent';
import {format as prettierFormat} from 'prettier/standalone';
import prettierHtml from 'prettier/parser-html';

const demoUrl = '__origami/service/build/v3/demo';
export const Panel = props => {
// https://storybook.js.org/docs/react/addons/addons-api#useaddonstate
const [{code}, setState] = useAddonState(ADDON_ID, {
Expand All @@ -20,7 +21,10 @@ export const Panel = props => {

const foundIframe = codeDoc.getElementsByTagName('iframe');

if (foundIframe.length === 1) {
if (
foundIframe.length === 1 &&
foundIframe.item(0).src.includes(demoUrl)
) {
console.log(foundIframe.item(0).src);
const demoEndpoint = parser.parseFromString(
foundIframe.item(0).src,
Expand Down

0 comments on commit 78194f3

Please sign in to comment.