@atlaskit/editor-plugin-width
Version:
Width plugin for @atlaskit/editor-core
23 lines (22 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useWidthObserver = void 0;
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
var _conditionalHooksFactory = require("@atlaskit/platform-feature-flags-react/conditional-hooks-factory/conditional-hooks-factory");
var _useResizeWidthObserver = require("./useResizeWidthObserver");
var _useResizeWidthObserverNext = require("./useResizeWidthObserverNext");
/**
* Selects the width observer implementation for the lifetime of the editor.
*
* `conditionalHooksFactory` calls the condition on every render so each one is recorded as an
* exposure, while caching the first result so hook order stays stable. Only the selected hook
* runs.
*
* On cleanup, delete this file plus `useResizeWidthObserver` and `useRefreshOnTransition` (which
* holds the duplicate `setEditorWidth`), and point `usePluginHook` at `useResizeWidthObserverNext`.
*/
var useWidthObserver = exports.useWidthObserver = (0, _conditionalHooksFactory.conditionalHooksFactory)(function () {
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_forced_layout');
}, _useResizeWidthObserverNext.useResizeWidthObserverNext, _useResizeWidthObserver.useResizeWidthObserver);