且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

修复handsontable自动完成不支持中文的bug

更新时间:2022-08-15 08:59:27

handsontable是一个功能强大的在线表格插件,可以实现类似于excel的功能,用于web表现非常不错,尤其是内部系统的表格处理更是锦上添花。


网址:http://handsontable.com/


目前最新的版本是0.12.2,但老外在开发时没有考虑到中文输入法的问题,出现了自动完成不能输入中文的bug,下面是修复的办法。修复后在firefox,chrome和IE11上测试通过。


修复步骤:


1.3936行中的"keydown"改为"keyup",结果如下:

1
2
3
      eventManager.addEventListener(document, 'keyup'function (ev){
        instance.runHooks('afterDocumentKeyDown', ev);
      });


2.注释掉1199,1202行,结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
  /**
   * Listen to document body keyboard input
   */
  this.listen = function () {
    Handsontable.activeGuid = instance.guid;
 
    if (document.activeElement && document.activeElement !== document.body) {
      //document.activeElement.blur();
    }
    else if (!document.activeElement) { //IE
      //document.body.focus();
    }
  };










本文转自 ustb80 51CTO博客,原文链接:http://blog.51cto.com/ustb80/1596319,如需转载请自行联系原作者