Skip to content

Commit 74a71c4

Browse files
evs-chrismarijnh
authored andcommitted
move field creation in TextareaInput to an overridable method
1 parent 708667b commit 74a71c4

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/input/TextareaInput.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,10 @@ export default class TextareaInput {
3232

3333
init(display) {
3434
let input = this, cm = this.cm
35+
this.createField(display)
36+
const te = this.textarea
3537

36-
// Wraps and hides input textarea
37-
let div = this.wrapper = hiddenTextarea()
38-
// The semihidden textarea that is focused when the editor is
39-
// focused, and receives input.
40-
let te = this.textarea = div.firstChild
41-
display.wrapper.insertBefore(div, display.wrapper.firstChild)
38+
display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild)
4239

4340
// Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
4441
if (ios) te.style.width = "0px"
@@ -105,6 +102,14 @@ export default class TextareaInput {
105102
})
106103
}
107104

105+
createField(_display) {
106+
// Wraps and hides input textarea
107+
this.wrapper = hiddenTextarea()
108+
// The semihidden textarea that is focused when the editor is
109+
// focused, and receives input.
110+
this.textarea = this.wrapper.firstChild
111+
}
112+
108113
prepareSelection() {
109114
// Redraw the selection and/or cursor
110115
let cm = this.cm, display = cm.display, doc = cm.doc

0 commit comments

Comments
 (0)