UNPKG

@atlaskit/editor-plugin-floating-toolbar

Version:

Floating toolbar plugin for @atlaskit/editor-core

13 lines (12 loc) • 759 B
import { useSyncExternalStore } from 'react'; var emptySnapshot = function emptySnapshot() { return 0; }; var emptySubscription = function emptySubscription() { return function () {}; }; /** Refresh toolbar content when its optional external store changes. */ export var useToolbarExternalStore = function useToolbarExternalStore(store) { var _store$subscribe, _store$getSnapshot; 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); };