Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions client/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const SET_TEXT_OUTPUT = 'SET_TEXT_OUTPUT';
export const SET_GRID_OUTPUT = 'SET_GRID_OUTPUT';
export const SET_SOUND_OUTPUT = 'SET_SOUND_OUTPUT';
export const SET_AUTOCLOSE_BRACKETS_QUOTES = 'SET_AUTOCLOSE_BRACKETS_QUOTES';
export const SET_AUTOCLOSE_TAGS = 'SET_AUTOCLOSE_TAGS';
export const SET_AUTOCOMPLETE_HINTER = 'SET_AUTOCOMPLETE_HINTER';

export const OPEN_PROJECT_OPTIONS = 'OPEN_PROJECT_OPTIONS';
Expand Down
18 changes: 18 additions & 0 deletions client/modules/IDE/actions/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ export function setAutocloseBracketsQuotes(value) {
};
}

export function setAutocloseTags(value) {
return (dispatch, getState) => {
dispatch({
type: ActionTypes.SET_AUTOCLOSE_TAGS,
value
});
const state = getState();
if (state.user.authenticated) {
const formParams = {
preferences: {
autoclosetags: value
}
};
updatePreferences(formParams, dispatch);
}
};
}

export function setAutocompleteHinter(value) {
return (dispatch, getState) => {
dispatch({
Expand Down
6 changes: 6 additions & 0 deletions client/modules/IDE/components/Editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/addon/edit/closebrackets';
import 'codemirror/addon/selection/mark-selection';
import 'codemirror/addon/hint/css-hint';
import 'codemirror/addon/edit/closetag';
import 'codemirror-colorpicker';

import { JSHINT } from 'jshint';
Expand Down Expand Up @@ -123,6 +124,7 @@ class Editor extends React.Component {
autoRenameTags: true
},
autoCloseBrackets: this.props.autocloseBracketsQuotes,
autoCloseTags: this.props.autoclosetags,
styleSelectedText: true,
lint: {
onUpdateLinting: (annotations) => {
Expand Down Expand Up @@ -264,6 +266,9 @@ class Editor extends React.Component {
this.props.autocloseBracketsQuotes
);
}
if (this.props.autoclosetags !== prevProps.autoclosetags) {
this._cm.setOption('autoCloseTags', this.props.autoclosetags);
}
if (this.props.autocompleteHinter !== prevProps.autocompleteHinter) {
if (!this.props.autocompleteHinter) {
// close the hinter window once the preference is turned off
Expand Down Expand Up @@ -588,6 +593,7 @@ class Editor extends React.Component {

Editor.propTypes = {
autocloseBracketsQuotes: PropTypes.bool.isRequired,
autoclosetags: PropTypes.bool.isRequired,
autocompleteHinter: PropTypes.bool.isRequired,
lineNumbers: PropTypes.bool.isRequired,
lintWarning: PropTypes.bool.isRequired,
Expand Down
45 changes: 43 additions & 2 deletions client/modules/IDE/components/Preferences/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
setLintWarning,
setAutocloseBracketsQuotes,
setAutocompleteHinter,
setLinewrap
setLinewrap,
setAutocloseTags
} from '../../actions/preferences';

export default function Preferences() {
Expand All @@ -34,7 +35,8 @@ export default function Preferences() {
gridOutput,
theme,
autocloseBracketsQuotes,
autocompleteHinter
autocompleteHinter,
autoclosetags
} = useSelector((state) => state.preferences);

const [state, setState] = useState({ fontSize });
Expand Down Expand Up @@ -264,6 +266,45 @@ export default function Preferences() {
</label>
</div>
</div>
<div className="preference">
<h4 className="preference__title">
{t('Preferences.AutocloseTags')}
</h4>
<div className="preference__options">
<input
type="radio"
onChange={() => dispatch(setAutocloseTags(true))}
aria-label={t('Preferences.AutocloseTagsOnARIA')}
name="autoclosetagsquotes"
id="autoclosetagsquotes-on"
className="preference__radio-button"
value="On"
checked={autoclosetags}
/>
<label
htmlFor="autoclosetagsquotes-on"
className="preference__option"
>
{t('Preferences.On')}
</label>
<input
type="radio"
onChange={() => dispatch(setAutocloseTags(false))}
aria-label={t('Preferences.AutocloseTagsOffARIA')}
name="autoclosetagsquotes"
id="autoclosetagsquotes-off"
className="preference__radio-button"
value="Off"
checked={!autoclosetags}
/>
<label
htmlFor="autoclosetagsquotes-off"
className="preference__option"
>
{t('Preferences.Off')}
</label>
</div>
</div>
<div className="preference">
<h4 className="preference__title">
{t('Preferences.AutocompleteHinter')}
Expand Down
5 changes: 4 additions & 1 deletion client/modules/IDE/reducers/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const initialState = {
autorefresh: false,
language: 'en-US',
autocloseBracketsQuotes: true,
autocompleteHinter: false
autocompleteHinter: false,
autoclosetags: true
};

const preferences = (state = initialState, action) => {
Expand Down Expand Up @@ -43,6 +44,8 @@ const preferences = (state = initialState, action) => {
return Object.assign({}, state, {
autocloseBracketsQuotes: action.value
});
case ActionTypes.SET_AUTOCLOSE_TAGS:
return Object.assign({}, state, { autoclosetags: action.value });
case ActionTypes.SET_AUTOCOMPLETE_HINTER:
return Object.assign({}, state, {
autocompleteHinter: action.value
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
"AutocloseBracketsQuotes": "Klammern und Anführungszeichen automatisch schließen",
"AutocloseBracketsQuotesOnARIA": "Klammern und Anführungszeichen automatisch schließen an",
"AutocloseBracketsQuotesOffARIA": "Klammern und Anführungszeichen automatisch schließen aus",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Wortumbruch",
"LineWrapOnARIA": "zeilenumbruch an",
"LineWrapOffARIA": "zeilenumbruch aus",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/en-US/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
"AutocloseBracketsQuotes": "Autoclose Brackets and Quotes",
"AutocloseBracketsQuotesOnARIA": "autoclose brackets and quotes on",
"AutocloseBracketsQuotesOffARIA": "autoclose brackets and quotes off",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"AutocompleteHinter": "Autocomplete Hinter",
"AutocompleteHinterOnARIA": "autocomplete hinter on",
"AutocompleteHinterOffARIA": "autocomplete hinter off",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/es-419/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@
"AutocloseBracketsQuotes": "Cerrar automáticamente llaves y comillas",
"AutocloseBracketsQuotesOnARIA": "Activar cierre automático de llaves y comillas",
"AutocloseBracketsQuotesOffARIA": "Desactivar cierre automático de llaves y comillas",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"Off": "Desactivar",
"AutosaveOffARIA": "Grabado automático desactivado",
"WordWrap": "Ajuste automático de línea",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/fr-CA/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@
"AutocloseBracketsQuotes": "Fermeture automatique des crochets et des guillemets",
"AutocloseBracketsQuotesOnARIA": "fermeture automatique des crochets et des guillemets activée",
"AutocloseBracketsQuotesOffARIA": "fermeture automatique des crochets et des guillemets désactivée",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Retour à la ligne automatique",
"LineWrapOnARIA": "retour à la ligne automatique activé",
"LineWrapOffARIA": "retour à la ligne automatique désactivé",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/hi/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
"AutocloseBracketsQuotes": "ऑटोक्लोज ब्रैकिट और क्वोट",
"AutocloseBracketsQuotesOnARIA": "ऑटोक्लोज ब्रैकिट और क्वोट चालू",
"AutocloseBracketsQuotesOffARIA": "ऑटोक्लोज ब्रैकिट और क्वोट बंद",
"AutocloseTags": "ऑटोक्लोज टैग",
"AutocloseTagsOnARIA": "ऑटोक्लोज टैग चालू",
"AutocloseTagsOffARIA": "ऑटोक्लोज टैग बंद",
"WordWrap": "वर्ड रैप",
"LineWrapOnARIA": "लाइनरैप चालू",
"LineWrapOffARIA": "लाइनरैप बंद",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
"AutocloseBracketsQuotes": "Auto-chiusura parentesi e virgolette",
"AutocloseBracketsQuotesOnARIA": "Auto-chiusura parentesi e virgolette attivo",
"AutocloseBracketsQuotesOffARIA": "Auto-chiusura parentesi e virgolette disabilitata",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Dividi parole",
"LineWrapOnARIA": "dividi parole attivo",
"LineWrapOffARIA": "dividi parole disabilitato",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/ja/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
"AutocloseBracketsQuotes": "括弧を自動的に閉じる",
"AutocloseBracketsQuotesOnARIA": "括弧を自動的に閉じる オン",
"AutocloseBracketsQuotesOffARIA": "括弧を自動的に閉じる オフ",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "ワードラップ",
"LineWrapOnARIA": "ラインラップ オン",
"LineWrapOffARIA": "ラインラップ オフ",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/ko/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
"AutocloseBracketsQuotes": "Autoclose Brackets and Quotes",
"AutocloseBracketsQuotesOnARIA": "autoclose brackets and quotes on",
"AutocloseBracketsQuotesOffARIA": "autoclose brackets and quotes off",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Word Wrap",
"LineWrapOnARIA": "linewrap on",
"LineWrapOffARIA": "linewrap off",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/pt-BR/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
"AutocloseBracketsQuotes": "Fechar automaticamente chaves e aspas",
"AutocloseBracketsQuotesOnARIA": "fechar automaticamente chaves e aspas ativado",
"AutocloseBracketsQuotesOffARIA": "fechar automaticamente chaves e aspas desativado",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Ajuste Automático de Linhas",
"LineWrapOnARIA": "ajuste automático de linhas ativado",
"LineWrapOffARIA": "ajuste automático de linhas desativado",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/sv/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
"AutocloseBracketsQuotes": "Automatisk stängnging av parenteser och citattecken",
"AutocloseBracketsQuotesOnARIA": "automatisk stängnging av parenteser och citattecken på",
"AutocloseBracketsQuotesOffARIA": "automatisk stängnging av parenteser och citattecken av",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Radbrytning",
"LineWrapOnARIA": "radbrytning på",
"LineWrapOffARIA": "radbrytning av",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/tr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
"AutocloseBracketsQuotes": "Parantez ve Tırnakları Otomatik Kapat",
"AutocloseBracketsQuotesOnARIA": "parantez ve tırnakları otomatik kapatma açık",
"AutocloseBracketsQuotesOffARIA": "parantez ve tırnakları otomatik kapatma kapalı",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Sözcük Kaydırma",
"LineWrapOnARIA": "satır kaydırma açık",
"LineWrapOffARIA": "satır kaydırma kapalı",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/uk-UA/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
"AutocloseBracketsQuotes": "Автоматично закривати дужки та лапки",
"AutocloseBracketsQuotesOnARIA": "автоматично закривати дужки та лапки",
"AutocloseBracketsQuotesOffARIA": "автоматично закривати дужки та лапки",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"WordWrap": "Перенесення слів",
"LineWrapOnARIA": "перенесення рядків увімкнено",
"LineWrapOffARIA": "перенесення рядків вимкнено",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/zh-CN/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
"AutocloseBracketsQuotes": "自动添加反括号和反引号",
"AutocloseBracketsQuotesOnARIA": "打开自动添加反括号和反引号",
"AutocloseBracketsQuotesOffARIA": "关闭自动添加反括号和反引号",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"AutocompleteHinter": "补全提示",
"AutocompleteHinterOnARIA": "打开补全提示",
"AutocompleteHinterOffARIA": "关闭补全提示",
Expand Down
3 changes: 3 additions & 0 deletions translations/locales/zh-TW/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
"AutocloseBracketsQuotes": "自動加上括號與引號",
"AutocloseBracketsQuotesOnARIA": "自動加上括號與引號",
"AutocloseBracketsQuotesOffARIA": "不自動加上括號與引號",
"AutocloseTags": "Autoclose Tags",
"AutocloseTagsOnARIA": "autoclose tags on",
"AutocloseTagsOffARIA": "autoclose tags off",
"AutocompleteHinter": "補全提示",
"AutocompleteHinterOnARIA": "加上補全提示",
"AutocompleteHinterOffARIA": "不加上補全提示",
Expand Down