import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { PopoverBody } from 'reactstrap'; import SeahubPopover from '../../../../components/common/seahub-popover'; import { gettext } from '../../../../utils/constants'; import '../../css/view-edit-popover.css'; class ViewEditPopover extends Component { constructor(props) { super(props); this.viewInputRef = React.createRef(); } componentDidMount() { const txtLength = this.props.viewName.length; this.viewInputRef.current.setSelectionRange(0, txtLength); } onChangeName = (e) => { let name = e.target.value; this.props.onChangeName(name); }; onEnter = (e) => { e.preventDefault(); this.props.toggleViewEditor(); }; renderViewName = () => { const { viewName } = this.props; return (
); }; render() { return (
{gettext('Modify Name')}
{this.renderViewName()}
); } } ViewEditPopover.propTypes = { viewName: PropTypes.string, onChangeName: PropTypes.func, toggleViewEditor: PropTypes.func, viewEditorId: PropTypes.string, }; export default ViewEditPopover;