diff --git a/PRIVACY.md b/PRIVACY.md index 9e1d5f62..18dfb51d 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -25,4 +25,4 @@ Our websites use: --- -This privacy policy is subject to change without notice and was last updated on March 10, 2019. If you have any questions feel free to [create a GitHub issue](https://github.com/atomery/singlebox/issues) or contact us via [contact@atomery.com](mailto:contact@atomery.com). \ No newline at end of file +This privacy policy is subject to change without notice and was last updated on April 27, 2019. If you have any questions feel free to [create a GitHub issue](https://github.com/atomery/singlebox/issues) or contact us via [contact@atomery.com](mailto:contact@atomery.com). \ No newline at end of file diff --git a/package.json b/package.json index db564f09..b2f1ba92 100755 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@material-ui/core": "4.9.13", "@material-ui/icons": "4.9.1", "@material-ui/pickers": "3.2.10", + "ace-builds": "1.4.11", "algoliasearch": "4.2.0", "babel-eslint": "10.1.0", "babel-preset-env": "1.7.0", @@ -66,6 +67,7 @@ "eslint-plugin-react-hooks": "1.7.0", "prop-types": "15.7.2", "react": "16.13.1", + "react-ace": "8.1.0", "react-dom": "16.13.1", "react-redux": "7.2.0", "react-scripts": "3.4.1", diff --git a/public/windows/code-injection.js b/public/windows/code-injection.js index 7db09d6c..32fe01f4 100644 --- a/public/windows/code-injection.js +++ b/public/windows/code-injection.js @@ -19,8 +19,8 @@ const create = (type) => { global.codeInjectionType = type; win = new BrowserWindow({ - width: 400, - height: 350, + width: 640, + height: 560, resizable: false, maximizable: false, minimizable: false, diff --git a/src/components/dialog-code-injection/index.js b/src/components/dialog-code-injection/index.js index 11fd2e44..d9bbc94f 100644 --- a/src/components/dialog-code-injection/index.js +++ b/src/components/dialog-code-injection/index.js @@ -2,7 +2,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import Button from '@material-ui/core/Button'; -import TextField from '@material-ui/core/TextField'; + +import AceEditor from 'react-ace'; + +import 'ace-builds/src-noconflict/mode-css'; +import 'ace-builds/src-noconflict/mode-javascript'; +import 'ace-builds/src-noconflict/theme-github'; +import 'ace-builds/src-noconflict/theme-monokai'; import connectComponent from '../../helpers/connect-component'; @@ -13,42 +19,50 @@ const styles = (theme) => ({ background: theme.palette.background.paper, height: '100vh', width: '100vw', - padding: theme.spacing(2), + padding: 0, display: 'flex', flexDirection: 'column', }, flexGrow: { flex: 1, }, + actions: { + borderTop: `1px solid ${theme.palette.divider}`, + padding: theme.spacing(2), + }, button: { float: 'right', marginLeft: theme.spacing(1), }, }); +const getMode = () => { + const codeInjectionType = window.require('electron').remote.getGlobal('codeInjectionType'); + if (codeInjectionType === 'css') return 'css'; + if (codeInjectionType === 'js') return 'javascript'; + return ''; +}; + const CodeInjection = ({ - classes, code, onUpdateForm, onSave, + classes, + code, + onSave, + onUpdateForm, + shouldUseDarkColors, }) => (