code: function () {
          // -------- 绑定 onchange 事件 --------
          let onChangeTimeoutId = 0
          let beforeChangeHtml = this.txt.html()
          const config = this.config
  
          // onchange 触发延迟时间
          let onchangeTimeout = config.onchangeTimeout
          onchangeTimeout = parseInt(onchangeTimeout, 10)
          if (!onchangeTimeout || onchangeTimeout <= 0) {
              onchangeTimeout = 200
          }
  
          const onchange = config.onchange
          if (onchange && typeof onchange === 'function'){
              // 触发 change 的有三个场景：
              // 1. $textContainerElem.on('click keyup')
              // 2. $toolbarElem.on('click')
              // 3. editor.cmd.do()
              this.change = function () {
                  // 判断是否有变化
                  let currentHtml = this.txt.html()
  
                  if (currentHtml.length === beforeChangeHtml.length) {
                      // 需要比较每一个字符
                      if (currentHtml === beforeChangeHtml) {
                          return
                      }
                  }
  
                  // 执行，使用节流
                  if (onChangeTimeoutId) {
                      clearTimeout(onChangeTimeoutId)
                  }
                  onChangeTimeoutId = setTimeout(() => {
                      // 触发配置的 onchange 函数
                      onchange(currentHtml)
                      beforeChangeHtml = currentHtml
                  }, onchangeTimeout)
              }   
          }
  
          // -------- 绑定 onblur 事件 --------
          const onblur = config.onblur
          if (onblur && typeof onblur === 'function') {
              this.onblur = function () {
                  const currentHtml = this.txt.html()
                  onblur(currentHtml)
              }
          }
  
          // -------- 绑定 onfocus 事件 --------
          const onfocus = config.onfocus
          if (onfocus && typeof onfocus === 'function') {
              this.onfocus = function () {
                  onfocus()
              }
          }
          
      }
docs: 绑定事件