Skip to content

Commit dd931d8

Browse files
committed
Respect spellcheck/autocorrect/autocapitalize options in textarea input style
Issue #7009
1 parent d122e55 commit dd931d8

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/input/ContentEditableInput.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export default class ContentEditableInput {
9494
}
9595
// Old-fashioned briefly-focus-a-textarea hack
9696
let kludge = hiddenTextarea(), te = kludge.firstChild
97+
disableBrowserMagic(te)
9798
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild)
9899
te.value = lastCopied.text.join("\n")
99100
let hadFocus = activeElt(div.ownerDocument)

src/input/TextareaInput.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { operation, runInOp } from "../display/operations.js"
22
import { prepareSelection } from "../display/selection.js"
3-
import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, setLastCopied } from "./input.js"
3+
import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, disableBrowserMagic, setLastCopied } from "./input.js"
44
import { cursorCoords, posFromMouse } from "../measurement/position_measurement.js"
55
import { eventInWidget } from "../measurement/widgets.js"
66
import { simpleSelection } from "../model/selection.js"
@@ -117,6 +117,8 @@ export default class TextareaInput {
117117
// The semihidden textarea that is focused when the editor is
118118
// focused, and receives input.
119119
this.textarea = this.wrapper.firstChild
120+
let opts = this.cm.options
121+
disableBrowserMagic(this.textarea, opts.spellcheck, opts.autocorrect, opts.autocapitalize)
120122
}
121123

122124
screenReaderLabelChanged(label) {

src/input/input.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,5 @@ export function hiddenTextarea() {
130130
else te.setAttribute("wrap", "off")
131131
// If border: 0; -- iOS fails to open keyboard (issue #1287)
132132
if (ios) te.style.border = "1px solid black"
133-
disableBrowserMagic(te)
134133
return div
135134
}

0 commit comments

Comments
 (0)