phx-react
Version:
PHX REACT
16 lines • 904 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useSharedHistoryContext = exports.SharedHistoryContext = void 0;
const tslib_1 = require("tslib");
const LexicalHistoryPlugin_1 = require("@lexical/react/LexicalHistoryPlugin");
const React = tslib_1.__importStar(require("react"));
const react_1 = require("react");
const Context = (0, react_1.createContext)({});
const SharedHistoryContext = ({ children }) => {
const historyContext = (0, react_1.useMemo)(() => ({ historyState: (0, LexicalHistoryPlugin_1.createEmptyHistoryState)() }), []);
return React.createElement(Context.Provider, { value: historyContext }, children);
};
exports.SharedHistoryContext = SharedHistoryContext;
const useSharedHistoryContext = () => (0, react_1.useContext)(Context);
exports.useSharedHistoryContext = useSharedHistoryContext;
//# sourceMappingURL=SharedHistoryContext.js.map