@tinymce/tinymce-react
Advanced tools
Comparing version 3.11.1-rc.20210323011740676.dfab82f to 3.11.1-rc.20210324014134958.5891340
@@ -7,2 +7,7 @@ # Change log | ||
## 3.11.1 - 2021-03-24 | ||
### Fixed | ||
- Stopped inline editor grabbing focus when the value is set | ||
- Caught exceptions thrown while trying to restore selection after setting content | ||
## 3.11.0 - 2021-03-23 | ||
@@ -9,0 +14,0 @@ ### Changed |
@@ -138,8 +138,20 @@ "use strict"; | ||
localEditor_1.undoManager.transact(function () { | ||
var bookmark = localEditor_1.selection.getBookmark(3); | ||
// inline editors grab focus when restoring selection | ||
// so we don't try to keep their selection unless they are currently focused | ||
var bookmark; | ||
if (!_this.inline || localEditor_1.hasFocus()) { | ||
try { | ||
// getBookmark throws exceptions when the editor has not been focused | ||
// possibly only in inline mode but I'm not taking chances | ||
bookmark = localEditor_1.selection.getBookmark(3); | ||
} | ||
catch (e) { /* ignore */ } | ||
} | ||
localEditor_1.setContent(_this.props.value); | ||
try { | ||
localEditor_1.selection.moveToBookmark(bookmark); | ||
if (bookmark) { | ||
try { | ||
localEditor_1.selection.moveToBookmark(bookmark); | ||
} | ||
catch (e) { /* ignore */ } | ||
} | ||
catch (e) { /* ignore */ } | ||
}); | ||
@@ -146,0 +158,0 @@ } |
@@ -135,8 +135,20 @@ /** | ||
localEditor_1.undoManager.transact(function () { | ||
var bookmark = localEditor_1.selection.getBookmark(3); | ||
// inline editors grab focus when restoring selection | ||
// so we don't try to keep their selection unless they are currently focused | ||
var bookmark; | ||
if (!_this.inline || localEditor_1.hasFocus()) { | ||
try { | ||
// getBookmark throws exceptions when the editor has not been focused | ||
// possibly only in inline mode but I'm not taking chances | ||
bookmark = localEditor_1.selection.getBookmark(3); | ||
} | ||
catch (e) { /* ignore */ } | ||
} | ||
localEditor_1.setContent(_this.props.value); | ||
try { | ||
localEditor_1.selection.moveToBookmark(bookmark); | ||
if (bookmark) { | ||
try { | ||
localEditor_1.selection.moveToBookmark(bookmark); | ||
} | ||
catch (e) { /* ignore */ } | ||
} | ||
catch (e) { /* ignore */ } | ||
}); | ||
@@ -143,0 +155,0 @@ } |
@@ -69,4 +69,4 @@ { | ||
}, | ||
"version": "3.11.1-rc.20210323011740676.dfab82f", | ||
"version": "3.11.1-rc.20210324014134958.5891340", | ||
"name": "@tinymce/tinymce-react" | ||
} |
71741
1431