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

Commit 7adf634

Browse files
authored
Add inputStyle preference (#13216)
1 parent 0881dd0 commit 7adf634

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/editor/Editor.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ define(function (require, exports, module) {
9696
UPPERCASE_COLORS = "uppercaseColors",
9797
USE_TAB_CHAR = "useTabChar",
9898
WORD_WRAP = "wordWrap",
99-
INDENT_LINE_COMMENT = "indentLineComment";
99+
INDENT_LINE_COMMENT = "indentLineComment",
100+
INPUT_STYLE = "inputStyle";
100101

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

141143
PreferencesManager.definePreference(CLOSE_BRACKETS, "boolean", true, {
142144
description: Strings.DESCRIPTION_CLOSE_BRACKETS
@@ -228,6 +230,10 @@ define(function (require, exports, module) {
228230
description: Strings.DESCRIPTION_INDENT_LINE_COMMENT
229231
});
230232

233+
PreferencesManager.definePreference(INPUT_STYLE, "string", "textarea", {
234+
description: Strings.DESCRIPTION_INPUT_STYLE
235+
});
236+
231237
var editorOptions = Object.keys(cmOptions);
232238

233239
/** Editor preferences */
@@ -413,7 +419,7 @@ define(function (require, exports, module) {
413419
highlightSelectionMatches : currentOptions[HIGHLIGHT_MATCHES],
414420
indentUnit : currentOptions[USE_TAB_CHAR] ? currentOptions[TAB_SIZE] : currentOptions[SPACE_UNITS],
415421
indentWithTabs : currentOptions[USE_TAB_CHAR],
416-
inputStyle : "textarea", // the "contenteditable" mode used on mobiles could cause issues
422+
inputStyle : currentOptions[INPUT_STYLE],
417423
lineNumbers : currentOptions[SHOW_LINE_NUMBERS],
418424
lineWiseCopyCut : currentOptions[LINEWISE_COPY_CUT],
419425
lineWrapping : currentOptions[WORD_WRAP],

src/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ define({
753753
"DESCRIPTION_LANGUAGE_FILE_EXTENSIONS" : "Additional mappings from file extension to language name",
754754
"DESCRIPTION_LANGUAGE_FILE_NAMES" : "Additional mappings from file name to language name",
755755
"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",
756+
"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)",
756757
"DESCRIPTION_LINTING_ENABLED" : "true to enable Code Inspection",
757758
"DESCRIPTION_ASYNC_TIMEOUT" : "The time in milliseconds after which asynchronous linters time out",
758759
"DESCRIPTION_LINTING_PREFER" : "Array of linters to run first",

0 commit comments

Comments
 (0)