Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ This project is currently in development! It will be announced when there is a (

1. Fork this repository.
2. Clone the forked repostory and cd into it
3. `$ git submodule init`
4. `$ npm install`
5. Install MongoDB and make sure it is running
3. `$ npm install`
4. Install MongoDB and make sure it is running
* For Mac OSX with [homebrew](http://brew.sh/): `brew install mongodb` then `brew services start mongodb`
* For Windows and Linux: [MongoDB Installation](https://docs.mongodb.com/manual/installation/)
6. Create a file called `.env` in the root of this directory that looks like
5. Create a file called `.env` in the root of this directory that looks like

```
API_URL=/api
Expand All @@ -29,10 +28,10 @@ This project is currently in development! It will be announced when there is a (

If you don't care about being able to upload media files to S3 or Login with Github, you can drop in the file exactly how it is. Or, if you don't want to do that, just ask me to send you mine. Refer to [this gist](https://gist.github.com/catarak/70c9301f0fd1ac2d6b58de03f61997e3) for creating an S3 bucket for testing, or if you don't want to do that, I can add you to one of my S3 buckets.

7. `$ npm run fetch-examples` - this downloads the example sketches into a user called 'p5'
8. `$ npm start`
9. Navigate to [http://localhost:8000](http://localhost:8000) in your browser
10. Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en).
6. `$ npm run fetch-examples` - this downloads the example sketches into a user called 'p5'
7. `$ npm start`
8. Navigate to [http://localhost:8000](http://localhost:8000) in your browser
9. Install the [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en).
10. Open and close the Redux DevTools using `ctrl+h`, and move them with `ctrl+w`

### Testing SSL on your local machine
Expand Down Expand Up @@ -68,10 +67,9 @@ If you don't have the full server environment running, you can launch a one-off

## Production Installation
1. Clone this repostory and `cd` into it
2. `$ git submodule init`
3. `$ npm install`
4. Install MongoDB and make sure it is running
5. Create a file called `.env` in the root of this directory that looks like
2. `$ npm install`
3. Install MongoDB and make sure it is running
4. Create a file called `.env` in the root of this directory that looks like

```
API_URL=/api
Expand All @@ -91,9 +89,9 @@ If you don't have the full server environment running, you can launch a one-off
```
For production, you will need to have real Github and Amazon credentions. Refer to [this gist](https://gist.github.com/catarak/70c9301f0fd1ac2d6b58de03f61997e3) for creating an S3 bucket for testing.

6. `$ npm run fetch-examples` - this downloads the example sketches into a user called 'p5'
7. `$ npm run build`
8. `$ npm run start:prod`
5. `$ npm run fetch-examples` - this downloads the example sketches into a user called 'p5'
6. `$ npm run build`
7. `$ npm run start:prod`

### For Production Setup with PM2
1. `$ npm install -g pm2`
Expand All @@ -119,7 +117,7 @@ http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostin

## Accessibility Guidelines

Here is guide on [how to use the accessible editor](https://gist.github.com/MathuraMG/e86666b7b41fbc8c078bad9aff3f666d)
Here is guide on [how to use the accessible editor](https://gist.github.com/MathuraMG/e86666b7b41fbc8c078bad9aff3f666d) and here is an overview of the [p5-accessibility.js](https://github.com/MathuraMG/p5-accessibility/blob/master/README.md) library that makes p5.js sketches accessible to screen readers.

The code for the p5.js web editor adheres to web accessibility standards. The following guidelines will help to ensure that accessibility continues to be a priority as development continues.

Expand All @@ -146,7 +144,7 @@ See [CONTRIBUTING.md](https://github.com/processing/p5.js-web-editor/blob/master

The p5.js Web Editor is built on a MERN stack - MongoDB, Express, React/Redux, and Node. For a reference to the file structure format I am using, please look at the [Mern Starter](https://github.com/Hashnode/mern-starter) and [this comment](https://github.com/Hashnode/mern-starter/issues/90#issuecomment-221553573).

This project uses an in-development [p5.js interceptor library](https://github.com/MathuraMG/p5-interceptor) for accessibility as git submodule. Every time you run `npm install`, it will update the interceptor to HEAD, so it is important to do this often.
This project uses an in-development [p5-accessibility.js library](https://github.com/MathuraMG/p5-accessibility) for accessibility.

This project does not use CSS Modules, but uses Sass. I like to follow [BEM rules](http://getbem.com/) for CSS naming conventions, write OOSCSS with placeholders and mixins, and follow the [7-1 Pattern](https://sass-guidelin.es/#the-7-1-pattern) for Sass.

Expand Down
51 changes: 0 additions & 51 deletions client/modules/IDE/components/AccessibleOutput.jsx

This file was deleted.

38 changes: 0 additions & 38 deletions client/modules/IDE/components/GridOutput.jsx

This file was deleted.

64 changes: 23 additions & 41 deletions client/modules/IDE/components/PreviewFrame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,49 +198,31 @@ class PreviewFrame extends React.Component {
this.resolveScripts(sketchDoc, resolvedFiles);
this.resolveStyles(sketchDoc, resolvedFiles);

let scriptsToInject = [
const scriptsToInject = [
'/loop-protect.min.js',
'/hijackConsole.js'
];
if (
this.props.isAccessibleOutputPlaying ||
((this.props.textOutput || this.props.gridOutput || this.props.soundOutput) && this.props.isPlaying)) {
let interceptorScripts = [];
interceptorScripts = [
'/p5-interceptor/registry.js',
'/p5-interceptor/loadData.js',
'/p5-interceptor/interceptorHelperFunctions.js',
'/p5-interceptor/baseInterceptor.js',
'/p5-interceptor/entities/entity.min.js',
'/p5-interceptor/ntc.min.js'
];
if (!this.props.textOutput && !this.props.gridOutput && !this.props.soundOutput) {
this.props.setTextOutput(true);
}
if (this.props.textOutput) {
let textInterceptorScripts = [];
textInterceptorScripts = [
'/p5-interceptor/textInterceptor/interceptorFunctions.js',
'/p5-interceptor/textInterceptor/interceptorP5.js'
];
interceptorScripts = interceptorScripts.concat(textInterceptorScripts);
}
if (this.props.gridOutput) {
let gridInterceptorScripts = [];
gridInterceptorScripts = [
'/p5-interceptor/gridInterceptor/interceptorFunctions.js',
'/p5-interceptor/gridInterceptor/interceptorP5.js'
];
interceptorScripts = interceptorScripts.concat(gridInterceptorScripts);
}
if (this.props.soundOutput) {
let soundInterceptorScripts = [];
soundInterceptorScripts = [
'/p5-interceptor/soundInterceptor/interceptorP5.js'
];
interceptorScripts = interceptorScripts.concat(soundInterceptorScripts);
}
scriptsToInject = scriptsToInject.concat(interceptorScripts);
const accessiblelib = sketchDoc.createElement('script');
accessiblelib.setAttribute('src', 'https://cdn.rawgit.com/MathuraMG/p5-accessibility/e856365c/dist/p5-accessibility.js');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than link to the accessibility using raw git, i think it would be better to add the library as a dependency in package.json, then import the built script using webpack.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @lm-n, @CleezyITP - We have been talking about this one, we would like the library to be a part of the HTML code as a CDN so that when a user shares their code (say, send a zip to someone, it will include the library. This would make sharing more accessible. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catarak - was wondering what your thoughts on this are?

if (this.props.textOutput) {
sketchDoc.getElementById('accessibility-library').appendChild(accessiblelib);
const textSection = sketchDoc.createElement('section');
textSection.setAttribute('id', 'textOutput-content');
sketchDoc.getElementById('accessible-outputs').appendChild(textSection);
this.iframeElement.focus();
}
if (this.props.gridOutput) {
sketchDoc.getElementById('accessibility-library').appendChild(accessiblelib);
const gridSection = sketchDoc.createElement('section');
gridSection.setAttribute('id', 'gridOutput-content');
sketchDoc.getElementById('accessible-outputs').appendChild(gridSection);
this.iframeElement.focus();
}
if (this.props.soundOutput) {
sketchDoc.getElementById('accessibility-library').appendChild(accessiblelib);
const soundSection = sketchDoc.createElement('section');
soundSection.setAttribute('id', 'soundOutput-content');
sketchDoc.getElementById('accessible-outputs').appendChild(soundSection);
}

scriptsToInject.forEach((scriptToInject) => {
Expand Down Expand Up @@ -419,7 +401,7 @@ PreviewFrame.propTypes = {
textOutput: PropTypes.bool.isRequired,
gridOutput: PropTypes.bool.isRequired,
soundOutput: PropTypes.bool.isRequired,
setTextOutput: PropTypes.func.isRequired,
// setTextOutput: PropTypes.func.isRequired,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be removed rather than commented out?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

htmlFile: PropTypes.shape({
content: PropTypes.string.isRequired
}).isRequired,
Expand Down
38 changes: 0 additions & 38 deletions client/modules/IDE/components/TextOutput.jsx

This file was deleted.

11 changes: 2 additions & 9 deletions client/modules/IDE/pages/IDEView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Editor from '../components/Editor';
import Sidebar from '../components/Sidebar';
import PreviewFrame from '../components/PreviewFrame';
import Toolbar from '../components/Toolbar';
import AccessibleOutput from '../components/AccessibleOutput';
import Preferences from '../components/Preferences';
import NewFileModal from '../components/NewFileModal';
import NewFolderModal from '../components/NewFolderModal';
Expand Down Expand Up @@ -375,14 +374,8 @@ class IDEView extends React.Component {
) &&
this.props.ide.isPlaying
) ||
this.props.ide.isAccessibleOutputPlaying
) &&
<AccessibleOutput
isPlaying={this.props.ide.isPlaying}
previewIsRefreshing={this.props.ide.previewIsRefreshing}
textOutput={this.props.preferences.textOutput}
gridOutput={this.props.preferences.gridOutput}
/>
this.props.ide.isAccessibleOutputPlaying
)
}
</div>
<PreviewFrame
Expand Down
15 changes: 14 additions & 1 deletion client/modules/IDE/reducers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ const defaultHTML =
`<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this including jquery?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will clear this out - our library has dependencies on jquery but we will make them vanilla javascript.

<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />

</head>
<body>
<section aria-label='accessible output' id='accessible-outputs'></section>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than add the accessibility elements and css to the default html file, i think it would be better to inject them in the PreviewFrame.jsx file, in the function injectLocalFiles. As it is now, a user could accidentally delete these elements from the HTML and then the accessibility features would be broken.

Copy link
Collaborator

@MathuraMG MathuraMG Feb 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catarak - I think some of the questions we had for you were deleted after we made the new commits :)
@lm-n and myself were thinking it should be a part of the HTML (at the risk of being deleted) , the same way as p5-dom or p5-sound. This way if someone decides to share their code, they can share or download it with the accessibility lib and so the code stays accessible beyond the editor. What do you think about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. should it be added by default or only if accessibility features are turned on? and also, you want the script to point to a specific release of the library? or a specific commit? or to the latest on master?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we tried to add it only if accessibility features are added but there was a problem? @lm-n ?

<script src="sketch.js"></script>
</body>
<div id='accessibility-library'></div>
</body>
</html>
`;

Expand All @@ -30,6 +34,15 @@ const defaultCSS =
margin: 0;
padding: 0;
}

#accessible-outputs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is the last thing, but this CSS should also get injected by the library!

position: absolute;
left: -10000px;
top: auto;
width: 1px;
height: 1px;
overflow: hidden;
}
`;

const initialState = () => {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"lint-fix": "eslint client server --ext .jsx --ext .js --fix",
"build": "NODE_ENV=production webpack --config webpack.config.prod.js --progress",
"test": "npm run lint",
"fetch-examples": "node fetch-examples.js",
"postinstall": "git submodule update --remote --recursive"
"fetch-examples": "node fetch-examples.js"
},
"main": "index.js",
"author": "Cassie Tarakajian",
Expand Down