Skip to content

Commit f005029

Browse files
authored
Merge branch 'develop' into fix/document-theme
2 parents b571ded + aa99cdd commit f005029

37 files changed

+1349
-562
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
blank_issues_enabled: false
2+
3+
contact_links:
4+
- name: 🌸 p5.js Issues
5+
url: https://github.com/processing/p5.js/issues
6+
about: Report issues with the p5.js here.
7+
- name: 🌐 Website Issues
8+
url: https://github.com/processing/p5.js-website/issues
9+
about: Report issues with the p5.js website here.
10+
- name: 💬 Forum
11+
url: https://discourse.processing.org/c/p5js
12+
about: Have other questions about using p5.js? Ask them here!
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 💡 Existing Feature Enhancement
2+
description: Suggest an improvement to an existing feature.
3+
labels: [ Enhancement ]
4+
body:
5+
- type: textarea
6+
attributes:
7+
label: Increasing Access
8+
description: How would this new feature help [increase access](https://github.com/processing/p5.js/blob/main/contributor_docs/access.md) to the p5.js Web Editor? (If you're not sure, you can type "Unsure" here and let others from the community offer their thoughts.)
9+
validations:
10+
required: true
11+
12+
- type: textarea
13+
attributes:
14+
label: Feature enhancement details
15+
validations:
16+
required: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 🌱 New Feature Request
2+
description: Request a new feature be added.
3+
labels: [ Feature Request ]
4+
body:
5+
- type: textarea
6+
attributes:
7+
label: Increasing Access
8+
description: How would this new feature help [increase access](https://github.com/processing/p5.js/blob/main/contributor_docs/access.md) to the p5.js Web Editor? (If you're not sure, you can type "Unsure" here and let others from the community offer their thoughts.)
9+
validations:
10+
required: true
11+
12+
- type: textarea
13+
attributes:
14+
label: Feature request details
15+
validations:
16+
required: true
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 🐛 Found a Bug
2+
description: Report p5.js web editor bugs (broken or incorrect behaviour).
3+
labels: [ Bug ]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
- Please make sure to [search for existing issues](https://github.com/processing/p5.js-web-editor/issues) before filing a new one!
9+
10+
- type: input
11+
attributes:
12+
label: p5.js version
13+
description: You can find this in the first line of the p5.js file.
14+
validations:
15+
required: false
16+
17+
- type: dropdown
18+
attributes:
19+
label: What is your operating system?
20+
options:
21+
- Windows
22+
- Mac OS
23+
- Linux
24+
- Android
25+
- iOS
26+
- Other (specify if possible)
27+
validations:
28+
required: false
29+
30+
- type: input
31+
attributes:
32+
label: Web browser and version
33+
description: |
34+
In the address bar, on Chrome enter `chrome://version`, on Firefox enter `about:support`. On Safari, use `About Safari`.
35+
validations:
36+
required: false
37+
38+
- type: textarea
39+
attributes:
40+
label: Actual Behavior
41+
placeholder: What is currently happening.
42+
validations:
43+
required: true
44+
45+
- type: textarea
46+
attributes:
47+
label: Expected Behavior
48+
description: |
49+
If you want to include screenshots, paste them into the markdown editor below.
50+
placeholder: What were you expecting?
51+
validations:
52+
required: true
53+
54+
- type: textarea
55+
attributes:
56+
label: Steps to reproduce
57+
description: |
58+
- Add steps to reproduce bugs or add information on the place where the feature should be implemented.
59+
- Add links to a sample deployment or code.
60+
value: "### Steps:
61+
62+
1.
63+
2.
64+
3.
65+
66+
### Snippet:
67+
68+
```js
69+
70+
71+
// Paste your code here :)
72+
73+
74+
```"
75+
validations:
76+
required: true

.github/ISSUE_TEMPLATE/🌱-new-feature-request.md

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

.github/ISSUE_TEMPLATE/🐛-found-a-bug.md

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

.github/ISSUE_TEMPLATE/💡-existing-feature-enhancement.md

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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ terraform/.terraform/
2020

2121
storybook-static
2222
duplicates.json
23+
24+
coverage

client/components/Nav.jsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { logoutUser } from '../modules/User/actions';
1818
import getConfig from '../utils/getConfig';
1919
import { metaKeyName, metaKey } from '../utils/metaKey';
2020
import { getIsUserOwner } from '../modules/IDE/selectors/users';
21+
import { selectSketchPath } from '../modules/IDE/selectors/project';
2122

2223
import CaretLeftIcon from '../images/left-arrow.svg';
2324
import TriangleIcon from '../images/down-filled-triangle.svg';
@@ -245,7 +246,7 @@ class Nav extends React.PureComponent {
245246
/>
246247
</li>
247248
<li className="nav__item nav__item--no-icon">
248-
<Link to="/" className="nav__back-link">
249+
<Link to={this.props.editorLink} className="nav__back-link">
249250
<CaretLeftIcon
250251
className="nav__back-icon"
251252
focusable="false"
@@ -752,6 +753,16 @@ class Nav extends React.PureComponent {
752753
正體中文
753754
</button>
754755
</li>
756+
<li className="nav__dropdown-item">
757+
<button
758+
onFocus={this.handleFocusForLang}
759+
onBlur={this.handleBlur}
760+
value="tr"
761+
onClick={(e) => this.handleLangSelection(e)}
762+
>
763+
Türkçe
764+
</button>
765+
</li>
755766
</ul>
756767
</li>
757768
</React.Fragment>
@@ -980,7 +991,8 @@ Nav.propTypes = {
980991
t: PropTypes.func.isRequired,
981992
setLanguage: PropTypes.func.isRequired,
982993
language: PropTypes.string.isRequired,
983-
isUserOwner: PropTypes.bool.isRequired
994+
isUserOwner: PropTypes.bool.isRequired,
995+
editorLink: PropTypes.string
984996
};
985997

986998
Nav.defaultProps = {
@@ -993,7 +1005,8 @@ Nav.defaultProps = {
9931005
warnIfUnsavedChanges: undefined,
9941006
params: {
9951007
username: undefined
996-
}
1008+
},
1009+
editorLink: '/'
9971010
};
9981011

9991012
function mapStateToProps(state) {
@@ -1003,7 +1016,8 @@ function mapStateToProps(state) {
10031016
unsavedChanges: state.ide.unsavedChanges,
10041017
rootFile: state.files.filter((file) => file.name === 'root')[0],
10051018
language: state.preferences.language,
1006-
isUserOwner: getIsUserOwner(state)
1019+
isUserOwner: getIsUserOwner(state),
1020+
editorLink: selectSketchPath(state)
10071021
};
10081022
}
10091023

client/i18n.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
zhCN,
1616
zhTW,
1717
uk,
18-
sv
18+
sv,
19+
tr
1920
} from 'date-fns/locale';
2021

2122
const fallbackLng = ['en-US'];
@@ -32,7 +33,8 @@ const availableLanguages = [
3233
'sv',
3334
'uk-UA',
3435
'zh-CN',
35-
'zh-TW'
36+
'zh-TW',
37+
'tr'
3638
];
3739

3840
export function languageKeyToLabel(lang) {
@@ -49,7 +51,8 @@ export function languageKeyToLabel(lang) {
4951
sv: 'Svenska',
5052
'uk-UA': 'Українська',
5153
'zh-CN': '简体中文',
52-
'zh-TW': '正體中文'
54+
'zh-TW': '正體中文',
55+
tr: 'Türkçe'
5356
};
5457
return languageMap[lang];
5558
}
@@ -68,7 +71,8 @@ export function languageKeyToDateLocale(lang) {
6871
sv,
6972
'uk-UA': uk,
7073
'zh-CN': zhCN,
71-
'zh-TW': zhTW
74+
'zh-TW': zhTW,
75+
tr
7276
};
7377
return languageMap[lang];
7478
}

client/modules/IDE/components/Editor.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ class Editor extends React.Component {
158158
// choose a color, it deletes characters inline. This is a
159159
// hack to prevent that.
160160
[`${metaKey}-K`]: (cm, event) =>
161-
cm.state.colorpicker.popup_color_picker({ length: 0 })
161+
cm.state.colorpicker.popup_color_picker({ length: 0 }),
162+
[`${metaKey}-.`]: 'toggleComment' // Note: most adblockers use the shortcut ctrl+.
162163
});
163164

164165
this.initializeDocuments(this.props.files);
@@ -312,7 +313,7 @@ class Editor extends React.Component {
312313
mode = 'application/json';
313314
} else if (fileName.match(/.+\.(frag|glsl)$/i)) {
314315
mode = 'x-shader/x-fragment';
315-
} else if (fileName.match(/.+\.(vert)$/i)) {
316+
} else if (fileName.match(/.+\.(vert|stl)$/i)) {
316317
mode = 'x-shader/x-vertex';
317318
} else {
318319
mode = 'text/plain';

client/modules/IDE/components/KeyboardShortcutModal.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ function KeyboardShortcutModal() {
6161
<span className="keyboard-shortcut__command">{metaKeyName} + /</span>
6262
<span>{t('KeyboardShortcuts.CodeEditing.CommentLine')}</span>
6363
</li>
64+
<li className="keyboard-shortcut-item">
65+
<span className="keyboard-shortcut__command">{metaKeyName} + .</span>
66+
<span>{t('KeyboardShortcuts.CodeEditing.CommentLine')}</span>
67+
</li>
6468
<li className="keyboard-shortcut-item">
6569
<span className="keyboard-shortcut__command">{metaKeyName} + K</span>
6670
<span>{t('KeyboardShortcuts.CodeEditing.ColorPicker')}</span>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import classNames from 'classnames';
2+
import PropTypes from 'prop-types';
3+
import React, { useEffect, useRef } from 'react';
4+
import ExitIcon from '../../../images/exit.svg';
5+
6+
// Common logic from NewFolderModal, NewFileModal, UploadFileModal
7+
8+
const Modal = ({
9+
title,
10+
onClose,
11+
closeAriaLabel,
12+
contentClassName,
13+
children
14+
}) => {
15+
const modalRef = useRef(null);
16+
17+
const handleOutsideClick = (e) => {
18+
// ignore clicks on the component itself
19+
if (modalRef.current?.contains?.(e.target)) return;
20+
21+
onClose();
22+
};
23+
24+
useEffect(() => {
25+
modalRef.current?.focus();
26+
document.addEventListener('click', handleOutsideClick, false);
27+
28+
return () => {
29+
document.removeEventListener('click', handleOutsideClick, false);
30+
};
31+
}, []);
32+
33+
return (
34+
<section className="modal" ref={modalRef}>
35+
<div className={classNames('modal-content', contentClassName)}>
36+
<div className="modal__header">
37+
<h2 className="modal__title">{title}</h2>
38+
<button
39+
className="modal__exit-button"
40+
onClick={onClose}
41+
aria-label={closeAriaLabel}
42+
>
43+
<ExitIcon focusable="false" aria-hidden="true" />
44+
</button>
45+
</div>
46+
{children}
47+
</div>
48+
</section>
49+
);
50+
};
51+
52+
Modal.propTypes = {
53+
title: PropTypes.string.isRequired,
54+
onClose: PropTypes.func.isRequired,
55+
closeAriaLabel: PropTypes.string.isRequired,
56+
contentClassName: PropTypes.string,
57+
children: PropTypes.node.isRequired
58+
};
59+
60+
Modal.defaultProps = {
61+
contentClassName: ''
62+
};
63+
64+
export default Modal;

0 commit comments

Comments
 (0)