mirror of https://github.com/status-im/codimd.git
Fixed OT not handle when selection is empty
This commit is contained in:
parent
53f26a7771
commit
3f64ec79b7
|
@ -247,7 +247,7 @@ ot.CodeMirrorAdapter = (function (global) {
|
||||||
|
|
||||||
CodeMirrorAdapter.prototype.setSelection = function (selection) {
|
CodeMirrorAdapter.prototype.setSelection = function (selection) {
|
||||||
var ranges = [];
|
var ranges = [];
|
||||||
for (var i = 0; i < selection.ranges.length; i++) {
|
for (var i = 0; selection && i < selection.ranges.length; i++) {
|
||||||
var range = selection.ranges[i];
|
var range = selection.ranges[i];
|
||||||
ranges[i] = {
|
ranges[i] = {
|
||||||
anchor: this.cm.posFromIndex(range.anchor),
|
anchor: this.cm.posFromIndex(range.anchor),
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue