You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-15 23:54:29 +02:00
Don't allow empty option names
This commit is contained in:
@ -309,6 +309,8 @@ class BoardComponent extends React.Component<Props, State> {
|
|||||||
<Editable
|
<Editable
|
||||||
className={`octo-label ${group.option.color}`}
|
className={`octo-label ${group.option.color}`}
|
||||||
text={group.option.value}
|
text={group.option.value}
|
||||||
|
placeholderText='New Select'
|
||||||
|
allowEmpty={false}
|
||||||
onChanged={(text) => {
|
onChanged={(text) => {
|
||||||
this.propertyNameChanged(group.option, text)
|
this.propertyNameChanged(group.option, text)
|
||||||
}}
|
}}
|
||||||
|
@ -12,6 +12,7 @@ type Props = {
|
|||||||
style?: React.CSSProperties
|
style?: React.CSSProperties
|
||||||
isMarkdown: boolean
|
isMarkdown: boolean
|
||||||
isMultiline: boolean
|
isMultiline: boolean
|
||||||
|
allowEmpty: boolean
|
||||||
|
|
||||||
onFocus?: () => void
|
onFocus?: () => void
|
||||||
onBlur?: () => void
|
onBlur?: () => void
|
||||||
@ -26,6 +27,7 @@ class Editable extends React.Component<Props, State> {
|
|||||||
text: '',
|
text: '',
|
||||||
isMarkdown: false,
|
isMarkdown: false,
|
||||||
isMultiline: false,
|
isMultiline: false,
|
||||||
|
allowEmpty: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
private _text = ''
|
private _text = ''
|
||||||
@ -103,11 +105,15 @@ class Editable extends React.Component<Props, State> {
|
|||||||
onBlur={async () => {
|
onBlur={async () => {
|
||||||
const newText = this.elementRef.current.innerText
|
const newText = this.elementRef.current.innerText
|
||||||
const oldText = this.props.text || ''
|
const oldText = this.props.text || ''
|
||||||
if (newText !== oldText && onChanged) {
|
if (this.props.allowEmpty || newText) {
|
||||||
onChanged(newText)
|
if (newText !== oldText && onChanged) {
|
||||||
}
|
onChanged(newText)
|
||||||
|
}
|
||||||
|
|
||||||
this.text = newText
|
this.text = newText
|
||||||
|
} else {
|
||||||
|
this.text = oldText // Reset text
|
||||||
|
}
|
||||||
|
|
||||||
this.elementRef.current.classList.remove('active')
|
this.elementRef.current.classList.remove('active')
|
||||||
if (onBlur) {
|
if (onBlur) {
|
||||||
|
Reference in New Issue
Block a user