@lobehub/editor
Version:
A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.
25 lines (24 loc) • 696 B
JavaScript
'use client';
import { createContext, use, useMemo } from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
var EditorContext = /*#__PURE__*/createContext({
config: {}
});
export var EditorProvider = function EditorProvider(_ref) {
var children = _ref.children,
_ref$config = _ref.config,
config = _ref$config === void 0 ? {} : _ref$config;
var value = useMemo(function () {
return {
config: config
};
}, [config]);
return /*#__PURE__*/_jsx(EditorContext.Provider, {
value: value,
children: children
});
};
export var useEditorContent = function useEditorContent() {
return use(EditorContext);
};
EditorProvider.displayName = 'EditorProvider';