mirror of
https://github.com/plankanban/planka.git
synced 2025-08-03 20:45:27 +02:00
Allow creating label without name
This commit is contained in:
parent
b9d4024957
commit
4911816734
9 changed files with 31 additions and 51 deletions
|
@ -1,6 +1,4 @@
|
|||
import React, {
|
||||
useCallback, useEffect, useImperativeHandle, useRef,
|
||||
} from 'react';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
@ -11,27 +9,15 @@ import LabelColors from '../../constants/LabelColors';
|
|||
|
||||
import styles from './Editor.module.css';
|
||||
|
||||
const Editor = React.forwardRef(({ data, onFieldChange }, ref) => {
|
||||
const Editor = React.memo(({ data, onFieldChange }) => {
|
||||
const [t] = useTranslation();
|
||||
|
||||
const nameField = useRef(null);
|
||||
|
||||
const selectNameField = useCallback(() => {
|
||||
useEffect(() => {
|
||||
nameField.current.select();
|
||||
}, []);
|
||||
|
||||
useImperativeHandle(
|
||||
ref,
|
||||
() => ({
|
||||
selectNameField,
|
||||
}),
|
||||
[selectNameField],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
selectNameField();
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.text}>{t('common.title')}</div>
|
||||
|
@ -71,4 +57,4 @@ Editor.propTypes = {
|
|||
onFieldChange: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default React.memo(Editor);
|
||||
export default Editor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue