-
-
Notifications
You must be signed in to change notification settings - Fork 33
feat(user): implement drag and drop #83
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,20 @@ | |
|
|
||
| <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | ||
|
|
||
| <style> | ||
| .list-group-item.dragging { | ||
| opacity: 0.5; | ||
| background: var(--bs-dark); | ||
| } | ||
| .list-group-item { | ||
| transition: background-color 0.2s ease; | ||
| } | ||
| .drag-handle { | ||
| user-select: none; | ||
| color: var(--bs-secondary); | ||
| } | ||
| </style> | ||
|
|
||
| <title>PiOSK</title> | ||
| </head> | ||
| <body> | ||
|
|
@@ -33,7 +47,8 @@ <h1 class="my-1">Pi<span class="bg-danger mx-1 px-1 rounded">OSK</span></h1> | |
| </footer> | ||
|
|
||
| <template id="template-url"> | ||
| <li class="list-group-item text-truncate fs-3"> | ||
| <li class="list-group-item text-truncate fs-3" draggable="true"> | ||
| <span class="drag-handle mx-2" style="cursor: move;">⋮⋮</span> | ||
| <button type="button" class="btn btn-close mx-3" aria-label="Remove"></button> | ||
| <a class="link-underline-dark"></a> | ||
| </li> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,6 +22,38 @@ let piosk = { | |||||||||||||
| tmpErr.html(xhr.responseText) | ||||||||||||||
| $('#urls').append(tmpErr) | ||||||||||||||
| setTimeout(_ => { $('.alert-danger').remove() }, 5000) | ||||||||||||||
| }, | ||||||||||||||
| initDragAndDrop() { | ||||||||||||||
| const list = document.querySelector('#urls .list-group'); | ||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| if (!list) { | |
| console.warn("Element '#urls .list-group' not found. Drag-and-drop functionality will not be initialized."); | |
| return; | |
| } |
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.
Ignore this.
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.
Consider adding ARIA attributes (e.g., aria-grabbed) to this draggable element to improve accessibility for keyboard and assistive technology users.
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.
Optional, if you want to add.