fix: restore preview background to white (#36714)
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.enable-iframe {
|
.enable-iframe {
|
||||||
|
@ -9,7 +9,6 @@ import {
|
|||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
|
|
||||||
import { compileHeadTail, setExt, transformContents } from '../utils/polyvinyl';
|
import { compileHeadTail, setExt, transformContents } from '../utils/polyvinyl';
|
||||||
import { nightThemeStyle } from './displayStyle.js';
|
|
||||||
|
|
||||||
const htmlCatch = '\n<!--fcc-->\n';
|
const htmlCatch = '\n<!--fcc-->\n';
|
||||||
const jsCatch = '\n;/*fcc*/\n';
|
const jsCatch = '\n;/*fcc*/\n';
|
||||||
@ -57,15 +56,8 @@ export const cssToHtml = cond([
|
|||||||
[stubTrue, identity]
|
[stubTrue, identity]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function concatHtml({
|
export function concatHtml({ required = [], template, files = [] } = {}) {
|
||||||
required = [],
|
|
||||||
template,
|
|
||||||
files = [],
|
|
||||||
theme = 'night'
|
|
||||||
} = {}) {
|
|
||||||
theme = theme === '' ? 'night' : theme;
|
|
||||||
const createBody = template ? _template(template) : defaultTemplate;
|
const createBody = template ? _template(template) : defaultTemplate;
|
||||||
const displayTheme = theme === 'night' ? nightThemeStyle : ` `;
|
|
||||||
const head = required
|
const head = required
|
||||||
.map(({ link, src }) => {
|
.map(({ link, src }) => {
|
||||||
if (link && src) {
|
if (link && src) {
|
||||||
@ -81,7 +73,7 @@ A required file can not have both a src and a link: src = ${src}, link = ${link}
|
|||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
})
|
})
|
||||||
.reduce((head, element) => head.concat(element), displayTheme);
|
.reduce((head, element) => head.concat(element));
|
||||||
|
|
||||||
const source = files.reduce(
|
const source = files.reduce(
|
||||||
(source, file) => source.concat(file.contents, htmlCatch),
|
(source, file) => source.concat(file.contents, htmlCatch),
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
export const nightThemeStyle = `
|
|
||||||
<style>
|
|
||||||
html{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: #99c9ff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
`;
|
|
@ -15,7 +15,6 @@ import { createIdToNameMapSaga } from './id-to-name-map-saga';
|
|||||||
import { createExecuteChallengeSaga } from './execute-challenge-saga';
|
import { createExecuteChallengeSaga } from './execute-challenge-saga';
|
||||||
import { createCurrentChallengeSaga } from './current-challenge-saga';
|
import { createCurrentChallengeSaga } from './current-challenge-saga';
|
||||||
import { challengeTypes } from '../../../../utils/challengeTypes';
|
import { challengeTypes } from '../../../../utils/challengeTypes';
|
||||||
import { userSelector } from '../../../redux';
|
|
||||||
|
|
||||||
export const ns = 'challenge';
|
export const ns = 'challenge';
|
||||||
export const backendNS = 'backendChallenge';
|
export const backendNS = 'backendChallenge';
|
||||||
@ -183,7 +182,6 @@ export const projectFormValuesSelector = state =>
|
|||||||
state[ns].projectFormValues || {};
|
state[ns].projectFormValues || {};
|
||||||
|
|
||||||
export const challengeDataSelector = state => {
|
export const challengeDataSelector = state => {
|
||||||
const { theme } = userSelector(state);
|
|
||||||
const { challengeType } = challengeMetaSelector(state);
|
const { challengeType } = challengeMetaSelector(state);
|
||||||
let challengeData = { challengeType };
|
let challengeData = { challengeType };
|
||||||
if (
|
if (
|
||||||
@ -225,7 +223,6 @@ export const challengeDataSelector = state => {
|
|||||||
template
|
template
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
challengeData.theme = theme;
|
|
||||||
return challengeData;
|
return challengeData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,12 +108,7 @@ async function getDOMTestRunner(buildData, proxyLogger, document) {
|
|||||||
runTestInTestFrame(document, testString, testTimeout);
|
runTestInTestFrame(document, testString, testTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildDOMChallenge({
|
export function buildDOMChallenge({ files, required = [], template = '' }) {
|
||||||
files,
|
|
||||||
required = [],
|
|
||||||
template = '',
|
|
||||||
theme = ``
|
|
||||||
}) {
|
|
||||||
const finalRequires = [...globalRequires, ...required, ...frameRunner];
|
const finalRequires = [...globalRequires, ...required, ...frameRunner];
|
||||||
const loadEnzyme = Object.keys(files).some(key => files[key].ext === 'jsx');
|
const loadEnzyme = Object.keys(files).some(key => files[key].ext === 'jsx');
|
||||||
const toHtml = [jsToHtml, cssToHtml];
|
const toHtml = [jsToHtml, cssToHtml];
|
||||||
@ -125,7 +120,7 @@ export function buildDOMChallenge({
|
|||||||
.then(checkFilesErrors)
|
.then(checkFilesErrors)
|
||||||
.then(files => ({
|
.then(files => ({
|
||||||
challengeType: challengeTypes.html,
|
challengeType: challengeTypes.html,
|
||||||
build: concatHtml({ required: finalRequires, template, files, theme }),
|
build: concatHtml({ required: finalRequires, template, files }),
|
||||||
sources: buildSourceMap(files),
|
sources: buildSourceMap(files),
|
||||||
loadEnzyme
|
loadEnzyme
|
||||||
}));
|
}));
|
||||||
|
Reference in New Issue
Block a user