@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
29 lines (28 loc) • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useInternalTablePluginStateSelector = void 0;
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
/**
* **This hook is only for internal use and should not be used outside of the table plugin.**
*
* Hook to select a value from the internal table plugin state.
* This is a wrapper around `useSharedPluginStateSelector` to provide access to the entire
* `TableSharedStateInternal` type. Since tables plugin has a lot of internal state that is not
* exposed via the `TableSharedState` type, we need to use this hook to access it in a type safe way.
*
* @param api The editor API
* @param key Key of TableSharedStateInternal to select
* @param options
* @returns
* @example
*/
var useInternalTablePluginStateSelector = exports.useInternalTablePluginStateSelector = function useInternalTablePluginStateSelector(api, key, options) {
// Need to disable the eslint rule here because the key is for the TableSharedStateInternal type
// and we are using it as a string to access the value in the useSharedPluginStateSelector
// which is typed only for the public TableSharedState type.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var value = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, "table.".concat(key), options);
return value;
};