فهرست منبع

feat(handsontable): 对外暴露及修改EditorManager

vian 3 سال پیش
والد
کامیت
2e96c4e96d
4فایلهای تغییر یافته به همراه18 افزوده شده و 2 حذف شده
  1. 10 0
      handsontable/handsontable.d.ts
  2. 1 1
      handsontable/package.json
  3. 5 1
      handsontable/src/editorManager.js
  4. 2 0
      handsontable/src/index.js

+ 10 - 0
handsontable/handsontable.d.ts

@@ -774,6 +774,16 @@ declare namespace Handsontable {
       extendEvent(context: object, event: Event): any;
     }
 
+    interface EditorManagerInstance {
+      lockEditor(): void;
+      unlockEditor(): void;
+      getLockState(): boolean;
+    }
+
+    interface EditorManager {
+      getInstance(hotInstance: _Handsontable.Core, hotSettings?: Handsontable.DefaultSettings, selection?: any, datamap?: any): EditorManagerInstance
+    }
+
     interface GhostTable {
       columns: number[];
       container: HTMLElement | null;

+ 1 - 1
handsontable/package.json

@@ -10,7 +10,7 @@
     "url": "https://github.com/handsontable/handsontable/issues"
   },
   "author": "Handsoncode <hello@handsontable.com>",
-  "version": "6.3.15",
+  "version": "6.3.16",
   "browser": "dist/handsontable.js",
   "main": "commonjs/index.js",
   "module": "es/index.js",

+ 5 - 1
handsontable/src/editorManager.js

@@ -280,7 +280,7 @@ function EditorManager(instance, priv, selection) {
   };
 
   /**
-  * Unlock the editor from being prepared and closed. This method restores the original behavior of
+  * Unlock the editor from being prepare  d and closed. This method restores the original behavior of
   * the editors where for every new selection its instances are closed.
   *
   * @function unlockEditor
@@ -290,6 +290,10 @@ function EditorManager(instance, priv, selection) {
     lock = false;
   };
 
+  this.getLockState = function() {
+    return lock;
+  };
+
   /**
    * Destroy current editor, if exists.
    *

+ 2 - 0
handsontable/src/index.js

@@ -12,6 +12,7 @@ import { getRegisteredCellTypeNames, getCellType, registerCellType } from './cel
 import Core from './core';
 import jQueryWrapper from './helpers/wrappers/jquery';
 import EventManager, { getListenersCounter } from './eventManager';
+import EditorManager from './editorManager';
 import Hooks from './pluginHooks';
 import GhostTable from './utils/ghostTable';
 import * as arrayHelpers from './helpers/array';
@@ -49,6 +50,7 @@ jQueryWrapper(Handsontable);
 Handsontable.Core = Core;
 Handsontable.DefaultSettings = DefaultSettings;
 Handsontable.EventManager = EventManager;
+Handsontable.EditorManager = EditorManager;
 Handsontable._getListenersCounter = getListenersCounter; // For MemoryLeak tests
 
 Handsontable.buildDate = process.env.HOT_BUILD_DATE;