Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Editor = props => {
const intl = useIntl();
const ref = React.useRef();
const prevIsFocused = usePrevious(props.editor.value.selection.isFocused);
const [renderToggleButton, setRenderToggleButton] = React.useState(false);
const { toggleLanguage } = props;
const onToggle = React.useCallback(() => {
toggleLanguage(props.language);
}, [toggleLanguage, props.language]);
const updateRenderToggleButton = React.useCallback(() => {
const doesExceedCollapsedHeightLimit =
ref.current.clientHeight > COLLAPSED_HEIGHT;
if (doesExceedCollapsedHeightLimit && !renderToggleButton) {
setRenderToggleButton(true);
}
if (!doesExceedCollapsedHeightLimit && renderToggleButton) {