From 679ef12b54616ba879e10a0a773f21c55fd38495 Mon Sep 17 00:00:00 2001 From: cdr Date: Thu, 21 Mar 2019 20:26:52 -0400 Subject: [PATCH 1/7] Remove indentation options from Preferences.jsx --- client/modules/IDE/components/Preferences.jsx | 79 ------------------- 1 file changed, 79 deletions(-) diff --git a/client/modules/IDE/components/Preferences.jsx b/client/modules/IDE/components/Preferences.jsx index 27eddd7d..15ba9d7a 100644 --- a/client/modules/IDE/components/Preferences.jsx +++ b/client/modules/IDE/components/Preferences.jsx @@ -16,7 +16,6 @@ class Preferences extends React.Component { super(props); this.handleUpdateAutosave = this.handleUpdateAutosave.bind(this); this.handleUpdateFont = this.handleUpdateFont.bind(this); - this.handleUpdateIndentation = this.handleUpdateIndentation.bind(this); this.handleLintWarning = this.handleLintWarning.bind(this); } @@ -34,20 +33,6 @@ class Preferences extends React.Component { this.props.setFontSize(value); } - handleUpdateIndentation(event) { - let value = parseInt(event.target.value, 10); - if (Number.isNaN(value)) { - value = 2; - } - if (value > 6) { - value = 6; - } - if (value < 0) { - value = 0; - } - this.props.setIndentation(value); - } - handleUpdateAutosave(event) { const value = event.target.value === 'true'; this.props.setAutosave(value); @@ -144,65 +129,6 @@ class Preferences extends React.Component {
Increase
-
-

Indentation amount

- - { this.indentationInput = element; }} - onClick={() => { - this.indentationInput.select(); - }} - /> - - - - - -

Autosave

@@ -318,11 +244,6 @@ class Preferences extends React.Component { Preferences.propTypes = { fontSize: PropTypes.number.isRequired, - indentationAmount: PropTypes.number.isRequired, - setIndentation: PropTypes.func.isRequired, - indentWithSpace: PropTypes.func.isRequired, - indentWithTab: PropTypes.func.isRequired, - isTabIndent: PropTypes.bool.isRequired, setFontSize: PropTypes.func.isRequired, autosave: PropTypes.bool.isRequired, setAutosave: PropTypes.func.isRequired, From 096f8a1f651538b2395a98cb123234ce813d08c3 Mon Sep 17 00:00:00 2001 From: cdr Date: Thu, 21 Mar 2019 20:52:56 -0400 Subject: [PATCH 2/7] Hardcode 2-space configuration in Editor.jsx --- client/modules/IDE/components/Editor.jsx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index 485302e5..d756657d 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -137,9 +137,6 @@ class Editor extends React.Component { }); this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`; - this._cm.setOption('indentWithTabs', this.props.isTabIndent); - this._cm.setOption('tabSize', this.props.indentationAmount); - this._cm.setOption('indentUnit', this.props.indentationAmount); this.props.provideController({ tidyCode: this.tidyCode, @@ -174,13 +171,6 @@ class Editor extends React.Component { if (this.props.fontSize !== prevProps.fontSize) { this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`; } - if (this.props.indentationAmount !== prevProps.indentationAmount) { - this._cm.setOption('tabSize', this.props.indentationAmount); - this._cm.setOption('indentUnit', this.props.indentationAmount); - } - if (this.props.isTabIndent !== prevProps.isTabIndent) { - this._cm.setOption('indentWithTabs', this.props.isTabIndent); - } if (this.props.theme !== prevProps.theme) { this._cm.setOption('theme', `p5-${this.props.theme}`); } @@ -254,8 +244,8 @@ class Editor extends React.Component { tidyCode() { const beautifyOptions = { - indent_size: this.props.indentationAmount, - indent_with_tabs: this.props.isTabIndent + indent_size: 2, + indent_with_tabs: false }; const mode = this._cm.getOption('mode'); @@ -351,8 +341,6 @@ Editor.propTypes = { })), updateLintMessage: PropTypes.func.isRequired, clearLintMessage: PropTypes.func.isRequired, - indentationAmount: PropTypes.number.isRequired, - isTabIndent: PropTypes.bool.isRequired, updateFileContent: PropTypes.func.isRequired, fontSize: PropTypes.number.isRequired, file: PropTypes.shape({ From ddb93e6c8db6de30ad55eee3a65ce95b710dee09 Mon Sep 17 00:00:00 2001 From: cdr Date: Thu, 21 Mar 2019 21:02:22 -0400 Subject: [PATCH 3/7] Remove indentation PropTypes from IDEView.jsx --- client/modules/IDE/pages/IDEView.jsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/client/modules/IDE/pages/IDEView.jsx b/client/modules/IDE/pages/IDEView.jsx index 05163b63..8dda673a 100644 --- a/client/modules/IDE/pages/IDEView.jsx +++ b/client/modules/IDE/pages/IDEView.jsx @@ -202,11 +202,6 @@ class IDEView extends React.Component { > Date: Thu, 21 Mar 2019 21:08:59 -0400 Subject: [PATCH 4/7] Remove indentation config from actions, reducers, and constants --- client/constants.js | 8 ---- client/modules/IDE/actions/preferences.js | 52 ---------------------- client/modules/IDE/reducers/preferences.js | 12 ----- 3 files changed, 72 deletions(-) diff --git a/client/constants.js b/client/constants.js index 4250cc3b..338d7914 100644 --- a/client/constants.js +++ b/client/constants.js @@ -13,14 +13,6 @@ export const OPEN_PREFERENCES = 'OPEN_PREFERENCES'; export const CLOSE_PREFERENCES = 'CLOSE_PREFERENCES'; export const SET_FONT_SIZE = 'SET_FONT_SIZE'; -export const INCREASE_INDENTATION = 'INCREASE_INDENTATION'; -export const DECREASE_INDENTATION = 'DECREASE_INDENTATION'; -export const UPDATE_INDENTATION = 'UPDATE_INDENTATION'; -export const SET_INDENTATION = 'SET_INDENTATION'; - -export const INDENT_WITH_SPACE = 'INDENT_WITH_SPACE'; -export const INDENT_WITH_TAB = 'INDENT_WITH_TAB'; - export const AUTH_USER = 'AUTH_USER'; export const UNAUTH_USER = 'UNAUTH_USER'; export const AUTH_ERROR = 'AUTH_ERROR'; diff --git a/client/modules/IDE/actions/preferences.js b/client/modules/IDE/actions/preferences.js index 3e26e45a..8919167d 100644 --- a/client/modules/IDE/actions/preferences.js +++ b/client/modules/IDE/actions/preferences.js @@ -32,58 +32,6 @@ export function setFontSize(value) { }; } -export function setIndentation(value) { - return (dispatch, getState) => { - dispatch({ - type: ActionTypes.SET_INDENTATION, - value - }); - const state = getState(); - if (state.user.authenticated) { - const formParams = { - preferences: { - indentationAmount: value - } - }; - updatePreferences(formParams, dispatch); - } - }; -} - -export function indentWithTab() { - return (dispatch, getState) => { - dispatch({ - type: ActionTypes.INDENT_WITH_TAB - }); - const state = getState(); - if (state.user.authenticated) { - const formParams = { - preferences: { - isTabIndent: true - } - }; - updatePreferences(formParams, dispatch); - } - }; -} - -export function indentWithSpace() { - return (dispatch, getState) => { - dispatch({ - type: ActionTypes.INDENT_WITH_SPACE - }); - const state = getState(); - if (state.user.authenticated) { - const formParams = { - preferences: { - isTabIndent: false - } - }; - updatePreferences(formParams, dispatch); - } - }; -} - export function setAutosave(value) { return (dispatch, getState) => { dispatch({ diff --git a/client/modules/IDE/reducers/preferences.js b/client/modules/IDE/reducers/preferences.js index 8441f042..21efcb8d 100644 --- a/client/modules/IDE/reducers/preferences.js +++ b/client/modules/IDE/reducers/preferences.js @@ -2,8 +2,6 @@ import * as ActionTypes from '../../../constants'; const initialState = { fontSize: 18, - indentationAmount: 2, - isTabIndent: true, autosave: true, lintWarning: false, textOutput: false, @@ -17,16 +15,6 @@ const preferences = (state = initialState, action) => { switch (action.type) { case ActionTypes.SET_FONT_SIZE: return Object.assign({}, state, { fontSize: action.value }); - case ActionTypes.SET_INDENTATION: - return Object.assign({}, state, { indentationAmount: action.value }); - case ActionTypes.INDENT_WITH_TAB: - return Object.assign({}, state, { - isTabIndent: true - }); - case ActionTypes.INDENT_WITH_SPACE: - return Object.assign({}, state, { - isTabIndent: false - }); case ActionTypes.SET_AUTOSAVE: return Object.assign({}, state, { autosave: action.value }); case ActionTypes.SET_LINT_WARNING: From 20be8eb5bd863f7947a7b98fd930caffc81db5fa Mon Sep 17 00:00:00 2001 From: cdr Date: Sat, 23 Mar 2019 20:53:07 -0400 Subject: [PATCH 5/7] Fix tab indentation setting --- client/modules/IDE/components/Editor.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index d756657d..f57569b6 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -50,6 +50,9 @@ const unsavedChangesDotUrl = require('../../../images/unsaved-changes-dot.svg'); const rightArrowUrl = require('../../../images/right-arrow.svg'); const leftArrowUrl = require('../../../images/left-arrow.svg'); +const IS_TAB_INDENT = false; +const INDENTATION_AMOUNT = 2; + class Editor extends React.Component { constructor(props) { super(props); @@ -105,6 +108,7 @@ class Editor extends React.Component { delete this._cm.options.lint.options.errors; this._cm.setOption('extraKeys', { + Tab: cm => cm.replaceSelection(Array(INDENTATION_AMOUNT + 1).join(' ')), [`${metaKey}-Enter`]: () => null, [`Shift-${metaKey}-Enter`]: () => null, [`${metaKey}-F`]: 'findPersistent', @@ -244,8 +248,8 @@ class Editor extends React.Component { tidyCode() { const beautifyOptions = { - indent_size: 2, - indent_with_tabs: false + indent_size: INDENTATION_AMOUNT, + indent_with_tabs: IS_TAB_INDENT }; const mode = this._cm.getOption('mode'); From 49e786a82d537f3a893769b4f4b288179f6ce26e Mon Sep 17 00:00:00 2001 From: cdr Date: Tue, 26 Mar 2019 02:12:42 -0400 Subject: [PATCH 6/7] Use more straightforward tab keymap function --- client/modules/IDE/components/Editor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index f57569b6..a86447f6 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -108,7 +108,7 @@ class Editor extends React.Component { delete this._cm.options.lint.options.errors; this._cm.setOption('extraKeys', { - Tab: cm => cm.replaceSelection(Array(INDENTATION_AMOUNT + 1).join(' ')), + Tab: cm => cm.replaceSelection(' '.repeat(INDENTATION_AMOUNT)), [`${metaKey}-Enter`]: () => null, [`Shift-${metaKey}-Enter`]: () => null, [`${metaKey}-F`]: 'findPersistent', From c1ba5cb072312d9081c9bd80d37133cc40050a48 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Tue, 26 Mar 2019 15:51:55 -0400 Subject: [PATCH 7/7] revert overlay max-height --- client/styles/components/_overlay.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/styles/components/_overlay.scss b/client/styles/components/_overlay.scss index 8662bc2d..2065a230 100644 --- a/client/styles/components/_overlay.scss +++ b/client/styles/components/_overlay.scss @@ -22,7 +22,7 @@ display: flex; flex-wrap: wrap; flex-flow: column; - max-height: 88%; + max-height: 80%; max-width: 65%; }