mirror of
https://github.com/mattermost/focalboard.git
synced 2024-11-27 08:31:20 +02:00
Some small fixes
This commit is contained in:
parent
8174a147de
commit
b52577d7fe
@ -24,7 +24,6 @@ type State = {
|
||||
}
|
||||
|
||||
export default class PropertyValueElement extends React.Component<Props, State> {
|
||||
private valueEditor = React.createRef<Editable>()
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props)
|
||||
@ -89,7 +88,6 @@ export default class PropertyValueElement extends React.Component<Props, State>
|
||||
if (!readOnly) {
|
||||
return (
|
||||
<Editable
|
||||
ref={this.valueEditor}
|
||||
className='octo-propertyvalue'
|
||||
placeholderText='Empty'
|
||||
value={this.state.value}
|
||||
|
@ -174,13 +174,12 @@ class TableComponent extends React.Component<Props, State> {
|
||||
boardTree={boardTree}
|
||||
card={card}
|
||||
focusOnMount={focusOnMount}
|
||||
onKeyDown={(e) => {
|
||||
if (e.keyCode === 13) {
|
||||
// Enter: Insert new card if on last row
|
||||
if (cards.length > 0 && cards[cards.length - 1] === card) {
|
||||
this.addCard(false)
|
||||
}
|
||||
onSaveWithEnter={() => {
|
||||
console.log("WORKING")
|
||||
if (cards.length > 0 && cards[cards.length - 1] === card) {
|
||||
this.addCard(false)
|
||||
}
|
||||
console.log("STILL WORKING")
|
||||
}}
|
||||
/>)
|
||||
|
||||
|
@ -16,12 +16,12 @@ type Props = {
|
||||
boardTree: BoardTree
|
||||
card: Card
|
||||
focusOnMount: boolean
|
||||
onKeyDown: (e: React.KeyboardEvent) => void
|
||||
onSaveWithEnter: () => void
|
||||
}
|
||||
|
||||
type State = {
|
||||
showCard: boolean
|
||||
title: string
|
||||
title: string
|
||||
}
|
||||
|
||||
class TableRow extends React.Component<Props, State> {
|
||||
@ -40,12 +40,12 @@ class TableRow extends React.Component<Props, State> {
|
||||
|
||||
componentDidMount(): void {
|
||||
if (this.props.focusOnMount) {
|
||||
this.titleRef.current.focus()
|
||||
setTimeout(() => this.titleRef.current.focus(), 10)
|
||||
}
|
||||
}
|
||||
|
||||
render(): JSX.Element {
|
||||
const {boardTree, card, onKeyDown} = this.props
|
||||
const {boardTree, card, onSaveWithEnter} = this.props
|
||||
const {board, activeView} = boardTree
|
||||
|
||||
const openButonRef = React.createRef<HTMLDivElement>()
|
||||
@ -75,7 +75,12 @@ class TableRow extends React.Component<Props, State> {
|
||||
value={this.state.title}
|
||||
placeholderText='Untitled'
|
||||
onChange={(title: string) => this.setState({title})}
|
||||
onSave={() => mutator.changeTitle(card, this.state.title)}
|
||||
onSave={(saveType) => {
|
||||
mutator.changeTitle(card, this.state.title)
|
||||
if (saveType === 'onEnter') {
|
||||
onSaveWithEnter()
|
||||
}
|
||||
}}
|
||||
onCancel={() => this.setState({title: card.title})}
|
||||
/>
|
||||
</div>
|
||||
|
@ -65,7 +65,7 @@ class ViewHeader extends React.Component<Props, State> {
|
||||
private onSearchKeyDown = (e: React.KeyboardEvent) => {
|
||||
if (e.keyCode === 27) { // ESC: Clear search
|
||||
this.searchFieldRef.current.text = ''
|
||||
this.setState({...this.state, isSearching: false})
|
||||
this.setState({isSearching: false})
|
||||
this.props.setSearchText(undefined)
|
||||
e.preventDefault()
|
||||
}
|
||||
@ -280,7 +280,7 @@ class ViewHeader extends React.Component<Props, State> {
|
||||
<div
|
||||
className='octo-button'
|
||||
onClick={() => {
|
||||
this.setState({...this.state, isSearching: true})
|
||||
this.setState({isSearching: true})
|
||||
}}
|
||||
>
|
||||
<FormattedMessage
|
||||
|
@ -168,7 +168,6 @@ export default class BoardPage extends React.Component<Props, State> {
|
||||
|
||||
// TODO: Handle error (viewId not found)
|
||||
this.setState({
|
||||
...this.state,
|
||||
boardTree,
|
||||
boardId,
|
||||
viewId: boardTree.activeView.id,
|
||||
|
@ -11,7 +11,7 @@ type Props = {
|
||||
className?: string
|
||||
|
||||
onCancel?: () => void
|
||||
onSave?: () => void
|
||||
onSave?: (saveType: 'onEnter'|'onBlur') => void
|
||||
}
|
||||
|
||||
export default class Editable extends React.Component<Props> {
|
||||
@ -48,7 +48,7 @@ export default class Editable extends React.Component<Props> {
|
||||
onChange(e.target.value)
|
||||
}}
|
||||
value={value}
|
||||
onBlur={() => this.saveOnBlur && this.props.onSave && this.props.onSave()}
|
||||
onBlur={() => this.saveOnBlur && this.props.onSave && this.props.onSave('onBlur')}
|
||||
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>): void => {
|
||||
if (e.keyCode === 27 && !(e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey) { // ESC
|
||||
e.stopPropagation()
|
||||
@ -59,7 +59,7 @@ export default class Editable extends React.Component<Props> {
|
||||
} else if (e.keyCode === 13 && !(e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey) { // Return
|
||||
e.stopPropagation()
|
||||
if (this.props.onSave) {
|
||||
this.props.onSave()
|
||||
this.props.onSave('onEnter')
|
||||
}
|
||||
this.blur()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user