Fixed #586: caret position lost when switching browser tabs
This commit is contained in:
parent
3397b97f98
commit
d293cbcfc0
|
@ -6,6 +6,7 @@ https://github.com/josdejong/jsoneditor
|
||||||
|
|
||||||
- Dropped support for bower, removed the `dist` folder from the git repository.
|
- Dropped support for bower, removed the `dist` folder from the git repository.
|
||||||
- Converted the code into ES6, put Babel transpiler in place.
|
- Converted the code into ES6, put Babel transpiler in place.
|
||||||
|
- Fixed #586: caret position lost when switching browser tabs.
|
||||||
|
|
||||||
|
|
||||||
## 2019-08-28, version 6.4.1
|
## 2019-08-28, version 6.4.1
|
||||||
|
|
|
@ -2817,8 +2817,10 @@ Node.prototype.onEvent = function (event) {
|
||||||
this._getDomValue()
|
this._getDomValue()
|
||||||
this._clearValueError()
|
this._clearValueError()
|
||||||
this._updateDomValue()
|
this._updateDomValue()
|
||||||
if (this.value) {
|
const escapedValue = this._escapeHTML(this.value)
|
||||||
domValue.innerHTML = this._escapeHTML(this.value)
|
if (domValue.innerHTML !== escapedValue) {
|
||||||
|
// only update if changed, else you lose the caret position when changing tabs for example
|
||||||
|
domValue.innerHTML = escapedValue
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -2867,8 +2869,10 @@ Node.prototype.onEvent = function (event) {
|
||||||
case 'blur':
|
case 'blur':
|
||||||
this._getDomField(true)
|
this._getDomField(true)
|
||||||
this._updateDomField()
|
this._updateDomField()
|
||||||
if (this.field) {
|
const escapedField = this._escapeHTML(this.field)
|
||||||
domField.innerHTML = this._escapeHTML(this.field)
|
if (domField.innerHTML !== escapedField) {
|
||||||
|
// only update if changed, else you lose the caret position when changing tabs for example
|
||||||
|
domField.innerHTML = escapedField
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue