diff --git a/.gitmodules b/.gitmodules index afc7971610..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "static/p5-interceptor"] - path = static/p5-interceptor - url = git://github.com/MathuraMG/p5-interceptor.git - branch = master diff --git a/client/modules/IDE/components/AccessibleOutput.jsx b/client/modules/IDE/components/AccessibleOutput.jsx deleted file mode 100644 index a3688bd7d0..0000000000 --- a/client/modules/IDE/components/AccessibleOutput.jsx +++ /dev/null @@ -1,51 +0,0 @@ -import React, { PropTypes } from 'react'; -import GridOutput from '../components/GridOutput'; -import TextOutput from '../components/TextOutput'; - -class AccessibleOutput extends React.Component { - componentDidMount() { - this.accessibleOutputModal.focus(); - } - componentDidUpdate(prevProps) { - // if the user explicitly clicks on the play button, want to refocus on the text output - if (this.props.isPlaying && this.props.previewIsRefreshing) { - this.accessibleOutputModal.focus(); - } - } - render() { - return ( -
{ this.accessibleOutputModal = element; }} - tabIndex="0" - aria-label="accessible-output" - title="canvas text output" - > - {(() => { // eslint-disable-line - if (this.props.textOutput) { - return ( - - ); - } - })()} - {(() => { // eslint-disable-line - if (this.props.gridOutput) { - return ( - - ); - } - })()} -
- ); - } -} - -AccessibleOutput.propTypes = { - isPlaying: PropTypes.bool.isRequired, - previewIsRefreshing: PropTypes.bool.isRequired, - textOutput: PropTypes.bool.isRequired, - gridOutput: PropTypes.bool.isRequired -}; - -export default AccessibleOutput; diff --git a/client/modules/IDE/components/GridOutput.jsx b/client/modules/IDE/components/GridOutput.jsx deleted file mode 100644 index 3f7dcd1b5d..0000000000 --- a/client/modules/IDE/components/GridOutput.jsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react'; - -class GridOutput extends React.Component { - componentDidMount() { - this.GridOutputModal.focus(); - } - render() { - return ( -
{ this.GridOutputModal = element; }} - > -

table Output

-

-

- -
-
-
-
- ); - } -} - -export default GridOutput; diff --git a/client/modules/IDE/components/PreviewFrame.jsx b/client/modules/IDE/components/PreviewFrame.jsx index 6f28cc9943..1250025882 100644 --- a/client/modules/IDE/components/PreviewFrame.jsx +++ b/client/modules/IDE/components/PreviewFrame.jsx @@ -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'); + 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) => { @@ -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, htmlFile: PropTypes.shape({ content: PropTypes.string.isRequired }).isRequired, diff --git a/client/modules/IDE/components/TextOutput.jsx b/client/modules/IDE/components/TextOutput.jsx deleted file mode 100644 index f9b528e0fe..0000000000 --- a/client/modules/IDE/components/TextOutput.jsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react'; - -class TextOutput extends React.Component { - componentDidMount() { - this.TextOutputModal.focus(); - } - render() { - return ( -
{ this.TextOutputModal = element; }} - > -

Text Output

-

-

- -
-
-
-
- ); - } -} - -export default TextOutput; diff --git a/client/modules/IDE/pages/IDEView.jsx b/client/modules/IDE/pages/IDEView.jsx index 9bfbe4dfb6..8e0ad0c644 100644 --- a/client/modules/IDE/pages/IDEView.jsx +++ b/client/modules/IDE/pages/IDEView.jsx @@ -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'; @@ -375,14 +374,8 @@ class IDEView extends React.Component { ) && this.props.ide.isPlaying ) || - this.props.ide.isAccessibleOutputPlaying - ) && - + this.props.ide.isAccessibleOutputPlaying + ) } + + +
- +
+ `; @@ -30,6 +34,15 @@ const defaultCSS = margin: 0; padding: 0; } + +#accessible-outputs { + position: absolute; + left: -10000px; + top: auto; + width: 1px; + height: 1px; + overflow: hidden; +} `; const initialState = () => { diff --git a/package.json b/package.json index afebb2c673..8862b029f0 100644 --- a/package.json +++ b/package.json @@ -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",