onfocus 和 onblur

编辑区域 focus(聚焦)和 blur(失焦)时触发的回调函数。

  1. const E = window.wangEditor
  2. const editor = new E('#div1')
  3. editor.config.onblur = function (newHtml) {
  4. console.log('onblur', newHtml) // 获取最新的 html 内容
  5. }
  6. editor.config.onfocus = function (newHtml) {
  7. console.log('onfocus', newHtml) // 获取最新的 html 内容
  8. }
  9. editor.create()