allow any Range-like objects in session replace/remove
This commit is contained in:
parent
3b5d742feb
commit
b23265ad72
1 changed files with 4 additions and 0 deletions
|
|
@ -402,6 +402,8 @@ var Document = function(text) {
|
|||
*
|
||||
**/
|
||||
this.remove = function(range) {
|
||||
if (!range instanceof Range)
|
||||
range = Range.fromPoints(range.start, range.end);
|
||||
// clip to document
|
||||
range.start = this.$clipPosition(range.start);
|
||||
range.end = this.$clipPosition(range.end);
|
||||
|
|
@ -520,6 +522,8 @@ var Document = function(text) {
|
|||
*
|
||||
**/
|
||||
this.replace = function(range, text) {
|
||||
if (!range instanceof Range)
|
||||
range = Range.fromPoints(range.start, range.end);
|
||||
if (text.length == 0 && range.isEmpty())
|
||||
return range.start;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue