@yuntijs/ui
Version:
☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps
23 lines • 754 B
JavaScript
import { useImperativeHandle } from 'react';
import { useActions } from "./hooks/useActions";
export var Methods = function Methods(_ref) {
var mdxRef = _ref.mdxRef;
var _useActions = useActions(),
getValue = _useActions.getValue,
initiateValue = _useActions.initiateValue,
handleClear = _useActions.handleClear,
handleFocus = _useActions.handleFocus;
useImperativeHandle(mdxRef, function () {
return {
getMarkdown: getValue,
setMarkdown: function setMarkdown(markdown) {
handleClear();
initiateValue(markdown);
},
insertMarkdown: initiateValue,
focus: handleFocus,
clearMarkdown: handleClear
};
}, [getValue, handleClear, handleFocus, initiateValue]);
return null;
};