Pull the cursor out of bogus BR tarpits when it gets stuck
This commit is contained in:
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…
x
Reference in New Issue
Block a user