其他分享
首页 > 其他分享> > 模拟按键'ESC',解决韩语等输入法对输入框(codemirror)的支持

模拟按键'ESC',解决韩语等输入法对输入框(codemirror)的支持

作者:互联网

  on(div, "compositionend", function (e) {
      if (this$1.composing) {
          if (e.data != this$1.composing.data) { this$1.readFromDOMSoon() }
          this$1.composing.done = true
          //simulate 'ESC',  ex.Korean
          var keyboardEventInit = { key: "Escape", code: "Escape", keyCode: 27, which: 27, composed: true, bubbles:true };
              var evtObj = new KeyboardEvent('keydown', keyboardEventInit);
              e.target.dispatchEvent(evtObj);
      }
  })

标签:输入法,27,data,keyboardEventInit,composing,输入框,韩语,var,true
来源: https://www.cnblogs.com/tangge/p/15209108.html