Skip to content
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

Code Snippet drag and drop feature #1043

Merged
merged 15 commits into from
Nov 14, 2020

Conversation

karlaspuldaro
Copy link
Member

@karlaspuldaro karlaspuldaro commented Nov 6, 2020

Drag and drop code snippet from display list into notebooks and file editors

Fixes #532

Adapted from https://github.com/jupytercalpoly/jupyterlab-code-snippets/
drag-and-drop

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
@karlaspuldaro karlaspuldaro added the status:Work in Progress Development in progress. A PR tagged with this label is not review ready unless stated otherwise. label Nov 6, 2020
@elyra-bot
Copy link

elyra-bot bot commented Nov 6, 2020

Thanks for making a pull request to Elyra!

To try out this branch on binder, follow this link: Binder

marthacryan and others added 5 commits November 9, 2020 13:54

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Add the ability to search/filter by tags to the metadata explorer.

Co-authored-by: Alex Bozarth <ajbozart@us.ibm.com>
Co-authored-by: Ai-Vy Dang <aivyndang@gmail.com>
Co-authored-by: Jay Ahn <aju960219@gmail.com>
Co-authored-by: Karla Spuldaro <karla.spuldaro@ibm.com>
Co-authored-by: Kiran Pinnipati <kpinnipati@gmail.com>
@marthacryan
Copy link
Member

Just tried out the current progress and it looks like it's working great! Just a thought after testing - I think maybe it'd be nice to have the blue bar that appears between cells appear below the last cell as well (see below)
Screen Shot 2020-11-10 at 11 55 05 AM

@karlaspuldaro karlaspuldaro changed the title [WIP] Code Snippet drag and drop feature Code Snippet drag and drop feature Nov 10, 2020
@karlaspuldaro karlaspuldaro requested review from ajbozarth, marthacryan and lresende and removed request for ajbozarth November 10, 2020 18:26
@karlaspuldaro karlaspuldaro removed the status:Work in Progress Development in progress. A PR tagged with this label is not review ready unless stated otherwise. label Nov 10, 2020
@karlaspuldaro
Copy link
Member Author

@marthacryan I think that is a default notebook cell behaviour on a drag move event. When you select any cell and start shifting its position, the blue bar is only displayed if you intend to move it to the top or between cells. I will do some more investigation to check if that can be overridden on our side.

@marthacryan
Copy link
Member

Another thought - could markdown snippets automatically be added to notebooks as "markdown cells" rather than "code cells"?

@marthacryan
Copy link
Member

Also - (this can definitely be in another PR because I think it's not a blocker) maybe it'd be nice to be able to drop snippets into an existing cell if you're hovering over that cell - and it could drop the text wherever your cursor is. (And you could still add them as cells if you're hovering between cells)

@lresende lresende added this to the 1.4.1 milestone Nov 11, 2020
@karlaspuldaro
Copy link
Member Author

Thanks @marthacryan for your feedback, just documenting what was discussed today based on your suggestions above,
1- Let's create an enhancement issue in lab regarding indicating the notebook blue horizontal bar when dragging a cell over the last position
2- For now we can still use the insert button to add a code snippet to an existing notebook cell. We can create a separate issue to further investigate and enhance the drag and drop option.

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Looking at the drag&drop handling code it feels like it's doing a lot more than it should need to (I might just not have enough experience with event handlers though), but since it works I'm ok with it as is. I included a couple comments below as well.

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

I'm going to approve this for now and open a new issue for the drag drop selection bug in safari since it affects both this and pipeline as well and it's only an annoyance and only on safari

@ajbozarth
Copy link
Member

Opened issue: #1074

@lresende lresende merged commit b984587 into elyra-ai:master Nov 14, 2020
@karlaspuldaro karlaspuldaro deleted the kspuldaro-drag-and-drop branch January 26, 2021 16:44
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.

Code snippet drag and drop
4 participants