You've already forked focalboard
							
							
				mirror of
				https://github.com/mattermost/focalboard.git
				synced 2025-10-31 00:17:42 +02:00 
			
		
		
		
	Add selected cards duplication with CTRL+D
This commit is contained in:
		| @@ -21,6 +21,7 @@ This changelog summarizes updates to our open source project. You can also find | ||||
|   * Add docker-compose to run the whole service in containers. [#105](https://github.com/mattermost/focalboard/pull/105) Thanks @jbutler992! | ||||
|   * Added Gallery view. | ||||
|   * Added Checkbox content type. | ||||
|   * Added Selected cards duplication with CTRL+D. | ||||
| * Requested Contributions | ||||
|   * Add more frontend unit test coverage. [#126](https://github.com/mattermost/focalboard/pull/126) Thanks @renjithgr! | ||||
|   * [GH-40](https://github.com/mattermost/focalboard/issues/40) - Add property type email [#84](https://github.com/mattermost/focalboard/pull/84). Thanks @renjithgr! | ||||
|   | ||||
| @@ -55,6 +55,13 @@ class CenterPanel extends React.Component<Props, State> { | ||||
|             this.deleteSelectedCards() | ||||
|             e.stopPropagation() | ||||
|         } | ||||
|  | ||||
|         if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.keyCode === 68 && this.state.selectedCardIds.length > 0) { | ||||
|             // CTRL+D: Duplicate selected cards | ||||
|             this.duplicateSelectedCards() | ||||
|             e.stopPropagation() | ||||
|             e.preventDefault() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     componentDidMount(): void { | ||||
| @@ -309,6 +316,26 @@ class CenterPanel extends React.Component<Props, State> { | ||||
|  | ||||
|         this.setState({selectedCardIds: []}) | ||||
|     } | ||||
|  | ||||
|     private async duplicateSelectedCards() { | ||||
|         const {selectedCardIds} = this.state | ||||
|         if (selectedCardIds.length < 1) { | ||||
|             return | ||||
|         } | ||||
|  | ||||
|         mutator.performAsUndoGroup(async () => { | ||||
|             for (const cardId of selectedCardIds) { | ||||
|                 const card = this.props.boardTree.allCards.find((o) => o.id === cardId) | ||||
|                 if (card) { | ||||
|                     mutator.duplicateCard(cardId) | ||||
|                 } else { | ||||
|                     Utils.assertFailure(`Selected card not found: ${cardId}`) | ||||
|                 } | ||||
|             } | ||||
|         }) | ||||
|  | ||||
|         this.setState({selectedCardIds: []}) | ||||
|     } | ||||
| } | ||||
|  | ||||
| export default injectIntl(CenterPanel) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user