code: function () {
              var t = this,
                  documentSelection = t.doc.getSelection();
  
              t.range = null;
  
              if (!documentSelection || !documentSelection.rangeCount) {
                  return;
              }
  
              var savedRange = t.range = documentSelection.getRangeAt(0),
                  range = t.doc.createRange(),
                  rangeStart;
              range.selectNodeContents(t.$ed[0]);
              range.setEnd(savedRange.startContainer, savedRange.startOffset);
              rangeStart = (range + '').length;
              t.metaRange = {
                  start: rangeStart,
                  end: rangeStart + (savedRange + '').length
              };
          }
docs: Range management