Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Add inputStyle preference (#13216)
Browse files Browse the repository at this point in the history
  • Loading branch information
ficristo authored Apr 9, 2017
1 parent 0881dd0 commit 7adf634
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ define(function (require, exports, module) {
UPPERCASE_COLORS = "uppercaseColors",
USE_TAB_CHAR = "useTabChar",
WORD_WRAP = "wordWrap",
INDENT_LINE_COMMENT = "indentLineComment";
INDENT_LINE_COMMENT = "indentLineComment",
INPUT_STYLE = "inputStyle";

/**
* A list of gutter name and priorities currently registered for editors.
Expand Down Expand Up @@ -137,6 +138,7 @@ define(function (require, exports, module) {
cmOptions[TAB_SIZE] = "tabSize";
cmOptions[USE_TAB_CHAR] = "indentWithTabs";
cmOptions[WORD_WRAP] = "lineWrapping";
cmOptions[INPUT_STYLE] = "inputStyle";

PreferencesManager.definePreference(CLOSE_BRACKETS, "boolean", true, {
description: Strings.DESCRIPTION_CLOSE_BRACKETS
Expand Down Expand Up @@ -228,6 +230,10 @@ define(function (require, exports, module) {
description: Strings.DESCRIPTION_INDENT_LINE_COMMENT
});

PreferencesManager.definePreference(INPUT_STYLE, "string", "textarea", {
description: Strings.DESCRIPTION_INPUT_STYLE
});

var editorOptions = Object.keys(cmOptions);

/** Editor preferences */
Expand Down Expand Up @@ -413,7 +419,7 @@ define(function (require, exports, module) {
highlightSelectionMatches : currentOptions[HIGHLIGHT_MATCHES],
indentUnit : currentOptions[USE_TAB_CHAR] ? currentOptions[TAB_SIZE] : currentOptions[SPACE_UNITS],
indentWithTabs : currentOptions[USE_TAB_CHAR],
inputStyle : "textarea", // the "contenteditable" mode used on mobiles could cause issues
inputStyle : currentOptions[INPUT_STYLE],
lineNumbers : currentOptions[SHOW_LINE_NUMBERS],
lineWiseCopyCut : currentOptions[LINEWISE_COPY_CUT],
lineWrapping : currentOptions[WORD_WRAP],
Expand Down
1 change: 1 addition & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ define({
"DESCRIPTION_LANGUAGE_FILE_EXTENSIONS" : "Additional mappings from file extension to language name",
"DESCRIPTION_LANGUAGE_FILE_NAMES" : "Additional mappings from file name to language name",
"DESCRIPTION_LINEWISE_COPY_CUT" : "Doing copy and cut when there's no selection will copy or cut the whole lines that have cursors in them",
"DESCRIPTION_INPUT_STYLE" : "Selects the way CodeMirror handles input and focus. It cans be textarea, which is the default, or contenteditable which is better for screen readers (unstable)",
"DESCRIPTION_LINTING_ENABLED" : "true to enable Code Inspection",
"DESCRIPTION_ASYNC_TIMEOUT" : "The time in milliseconds after which asynchronous linters time out",
"DESCRIPTION_LINTING_PREFER" : "Array of linters to run first",
Expand Down

0 comments on commit 7adf634

Please sign in to comment.