Respect spellcheck/autocorrect/autocapitalize options in textarea input style

Issue https://github.com/codemirror/codemirror5/issues/7009
This commit is contained in:
Marijn Haverbeke 2022-12-09 10:47:14 +01:00
parent d122e55c48
commit dd931d8f89
3 changed files with 4 additions and 2 deletions

View File

@ -94,6 +94,7 @@ export default class ContentEditableInput {
}
// Old-fashioned briefly-focus-a-textarea hack
let kludge = hiddenTextarea(), te = kludge.firstChild
disableBrowserMagic(te)
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild)
te.value = lastCopied.text.join("\n")
let hadFocus = activeElt(div.ownerDocument)

View File

@ -1,6 +1,6 @@
import { operation, runInOp } from "../display/operations.js"
import { prepareSelection } from "../display/selection.js"
import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, setLastCopied } from "./input.js"
import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, disableBrowserMagic, setLastCopied } from "./input.js"
import { cursorCoords, posFromMouse } from "../measurement/position_measurement.js"
import { eventInWidget } from "../measurement/widgets.js"
import { simpleSelection } from "../model/selection.js"
@ -117,6 +117,8 @@ export default class TextareaInput {
// The semihidden textarea that is focused when the editor is
// focused, and receives input.
this.textarea = this.wrapper.firstChild
let opts = this.cm.options
disableBrowserMagic(this.textarea, opts.spellcheck, opts.autocorrect, opts.autocapitalize)
}
screenReaderLabelChanged(label) {

View File

@ -130,6 +130,5 @@ export function hiddenTextarea() {
else te.setAttribute("wrap", "off")
// If border: 0; -- iOS fails to open keyboard (issue #1287)
if (ios) te.style.border = "1px solid black"
disableBrowserMagic(te)
return div
}