Skip to content

Fix: Zoom enlarged by default #2430

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 9 additions & 2 deletions src/components/PreviewFrame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';

import {CompiledProject as CompiledProjectRecord} from '../records';
import bowser from '../services/bowser';
import bowser, { innerWidth } from '../services/bowser';
import {sourceDelimiter} from '../util/compileProject';
import {createError} from '../util/errorUtils';
import retryingFailedImports from '../util/retryingFailedImports';
Expand All @@ -30,6 +30,13 @@ class PreviewFrame extends React.Component {
compiledProject: {source},
} = props;

const isWindowSmall = innerWidth < 1366;
const increaseIFrameBodyFont = `<style>
body {
font-size: 1.5em;
}
</style>`;

bindAll(this, '_attachToFrame', '_handleInfiniteLoop');

this.render = constant(
Expand All @@ -39,7 +46,7 @@ class PreviewFrame extends React.Component {
name={`preview-frame-${nextId++}`}
ref={this._attachToFrame}
sandbox={sandboxOptions}
srcDoc={source}
srcDoc={source + (isWindowSmall ? increaseIFrameBodyFont : "")}
/>
</div>,
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProjectPreview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function ProjectPreview({
{preview.slice(0, MAX_LENGTH)}
{!isNil(project.updatedAt) && (
<div className="project-preview__timestamp">
{moment(project.updatedAt).fromNow()}
{moment(project.updatedAt).fromNow() || '\b'}
</div>
)}
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/css/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,12 @@ body {
font-size: 14px;
}

@media only screen and (max-width: 1366px) {
.editors {
font-size: 18px;
}
}

.editors__editor-container {
box-sizing: border-box;
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion src/services/bowser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Bowser from 'bowser';

export default Bowser.getParser(window.navigator.userAgent);
export const innerWidth = window.innerWidth;
2 changes: 1 addition & 1 deletion src/util/compileProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export async function addJavascript(doc, {sources: {javascript}}, opts) {

export function generateTextPreview(project) {
const {title} = constructDocument(project);
return (title || '').trim();
return (title || '\b').trim();
}

export default async function compileProject(project, {isInlinePreview} = {}) {
Expand Down