UNPKG

@atlaskit/editor-plugin-floating-toolbar

Version:

Floating toolbar plugin for @atlaskit/editor-core

19 lines (17 loc) • 905 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useToolbarExternalStore = void 0; var _react = require("react"); var emptySnapshot = function emptySnapshot() { return 0; }; var emptySubscription = function emptySubscription() { return function () {}; }; /** Refresh toolbar content when its optional external store changes. */ var useToolbarExternalStore = exports.useToolbarExternalStore = function useToolbarExternalStore(store) { var _store$subscribe, _store$getSnapshot; (0, _react.useSyncExternalStore)((_store$subscribe = store === null || store === void 0 ? void 0 : store.subscribe) !== null && _store$subscribe !== void 0 ? _store$subscribe : emptySubscription, (_store$getSnapshot = store === null || store === void 0 ? void 0 : store.getSnapshot) !== null && _store$getSnapshot !== void 0 ? _store$getSnapshot : emptySnapshot, emptySnapshot); };