Skip to content

Commit 3e1a822

Browse files
authored
Merge branch 'develop' into refactor/modal
2 parents 1a939a4 + a6e7cf5 commit 3e1a822

29 files changed

+1121
-244
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.

client/common/Button.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Button.propTypes = {
257257
* The visible part of the button, telling the user what
258258
* the action is
259259
*/
260-
children: PropTypes.element,
260+
children: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
261261
/**
262262
If the button can be activated or not
263263
*/

client/components/Nav.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,16 @@ class Nav extends React.PureComponent {
752752
正體中文
753753
</button>
754754
</li>
755+
<li className="nav__dropdown-item">
756+
<button
757+
onFocus={this.handleFocusForLang}
758+
onBlur={this.handleBlur}
759+
value="tr"
760+
onClick={(e) => this.handleLangSelection(e)}
761+
>
762+
Türkçe
763+
</button>
764+
</li>
755765
</ul>
756766
</li>
757767
</React.Fragment>

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>

client/modules/IDE/components/Toolbar.jsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Toolbar extends React.Component {
1818
super(props);
1919
this.handleKeyPress = this.handleKeyPress.bind(this);
2020
this.handleProjectNameChange = this.handleProjectNameChange.bind(this);
21+
this.handleProjectNameClick = this.handleProjectNameClick.bind(this);
2122
this.handleProjectNameSave = this.handleProjectNameSave.bind(this);
2223

2324
this.state = {
@@ -36,6 +37,15 @@ class Toolbar extends React.Component {
3637
this.setState({ projectNameInputValue: event.target.value });
3738
}
3839

40+
handleProjectNameClick() {
41+
if (this.canEditProjectName) {
42+
this.props.showEditProjectName();
43+
setTimeout(() => {
44+
this.projectNameInput?.focus();
45+
}, 140);
46+
}
47+
}
48+
3949
handleProjectNameSave() {
4050
const newProjectName = this.state.projectNameInputValue.trim();
4151
if (newProjectName.length === 0) {
@@ -132,12 +142,7 @@ class Toolbar extends React.Component {
132142
<div className={nameContainerClass}>
133143
<button
134144
className="toolbar__project-name"
135-
onClick={() => {
136-
if (canEditProjectName) {
137-
this.props.showEditProjectName();
138-
setTimeout(() => this.projectNameInput.focus(), 140);
139-
}
140-
}}
145+
onClick={this.handleProjectNameClick}
141146
disabled={!canEditProjectName}
142147
aria-label={this.props.t('Toolbar.EditSketchARIA')}
143148
>

client/styles/components/_preferences.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
flex-direction: column;
1818
}
1919
& .react-tabs__tab-panel {
20-
overflow-y: scroll;
20+
overflow-y: auto;
2121
}
2222
}
2323

contributor_docs/accessibility.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ The code for the p5.js web editor adheres to web accessibility standards. The fo
88

99
* Screen Readers are an assistive technology for vision loss that helps users to navigate a web page. They are able to prioritize content based on the semantic meaning of HTML tags. Therefore, it is important to use specific tags, such as `nav`, `ul`, `li`, `section`, and so on. `div` is the least screen reader-friendly tag. For example, [here is the semantic meaning of the `body` tag](http://html5doctor.com/element-index/#body)
1010
* All buttons/links/windows need to be accessible by the keyboard ( By tabbing, pressing space etc.)
11-
* In cases where tags are not screen reader-friendly, we can take advantage of [tabIndex](http://webaim.org/techniques/keyboard/tabindex). Using tabIndex ensures that all elements are accessible via keyboard. [code example](https://github.com/processing/p5.js-web-editor/blob/develop/client/modules/IDE/components/Editor.jsx#L249)
12-
* When opening a new window or pop up window, ensure the keyboard focus also moves to the new window. [code example](https://github.com/processing/p5.js-web-editor/blob/develop/client/modules/IDE/components/NewFileForm.jsx#L16)
11+
* In cases where tags are not screen reader-friendly, we can take advantage of [tabIndex](http://webaim.org/techniques/keyboard/tabindex). Using tabIndex ensures that all elements are accessible via keyboard. [code example](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/modules/IDE/components/Sidebar.jsx#L88)
12+
* When opening a new window or pop up window, ensure the keyboard focus also moves to the new window. [code example](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/modules/IDE/components/NewFileForm.jsx#L32)
1313

1414
**Labeling**
1515

16-
* When creating button icons, images, or something without text (this does not include an HTML5 `<button>`), use [aria-labels](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute). [code example](https://github.com/processing/p5.js-web-editor/blob/develop/client/modules/IDE/components/Toolbar.jsx#L67)
17-
* All `<table>`s need to have a `summary` attribute. This will ensure user is given context to what the table is. [code example](https://github.com/processing/p5.js-web-editor/blob/develop/client/modules/IDE/components/SketchList.jsx#L39)
18-
* `ul`s and `nav`s menus need to include a title. [code example](https://github.com/processing/p5.js-web-editor/blob/develop/client/components/Nav.jsx#L7)
16+
* When creating button icons, images, or something without text (this does not include an HTML5 `<button>`), use [aria-labels](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label). [code example](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/modules/IDE/components/Toolbar.jsx#L107)
17+
* All `<table>`s need to have a `summary` attribute. This will ensure user is given context to what the table is. [code example](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/modules/IDE/components/SketchList.jsx#L491)
18+
* `ul`s and `nav`s menus need to include a title. [code example](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/components/Nav.jsx#L281)
1919

2020
For more information on accessibility see the [teach access tutorial](https://teachaccess.github.io/tutorial/)

contributor_docs/development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ See the [release guide](./release.md) for information about creating a release.
3030
## Tests
3131
To run the test suite simply run `npm test` (after installing dependencies with `npm install`)
3232

33-
A sample unit test could be found here: [Nav.test.jsx](../client/components/__test__/Nav.test.jsx).
33+
A sample unit test could be found here: [Nav.unit.test.jsx](../client/components/Nav.unit.test.jsx).
3434

3535
## Committing Code
3636
Inspired by [Git/GitHub commit standards & conventions](https://gist.github.com/digitaljhelms/3761873).
@@ -73,7 +73,7 @@ Structure your commit message like this:
7373
* Note that you can connect multiple issues to a commit, if necessary: `[#123][#456] Add Button component`
7474

7575
## Design
76-
- [Style Guide/Design System on Figma](https://github.com/processing/p5.js-web-editor/labels/good%20medium%20issues)
76+
- [Style Guide/Design System on Zeplin](https://scene.zeplin.io/project/55f746c54a02e1e50e0632c3)
7777
- [Latest Design on Figma](https://www.figma.com/file/5KychMUfHlq97H0uDsen1U/p5-web-editor-2017.p.copy?node-id=0%3A1). Note that the current design on the website has diverged, parts of this design will not be implemented, but it is still helpful to have around for reference.
7878
- [Mobile Designs](https://www.figma.com/file/5KychMUfHlq97H0uDsen1U/p5-web-editor-2017.p.copy?node-id=0%3A2529), [Responsive Designs](https://www.figma.com/file/5KychMUfHlq97H0uDsen1U/p5-web-editor-2017.p.copy?node-id=0%3A3292)
7979

contributor_docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Note that this takes up a significant amount of space on your machine. Make sure
4949
3. Clone this repository and cd into it
5050
4. `$ docker-compose -f docker-compose-development.yml build`
5151
5. `$ cp .env.example .env`
52-
6. (Optional) Update `.env` with necessary keys to enable certain app behavoirs, i.e. add Github ID and Github Secret if you want to be able to log in with Github.
52+
6. (Optional) Update `.env` with necessary keys to enable certain app behaviors, i.e. add Github ID and Github Secret if you want to be able to log in with Github.
5353
7. `$ docker-compose -f docker-compose-development.yml run --rm app npm run fetch-examples` - note that you need to configure your GitHub Credentials, which you can do by following the [Github API Configuration](#github-api-configuration) section.
5454
8. Enable Prettier in your text editor by following [this guide](https://prettier.io/docs/en/editors.html).
5555

0 commit comments

Comments
 (0)