endBatchCommand () {
    if (!this.undoManager_) { return this }
    if (this.currentBatchCommand_) {
      const batchCommand = this.currentBatchCommand_
      this.batchCommandStack_.pop()
      const { length: len } = this.batchCommandStack_
      this.currentBatchCommand_ = len ? this.batchCommandStack_[len - 1] : null
      this.addCommand_(batchCommand)
    }
    return this
  }
End a batch command and add it to the history or a parent batch command.
@returns {module:history.HistoryRecordingService}