Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Omit development hash for amp-stories on playground preview #5972

Merged
merged 2 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion playground/src/preview/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import createLoader from '../loader/base.js';
import modes from '../modes/';
import * as StateView from '../state-view/state-view.js';
import * as Experiment from '../experiments/experiments.js';
import detectRuntime from '../runtime/detector.js';

const PARAM_MODE = 'mode';
const PARAM_WIDTH = 'width';
Expand Down Expand Up @@ -273,7 +274,10 @@ class Preview {
childDoc.write(this.documentString);
childDoc.close();
// Enable development mode for preview iframe
childWindow.location.hash = '#development=1';
childWindow.location.hash =
detectRuntime(this.documentString).id === 'amp4stories'
? ''
: '#development=1';
childWindow.console.error = () => {};

(childWindow.AMP = childWindow.AMP || []).push(() => {
Expand Down
2 changes: 1 addition & 1 deletion playground/src/runtime/detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import runtimes from './runtimes.js';

const STORY_REGEX = /<amp-story\s+standalone\s*>/i;
const STORY_REGEX = /<amp-story\s+standalone(\s.*[^>])*>/i;
const AMPHTML_AD_REGEX = /amp4ads-boilerplate/i;
const EMAIL_REGEX = /amp4email-boilerplate/i;

Expand Down