-
Notifications
You must be signed in to change notification settings - Fork 508
Add support for pasting diagram selection into new tab using CTRL/CMD… #5164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
I've opened a pull request implementing the feature to create a new diagram tab and paste the clipboard selection using 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 🙌 |
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) |
Hi @barmac 👋, |
Thanks, it looks OK now. I will review the PR this week. |
Thanks, @barmac 😊 |
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; | ||
} |
There was a problem hiding this comment.
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:
camunda-modeler/client/src/app/App.js
Line 2040 in 0c608a6
handleDrop = async (filePaths = []) => { |
this.displayNotification({ | ||
type: 'error', | ||
title: 'Paste into New Tab', | ||
content: 'Clipboard does not contain diagram XML.' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Let's use the tabs provider to try to create files.
- Remove XML-related logic.
I'm converting this to draft. Feel free to comment once you implement the requested changes. |
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
CTRL/CMD+SHIFT+V
Issue Reference
Closes #277