Skip to content

Commit 5ab43b6

Browse files
authored
Merge branch 'develop' into eye-icon
2 parents 93ebac5 + 8287b5f commit 5ab43b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+861
-1038
lines changed

client/components/AddRemoveButton.jsx

Lines changed: 0 additions & 32 deletions
This file was deleted.

client/components/NavBasic.jsx

Lines changed: 0 additions & 52 deletions
This file was deleted.

client/components/OverlayManager.jsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

client/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// multiple files
33
export const UPDATE_FILE_CONTENT = 'UPDATE_FILE_CONTENT';
44
export const TOGGLE_SKETCH = 'TOGGLE_SKETCH';
5-
65
export const START_SKETCH = 'START_SKETCH';
76
export const STOP_SKETCH = 'STOP_SKETCH';
87

client/i18n-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import i18n from 'i18next';
22
import { initReactI18next } from 'react-i18next';
3-
43
import translations from '../translations/locales/en-US/translations.json';
54

65
i18n.use(initReactI18next).init({

client/modules/IDE/components/EditableInput.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ function EditableInput({
2828
const { t } = useTranslation();
2929
React.useEffect(() => {
3030
if (isEditing) {
31-
inputRef.current?.focus();
31+
const inputElement = inputRef.current;
32+
inputElement.setSelectionRange(
33+
inputElement.value.length,
34+
inputElement.value.length
35+
);
36+
inputElement.focus();
3237
}
3338
}, [isEditing]);
3439
React.useEffect(() => {

client/modules/IDE/components/Editor/MobileEditor.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const EditorContainer = styled.div`
99
transform: ${(props) =>
1010
props.expanded ? 'translateX(50%)' : 'translateX(0)'};
1111
12-
> header {
12+
> div {
1313
display: flex;
1414
${prop('MobilePanel.secondary')}
1515
> span {

client/modules/IDE/components/Editor/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ class Editor extends React.Component {
208208
if (/^[a-z]$/i.test(e.key) && (mode === 'css' || mode === 'javascript')) {
209209
this.showHint(_cm);
210210
}
211+
if (e.key === 'Escape') {
212+
e.preventDefault();
213+
this._cm.getInputField().blur();
214+
}
211215
});
212216

213217
this._cm.getWrapperElement().style[
@@ -513,7 +517,7 @@ class Editor extends React.Component {
513517
{(matches) =>
514518
matches ? (
515519
<section className={editorSectionClass}>
516-
<header className="editor__header">
520+
<div className="editor__header">
517521
<button
518522
aria-label={this.props.t('Editor.OpenSketchARIA')}
519523
className="sidebar__contract"
@@ -538,7 +542,7 @@ class Editor extends React.Component {
538542
</span>
539543
<Timer />
540544
</div>
541-
</header>
545+
</div>
542546
<article
543547
ref={(element) => {
544548
this.codemirrorContainer = element;
@@ -555,7 +559,7 @@ class Editor extends React.Component {
555559
</section>
556560
) : (
557561
<EditorContainer expanded={this.props.isExpanded}>
558-
<header>
562+
<>
559563
<IconButton
560564
onClick={this.props.expandSidebar}
561565
icon={FolderIcon}
@@ -564,7 +568,7 @@ class Editor extends React.Component {
564568
{this.props.file.name}
565569
<UnsavedChangesIndicator />
566570
</span>
567-
</header>
571+
</>
568572
<section>
569573
<EditorHolder
570574
ref={(element) => {

client/modules/IDE/components/FileNode.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as FileActions from '../actions/files';
1010
import DownArrowIcon from '../../../images/down-filled-triangle.svg';
1111
import FolderRightIcon from '../../../images/triangle-arrow-right.svg';
1212
import FolderDownIcon from '../../../images/triangle-arrow-down.svg';
13-
import FileIcon from '../../../images/file.svg';
13+
import FileTypeIcon from './FileTypeIcon';
1414

1515
function parseFileName(name) {
1616
const nameArray = name.split('.');
@@ -256,6 +256,7 @@ class FileNode extends React.Component {
256256
const isRoot = this.props.name === 'root';
257257

258258
const { t } = this.props;
259+
const { extension } = parseFileName(this.props.name);
259260

260261
return (
261262
<div className={itemClass}>
@@ -267,7 +268,11 @@ class FileNode extends React.Component {
267268
<span className="file-item__spacer"></span>
268269
{isFile && (
269270
<span className="sidebar__file-item-icon">
270-
<FileIcon focusable="false" aria-hidden="true" />
271+
<FileTypeIcon
272+
fileExtension={extension}
273+
focusable="false"
274+
aria-hidden="true"
275+
/>
271276
</span>
272277
)}
273278
{isFolder && (
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { IoLogoHtml5, IoLogoCss3, IoLogoJavascript } from 'react-icons/io';
4+
import { TbFileTypeXml, TbTxt, TbCsv } from 'react-icons/tb';
5+
import { VscJson } from 'react-icons/vsc';
6+
import FileIcon from '../../../images/file.svg';
7+
8+
export default function FileTypeIcon({ fileExtension }) {
9+
switch (fileExtension) {
10+
case '.html':
11+
return (
12+
<span>
13+
<IoLogoHtml5 />
14+
</span>
15+
);
16+
case '.css':
17+
return (
18+
<span>
19+
<IoLogoCss3 />
20+
</span>
21+
);
22+
case '.js':
23+
return (
24+
<span>
25+
<IoLogoJavascript />
26+
</span>
27+
);
28+
case '.json':
29+
return (
30+
<span>
31+
<VscJson />
32+
</span>
33+
);
34+
case '.xml':
35+
return (
36+
<span>
37+
<TbFileTypeXml />
38+
</span>
39+
);
40+
case '.txt':
41+
return (
42+
<span>
43+
<TbTxt />
44+
</span>
45+
);
46+
case '.csv':
47+
return (
48+
<span>
49+
<TbCsv />
50+
</span>
51+
);
52+
default:
53+
return <FileIcon focusable="false" aria-hidden="true" />;
54+
}
55+
}
56+
57+
FileTypeIcon.propTypes = {
58+
fileExtension: PropTypes.string.isRequired
59+
};

0 commit comments

Comments
 (0)