lib/editTree/base.js
function(value, start, end) {
			// create modification range
			var r = range.create(start, typeof end === 'undefined' ? 0 : end - start);
			var delta = value.length - r.length();
			
			var update = function(obj) {
				Object.keys(obj).forEach(function(k) {
					if (obj[k] >= r.end) {
						obj[k] += delta;
					}
				});
			};
			
			// update affected positions of current container
			update(this._positions);
			
			// update affected positions of children
			var recursiveUpdate = function(items) {
				items.forEach(function(item) {
					update(item._positions);
					if (item.type == 'container') {
						recursiveUpdate(item.list());
					}
				});
			};

			recursiveUpdate(this.list());
			this.source = utils.replaceSubstring(this.source, value, r);
		}
function(value, start, end) {
			// create modification range
			var r = range.create(start, typeof end === 'undefined' ? 0 : end - start);
			var delta = value.length - r.length();
			
			var update = function(obj) {
				Object.keys(obj).forEach(function(k) {
					if (obj[k] >= r.end) {
						obj[k] += delta;
					}
				});
			};
			
			// update affected positions of current container
			update(this._positions);
			
			// update affected positions of children
			var recursiveUpdate = function(items) {
				items.forEach(function(item) {
					update(item._positions);
					if (item.type == 'container') {
						recursiveUpdate(item.list());
					}
				});
			};

			recursiveUpdate(this.list());
			this.source = utils.replaceSubstring(this.source, value, r);
		}
function ( value , start , end ) { // create modification range var r = range . create ( start , typeof end === 'undefined' ? 0 : end - start ) ; var delta = value . length - r . length ( ) ; var update = function ( obj ) { Object . keys ( obj ) . forEach ( function ( k ) { if ( obj [ k ] >= r . end ) { obj [ k ] += delta ; } } ) ; } ; // update affected positions of current container update ( this . _positions ) ; // update affected positions of children var recursiveUpdate = function ( items ) { items . forEach ( function ( item ) { update ( item . _positions ) ; if ( item . type == 'container' ) { recursiveUpdate ( item . list ( ) ) ; } } ) ; } ; recursiveUpdate ( this . list ( ) ) ; this . source = utils . replaceSubstring ( this . source , value , r ) ; }
Replace substring of tag's source
@param {String} value
@param {Number} start
@param {Number} end
@private
Replace substring of tag s source