Skip to content

Commit 5012e87

Browse files
committed
[contenteditable input] Force editor selection in focus method
So that the selection isn't reset to the start of the element by div.focus().
1 parent beb8382 commit 5012e87

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/input/ContentEditableInput.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ ContentEditableInput.prototype = copyObj({
199199
},
200200

201201
focus: function() {
202-
if (this.cm.options.readOnly != "nocursor") this.div.focus()
202+
if (this.cm.options.readOnly != "nocursor") {
203+
if (!this.selectionInEditor())
204+
this.showSelection(this.prepareSelection(), true)
205+
this.div.focus()
206+
}
203207
},
204208
blur: function() { this.div.blur() },
205209
getField: function() { return this.div },

0 commit comments

Comments
 (0)