From 7adf6343e5bfccd0e6f7d3b2a33bc5f936f0a4aa Mon Sep 17 00:00:00 2001 From: ficristo Date: Sun, 9 Apr 2017 14:22:39 +0200 Subject: [PATCH] Add inputStyle preference (#13216) --- src/editor/Editor.js | 10 ++++++++-- src/nls/root/strings.js | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 0596833d3dc..c37f563317a 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -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. @@ -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 @@ -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 */ @@ -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], diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 4675f34cdba..afd9ea21dff 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -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",