mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 18:48:00 +00:00
Add a special editor option to control the readonly textarea attribute
This commit is contained in:
parent
a9aebe3bce
commit
02b394a1a5
|
@ -132,7 +132,7 @@ export class TextAreaHandler extends ViewPart {
|
|||
this.textArea.setAttribute('aria-haspopup', 'false');
|
||||
this.textArea.setAttribute('aria-autocomplete', 'both');
|
||||
|
||||
if (platform.isIOS && options.get(EditorOption.readOnly)) {
|
||||
if (options.get(EditorOption.domReadOnly)) {
|
||||
this.textArea.setAttribute('readonly', 'true');
|
||||
}
|
||||
|
||||
|
@ -440,8 +440,8 @@ export class TextAreaHandler extends ViewPart {
|
|||
this.textArea.setAttribute('aria-label', this._getAriaLabel(options));
|
||||
this.textArea.setAttribute('tabindex', String(options.get(EditorOption.tabIndex)));
|
||||
|
||||
if (platform.isIOS && e.hasChanged(EditorOption.readOnly)) {
|
||||
if (options.get(EditorOption.readOnly)) {
|
||||
if (e.hasChanged(EditorOption.domReadOnly)) {
|
||||
if (options.get(EditorOption.domReadOnly)) {
|
||||
this.textArea.setAttribute('readonly', 'true');
|
||||
} else {
|
||||
this.textArea.removeAttribute('readonly');
|
||||
|
|
|
@ -139,10 +139,15 @@ export interface IEditorOptions {
|
|||
*/
|
||||
extraEditorClassName?: string;
|
||||
/**
|
||||
* Should the editor be read only.
|
||||
* Should the editor be read only. See also `domReadOnly`.
|
||||
* Defaults to false.
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
/**
|
||||
* Should the textarea used for input use the DOM `readonly` attribute.
|
||||
* Defaults to false.
|
||||
*/
|
||||
domReadOnly?: boolean;
|
||||
/**
|
||||
* Enable linked editing.
|
||||
* Defaults to false.
|
||||
|
@ -3751,6 +3756,7 @@ export const enum EditorOption {
|
|||
cursorWidth,
|
||||
disableLayerHinting,
|
||||
disableMonospaceOptimizations,
|
||||
domReadOnly,
|
||||
dragAndDrop,
|
||||
emptySelectionClipboard,
|
||||
extraEditorClassName,
|
||||
|
@ -4063,6 +4069,9 @@ export const EditorOptions = {
|
|||
disableMonospaceOptimizations: register(new EditorBooleanOption(
|
||||
EditorOption.disableMonospaceOptimizations, 'disableMonospaceOptimizations', false
|
||||
)),
|
||||
domReadOnly: register(new EditorBooleanOption(
|
||||
EditorOption.domReadOnly, 'domReadOnly', false,
|
||||
)),
|
||||
dragAndDrop: register(new EditorBooleanOption(
|
||||
EditorOption.dragAndDrop, 'dragAndDrop', true,
|
||||
{ description: nls.localize('dragAndDrop', "Controls whether the editor should allow moving selections via drag and drop.") }
|
||||
|
|
|
@ -195,105 +195,106 @@ export enum EditorOption {
|
|||
cursorWidth = 25,
|
||||
disableLayerHinting = 26,
|
||||
disableMonospaceOptimizations = 27,
|
||||
dragAndDrop = 28,
|
||||
emptySelectionClipboard = 29,
|
||||
extraEditorClassName = 30,
|
||||
fastScrollSensitivity = 31,
|
||||
find = 32,
|
||||
fixedOverflowWidgets = 33,
|
||||
folding = 34,
|
||||
foldingStrategy = 35,
|
||||
foldingHighlight = 36,
|
||||
unfoldOnClickAfterEndOfLine = 37,
|
||||
fontFamily = 38,
|
||||
fontInfo = 39,
|
||||
fontLigatures = 40,
|
||||
fontSize = 41,
|
||||
fontWeight = 42,
|
||||
formatOnPaste = 43,
|
||||
formatOnType = 44,
|
||||
glyphMargin = 45,
|
||||
gotoLocation = 46,
|
||||
hideCursorInOverviewRuler = 47,
|
||||
highlightActiveIndentGuide = 48,
|
||||
hover = 49,
|
||||
inDiffEditor = 50,
|
||||
letterSpacing = 51,
|
||||
lightbulb = 52,
|
||||
lineDecorationsWidth = 53,
|
||||
lineHeight = 54,
|
||||
lineNumbers = 55,
|
||||
lineNumbersMinChars = 56,
|
||||
linkedEditing = 57,
|
||||
links = 58,
|
||||
matchBrackets = 59,
|
||||
minimap = 60,
|
||||
mouseStyle = 61,
|
||||
mouseWheelScrollSensitivity = 62,
|
||||
mouseWheelZoom = 63,
|
||||
multiCursorMergeOverlapping = 64,
|
||||
multiCursorModifier = 65,
|
||||
multiCursorPaste = 66,
|
||||
occurrencesHighlight = 67,
|
||||
overviewRulerBorder = 68,
|
||||
overviewRulerLanes = 69,
|
||||
padding = 70,
|
||||
parameterHints = 71,
|
||||
peekWidgetDefaultFocus = 72,
|
||||
definitionLinkOpensInPeek = 73,
|
||||
quickSuggestions = 74,
|
||||
quickSuggestionsDelay = 75,
|
||||
readOnly = 76,
|
||||
renameOnType = 77,
|
||||
renderControlCharacters = 78,
|
||||
renderIndentGuides = 79,
|
||||
renderFinalNewline = 80,
|
||||
renderLineHighlight = 81,
|
||||
renderLineHighlightOnlyWhenFocus = 82,
|
||||
renderValidationDecorations = 83,
|
||||
renderWhitespace = 84,
|
||||
revealHorizontalRightPadding = 85,
|
||||
roundedSelection = 86,
|
||||
rulers = 87,
|
||||
scrollbar = 88,
|
||||
scrollBeyondLastColumn = 89,
|
||||
scrollBeyondLastLine = 90,
|
||||
scrollPredominantAxis = 91,
|
||||
selectionClipboard = 92,
|
||||
selectionHighlight = 93,
|
||||
selectOnLineNumbers = 94,
|
||||
showFoldingControls = 95,
|
||||
showUnused = 96,
|
||||
snippetSuggestions = 97,
|
||||
smartSelect = 98,
|
||||
smoothScrolling = 99,
|
||||
stickyTabStops = 100,
|
||||
stopRenderingLineAfter = 101,
|
||||
suggest = 102,
|
||||
suggestFontSize = 103,
|
||||
suggestLineHeight = 104,
|
||||
suggestOnTriggerCharacters = 105,
|
||||
suggestSelection = 106,
|
||||
tabCompletion = 107,
|
||||
tabIndex = 108,
|
||||
unusualLineTerminators = 109,
|
||||
useTabStops = 110,
|
||||
wordSeparators = 111,
|
||||
wordWrap = 112,
|
||||
wordWrapBreakAfterCharacters = 113,
|
||||
wordWrapBreakBeforeCharacters = 114,
|
||||
wordWrapColumn = 115,
|
||||
wordWrapOverride1 = 116,
|
||||
wordWrapOverride2 = 117,
|
||||
wrappingIndent = 118,
|
||||
wrappingStrategy = 119,
|
||||
showDeprecated = 120,
|
||||
inlineHints = 121,
|
||||
editorClassName = 122,
|
||||
pixelRatio = 123,
|
||||
tabFocusMode = 124,
|
||||
layoutInfo = 125,
|
||||
wrappingInfo = 126
|
||||
domReadOnly = 28,
|
||||
dragAndDrop = 29,
|
||||
emptySelectionClipboard = 30,
|
||||
extraEditorClassName = 31,
|
||||
fastScrollSensitivity = 32,
|
||||
find = 33,
|
||||
fixedOverflowWidgets = 34,
|
||||
folding = 35,
|
||||
foldingStrategy = 36,
|
||||
foldingHighlight = 37,
|
||||
unfoldOnClickAfterEndOfLine = 38,
|
||||
fontFamily = 39,
|
||||
fontInfo = 40,
|
||||
fontLigatures = 41,
|
||||
fontSize = 42,
|
||||
fontWeight = 43,
|
||||
formatOnPaste = 44,
|
||||
formatOnType = 45,
|
||||
glyphMargin = 46,
|
||||
gotoLocation = 47,
|
||||
hideCursorInOverviewRuler = 48,
|
||||
highlightActiveIndentGuide = 49,
|
||||
hover = 50,
|
||||
inDiffEditor = 51,
|
||||
letterSpacing = 52,
|
||||
lightbulb = 53,
|
||||
lineDecorationsWidth = 54,
|
||||
lineHeight = 55,
|
||||
lineNumbers = 56,
|
||||
lineNumbersMinChars = 57,
|
||||
linkedEditing = 58,
|
||||
links = 59,
|
||||
matchBrackets = 60,
|
||||
minimap = 61,
|
||||
mouseStyle = 62,
|
||||
mouseWheelScrollSensitivity = 63,
|
||||
mouseWheelZoom = 64,
|
||||
multiCursorMergeOverlapping = 65,
|
||||
multiCursorModifier = 66,
|
||||
multiCursorPaste = 67,
|
||||
occurrencesHighlight = 68,
|
||||
overviewRulerBorder = 69,
|
||||
overviewRulerLanes = 70,
|
||||
padding = 71,
|
||||
parameterHints = 72,
|
||||
peekWidgetDefaultFocus = 73,
|
||||
definitionLinkOpensInPeek = 74,
|
||||
quickSuggestions = 75,
|
||||
quickSuggestionsDelay = 76,
|
||||
readOnly = 77,
|
||||
renameOnType = 78,
|
||||
renderControlCharacters = 79,
|
||||
renderIndentGuides = 80,
|
||||
renderFinalNewline = 81,
|
||||
renderLineHighlight = 82,
|
||||
renderLineHighlightOnlyWhenFocus = 83,
|
||||
renderValidationDecorations = 84,
|
||||
renderWhitespace = 85,
|
||||
revealHorizontalRightPadding = 86,
|
||||
roundedSelection = 87,
|
||||
rulers = 88,
|
||||
scrollbar = 89,
|
||||
scrollBeyondLastColumn = 90,
|
||||
scrollBeyondLastLine = 91,
|
||||
scrollPredominantAxis = 92,
|
||||
selectionClipboard = 93,
|
||||
selectionHighlight = 94,
|
||||
selectOnLineNumbers = 95,
|
||||
showFoldingControls = 96,
|
||||
showUnused = 97,
|
||||
snippetSuggestions = 98,
|
||||
smartSelect = 99,
|
||||
smoothScrolling = 100,
|
||||
stickyTabStops = 101,
|
||||
stopRenderingLineAfter = 102,
|
||||
suggest = 103,
|
||||
suggestFontSize = 104,
|
||||
suggestLineHeight = 105,
|
||||
suggestOnTriggerCharacters = 106,
|
||||
suggestSelection = 107,
|
||||
tabCompletion = 108,
|
||||
tabIndex = 109,
|
||||
unusualLineTerminators = 110,
|
||||
useTabStops = 111,
|
||||
wordSeparators = 112,
|
||||
wordWrap = 113,
|
||||
wordWrapBreakAfterCharacters = 114,
|
||||
wordWrapBreakBeforeCharacters = 115,
|
||||
wordWrapColumn = 116,
|
||||
wordWrapOverride1 = 117,
|
||||
wordWrapOverride2 = 118,
|
||||
wrappingIndent = 119,
|
||||
wrappingStrategy = 120,
|
||||
showDeprecated = 121,
|
||||
inlineHints = 122,
|
||||
editorClassName = 123,
|
||||
pixelRatio = 124,
|
||||
tabFocusMode = 125,
|
||||
layoutInfo = 126,
|
||||
wrappingInfo = 127
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
207
src/vs/monaco.d.ts
vendored
207
src/vs/monaco.d.ts
vendored
|
@ -2720,10 +2720,15 @@ declare namespace monaco.editor {
|
|||
*/
|
||||
extraEditorClassName?: string;
|
||||
/**
|
||||
* Should the editor be read only.
|
||||
* Should the editor be read only. See also `domReadOnly`.
|
||||
* Defaults to false.
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
/**
|
||||
* Should the textarea used for input use the DOM `readonly` attribute.
|
||||
* Defaults to false.
|
||||
*/
|
||||
domReadOnly?: boolean;
|
||||
/**
|
||||
* Enable linked editing.
|
||||
* Defaults to false.
|
||||
|
@ -4005,105 +4010,106 @@ declare namespace monaco.editor {
|
|||
cursorWidth = 25,
|
||||
disableLayerHinting = 26,
|
||||
disableMonospaceOptimizations = 27,
|
||||
dragAndDrop = 28,
|
||||
emptySelectionClipboard = 29,
|
||||
extraEditorClassName = 30,
|
||||
fastScrollSensitivity = 31,
|
||||
find = 32,
|
||||
fixedOverflowWidgets = 33,
|
||||
folding = 34,
|
||||
foldingStrategy = 35,
|
||||
foldingHighlight = 36,
|
||||
unfoldOnClickAfterEndOfLine = 37,
|
||||
fontFamily = 38,
|
||||
fontInfo = 39,
|
||||
fontLigatures = 40,
|
||||
fontSize = 41,
|
||||
fontWeight = 42,
|
||||
formatOnPaste = 43,
|
||||
formatOnType = 44,
|
||||
glyphMargin = 45,
|
||||
gotoLocation = 46,
|
||||
hideCursorInOverviewRuler = 47,
|
||||
highlightActiveIndentGuide = 48,
|
||||
hover = 49,
|
||||
inDiffEditor = 50,
|
||||
letterSpacing = 51,
|
||||
lightbulb = 52,
|
||||
lineDecorationsWidth = 53,
|
||||
lineHeight = 54,
|
||||
lineNumbers = 55,
|
||||
lineNumbersMinChars = 56,
|
||||
linkedEditing = 57,
|
||||
links = 58,
|
||||
matchBrackets = 59,
|
||||
minimap = 60,
|
||||
mouseStyle = 61,
|
||||
mouseWheelScrollSensitivity = 62,
|
||||
mouseWheelZoom = 63,
|
||||
multiCursorMergeOverlapping = 64,
|
||||
multiCursorModifier = 65,
|
||||
multiCursorPaste = 66,
|
||||
occurrencesHighlight = 67,
|
||||
overviewRulerBorder = 68,
|
||||
overviewRulerLanes = 69,
|
||||
padding = 70,
|
||||
parameterHints = 71,
|
||||
peekWidgetDefaultFocus = 72,
|
||||
definitionLinkOpensInPeek = 73,
|
||||
quickSuggestions = 74,
|
||||
quickSuggestionsDelay = 75,
|
||||
readOnly = 76,
|
||||
renameOnType = 77,
|
||||
renderControlCharacters = 78,
|
||||
renderIndentGuides = 79,
|
||||
renderFinalNewline = 80,
|
||||
renderLineHighlight = 81,
|
||||
renderLineHighlightOnlyWhenFocus = 82,
|
||||
renderValidationDecorations = 83,
|
||||
renderWhitespace = 84,
|
||||
revealHorizontalRightPadding = 85,
|
||||
roundedSelection = 86,
|
||||
rulers = 87,
|
||||
scrollbar = 88,
|
||||
scrollBeyondLastColumn = 89,
|
||||
scrollBeyondLastLine = 90,
|
||||
scrollPredominantAxis = 91,
|
||||
selectionClipboard = 92,
|
||||
selectionHighlight = 93,
|
||||
selectOnLineNumbers = 94,
|
||||
showFoldingControls = 95,
|
||||
showUnused = 96,
|
||||
snippetSuggestions = 97,
|
||||
smartSelect = 98,
|
||||
smoothScrolling = 99,
|
||||
stickyTabStops = 100,
|
||||
stopRenderingLineAfter = 101,
|
||||
suggest = 102,
|
||||
suggestFontSize = 103,
|
||||
suggestLineHeight = 104,
|
||||
suggestOnTriggerCharacters = 105,
|
||||
suggestSelection = 106,
|
||||
tabCompletion = 107,
|
||||
tabIndex = 108,
|
||||
unusualLineTerminators = 109,
|
||||
useTabStops = 110,
|
||||
wordSeparators = 111,
|
||||
wordWrap = 112,
|
||||
wordWrapBreakAfterCharacters = 113,
|
||||
wordWrapBreakBeforeCharacters = 114,
|
||||
wordWrapColumn = 115,
|
||||
wordWrapOverride1 = 116,
|
||||
wordWrapOverride2 = 117,
|
||||
wrappingIndent = 118,
|
||||
wrappingStrategy = 119,
|
||||
showDeprecated = 120,
|
||||
inlineHints = 121,
|
||||
editorClassName = 122,
|
||||
pixelRatio = 123,
|
||||
tabFocusMode = 124,
|
||||
layoutInfo = 125,
|
||||
wrappingInfo = 126
|
||||
domReadOnly = 28,
|
||||
dragAndDrop = 29,
|
||||
emptySelectionClipboard = 30,
|
||||
extraEditorClassName = 31,
|
||||
fastScrollSensitivity = 32,
|
||||
find = 33,
|
||||
fixedOverflowWidgets = 34,
|
||||
folding = 35,
|
||||
foldingStrategy = 36,
|
||||
foldingHighlight = 37,
|
||||
unfoldOnClickAfterEndOfLine = 38,
|
||||
fontFamily = 39,
|
||||
fontInfo = 40,
|
||||
fontLigatures = 41,
|
||||
fontSize = 42,
|
||||
fontWeight = 43,
|
||||
formatOnPaste = 44,
|
||||
formatOnType = 45,
|
||||
glyphMargin = 46,
|
||||
gotoLocation = 47,
|
||||
hideCursorInOverviewRuler = 48,
|
||||
highlightActiveIndentGuide = 49,
|
||||
hover = 50,
|
||||
inDiffEditor = 51,
|
||||
letterSpacing = 52,
|
||||
lightbulb = 53,
|
||||
lineDecorationsWidth = 54,
|
||||
lineHeight = 55,
|
||||
lineNumbers = 56,
|
||||
lineNumbersMinChars = 57,
|
||||
linkedEditing = 58,
|
||||
links = 59,
|
||||
matchBrackets = 60,
|
||||
minimap = 61,
|
||||
mouseStyle = 62,
|
||||
mouseWheelScrollSensitivity = 63,
|
||||
mouseWheelZoom = 64,
|
||||
multiCursorMergeOverlapping = 65,
|
||||
multiCursorModifier = 66,
|
||||
multiCursorPaste = 67,
|
||||
occurrencesHighlight = 68,
|
||||
overviewRulerBorder = 69,
|
||||
overviewRulerLanes = 70,
|
||||
padding = 71,
|
||||
parameterHints = 72,
|
||||
peekWidgetDefaultFocus = 73,
|
||||
definitionLinkOpensInPeek = 74,
|
||||
quickSuggestions = 75,
|
||||
quickSuggestionsDelay = 76,
|
||||
readOnly = 77,
|
||||
renameOnType = 78,
|
||||
renderControlCharacters = 79,
|
||||
renderIndentGuides = 80,
|
||||
renderFinalNewline = 81,
|
||||
renderLineHighlight = 82,
|
||||
renderLineHighlightOnlyWhenFocus = 83,
|
||||
renderValidationDecorations = 84,
|
||||
renderWhitespace = 85,
|
||||
revealHorizontalRightPadding = 86,
|
||||
roundedSelection = 87,
|
||||
rulers = 88,
|
||||
scrollbar = 89,
|
||||
scrollBeyondLastColumn = 90,
|
||||
scrollBeyondLastLine = 91,
|
||||
scrollPredominantAxis = 92,
|
||||
selectionClipboard = 93,
|
||||
selectionHighlight = 94,
|
||||
selectOnLineNumbers = 95,
|
||||
showFoldingControls = 96,
|
||||
showUnused = 97,
|
||||
snippetSuggestions = 98,
|
||||
smartSelect = 99,
|
||||
smoothScrolling = 100,
|
||||
stickyTabStops = 101,
|
||||
stopRenderingLineAfter = 102,
|
||||
suggest = 103,
|
||||
suggestFontSize = 104,
|
||||
suggestLineHeight = 105,
|
||||
suggestOnTriggerCharacters = 106,
|
||||
suggestSelection = 107,
|
||||
tabCompletion = 108,
|
||||
tabIndex = 109,
|
||||
unusualLineTerminators = 110,
|
||||
useTabStops = 111,
|
||||
wordSeparators = 112,
|
||||
wordWrap = 113,
|
||||
wordWrapBreakAfterCharacters = 114,
|
||||
wordWrapBreakBeforeCharacters = 115,
|
||||
wordWrapColumn = 116,
|
||||
wordWrapOverride1 = 117,
|
||||
wordWrapOverride2 = 118,
|
||||
wrappingIndent = 119,
|
||||
wrappingStrategy = 120,
|
||||
showDeprecated = 121,
|
||||
inlineHints = 122,
|
||||
editorClassName = 123,
|
||||
pixelRatio = 124,
|
||||
tabFocusMode = 125,
|
||||
layoutInfo = 126,
|
||||
wrappingInfo = 127
|
||||
}
|
||||
export const EditorOptions: {
|
||||
acceptSuggestionOnCommitCharacter: IEditorOption<EditorOption.acceptSuggestionOnCommitCharacter, boolean>;
|
||||
|
@ -4135,6 +4141,7 @@ declare namespace monaco.editor {
|
|||
cursorWidth: IEditorOption<EditorOption.cursorWidth, number>;
|
||||
disableLayerHinting: IEditorOption<EditorOption.disableLayerHinting, boolean>;
|
||||
disableMonospaceOptimizations: IEditorOption<EditorOption.disableMonospaceOptimizations, boolean>;
|
||||
domReadOnly: IEditorOption<EditorOption.domReadOnly, boolean>;
|
||||
dragAndDrop: IEditorOption<EditorOption.dragAndDrop, boolean>;
|
||||
emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
|
||||
extraEditorClassName: IEditorOption<EditorOption.extraEditorClassName, string>;
|
||||
|
|
Loading…
Reference in a new issue