UNPKG

@atlaskit/editor-plugin-card

Version:

Card plugin for @atlaskit/editor-core

19 lines (17 loc) • 971 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useCardRegistry = void 0; var _react = require("react"); var emptySnapshot = function emptySnapshot() { return undefined; }; var emptySubscription = function emptySubscription() { return function () {}; }; /** Subscribe to resolved card metadata without observing every editor transaction. */ var useCardRegistry = exports.useCardRegistry = function useCardRegistry(actions) { var _actions$subscribeToC, _actions$getCardRegis; return (0, _react.useSyncExternalStore)((_actions$subscribeToC = actions === null || actions === void 0 ? void 0 : actions.subscribeToCardRegistry) !== null && _actions$subscribeToC !== void 0 ? _actions$subscribeToC : emptySubscription, (_actions$getCardRegis = actions === null || actions === void 0 ? void 0 : actions.getCardRegistrations) !== null && _actions$getCardRegis !== void 0 ? _actions$getCardRegis : emptySnapshot, emptySnapshot); };