Pull the cursor out of bogus BR tarpits when it gets stuck

pull/1/head
ansuz 9 years ago
parent bac0e0ff88
commit afa1104d85

@ -373,6 +373,26 @@ define([
}; };
}; };
cursor.brFix = function () {
cursor.update();
var start = Range.start;
var end = Range.end;
if (!start.el) { return; }
if (start.el === end.el && start.offset === end.offset) {
if (start.el.tagName === 'BR') {
// get the parent element, which ought to be a P.
var P = start.el.parentNode;
[cursor.fixStart, cursor.fixEnd].forEach(function (f) {
f(P, 0);
});
cursor.fixSelection(cursor.makeSelection(), cursor.makeRange());
}
}
};
return cursor; return cursor;
}; };
}); });

Loading…
Cancel
Save