Skip to content

Conversation

Swapnilpatil03
Copy link

Summary

This PR implements the feature to allow users to paste a diagram selection into a newly created tab using CTRL/CMD+SHIFT+V.

Changes

  • Detects the shortcut CTRL/CMD+SHIFT+V
  • Automatically creates a new tab
  • Pastes the previously copied diagram selection into that tab

Issue Reference

Closes #277

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2025

CLA assistant check
All committers have signed the CLA.

@Swapnilpatil03
Copy link
Author

Swapnilpatil03 commented Jul 18, 2025

Hi @nikku and @barmac 👋,

I've opened a pull request implementing the feature to create a new diagram tab and paste the clipboard selection using CTRL/CMD+SHIFT+V.

🔗 PR: #5164
Closes: #277

Please take a look whenever you get a chance. Let me know if any adjustments are needed — happy to make updates!

Thanks again for the opportunity 🙌

@barmac
Copy link
Collaborator

barmac commented Jul 21, 2025

Hi @Swapnilpatil03,

Thanks for your contribution. Please make sure that the email address on your commits and the one with which you signed the CLA match. Otherwise, we cannot merge your PR: #5164 (comment)

@Swapnilpatil03
Copy link
Author

Hi @barmac 👋,
I have accepted and signed the CLA. Please let me know if anything else is needed from my side. Looking forward to your review. Thanks!

@barmac
Copy link
Collaborator

barmac commented Jul 21, 2025

Thanks, it looks OK now. I will review the PR this week.

@barmac barmac self-requested a review July 21, 2025 09:54
@Swapnilpatil03
Copy link
Author

Thanks, @barmac 😊
Glad to hear that. I’ll look forward to your review — feel free to reach out if you need any changes or clarifications from my side.

Comment on lines +2330 to +2336
detectDiagramType(xml) {
if (/bpmn:definitions|<definitions[\s>]/.test(xml)) return 'bpmn';
if (/dmn:definitions|<dmn:definitions[\s>]/.test(xml)) return 'dmn';
if (/cmmn:definitions|<cmmn:definitions[\s>]/.test(xml)) return 'cmmn';
if (/form:form|<form[\s>]/.test(xml)) return 'form';
return null;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make it impossible to create cloud-* (C8) diagrams via Ctrl+Shift+V. We also don't want to determine the file type on our own, but rather rely on the tabs provider. Perhaps we can re-use the existing pattern from the dropzone:

handleDrop = async (filePaths = []) => {

this.displayNotification({
type: 'error',
title: 'Paste into New Tab',
content: 'Clipboard does not contain diagram XML.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though the tabs use xml property for the contents (historical reasons), some of the supported file formats are not XML.

Copy link
Collaborator

@barmac barmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Let's use the tabs provider to try to create files.
  2. Remove XML-related logic.

@barmac barmac marked this pull request as draft September 4, 2025 07:51
@barmac
Copy link
Collaborator

barmac commented Sep 4, 2025

I'm converting this to draft. Feel free to comment once you implement the requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paste diagram clipboard contents into new tab
3 participants