Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/task-lists-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,25 @@ export default class TaskListsElement extends HTMLElement {
}

const handleTemplate = document.createElement('template')
const span = handleTemplate.content.appendChild(document.createElement('span'))
const span = document.createElement('span')
span.classList.add('handle')
const svg = span.appendChild(document.createElement('svg'))

const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
svg.classList.add('drag-handle')
svg.setAttribute('aria-hidden', 'true')
svg.setAttribute('width', '16')
svg.setAttribute('height', '16')
const path = svg.appendChild(document.createElement('path'))

const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')
path.setAttribute(
'd',
'M10 13a1 1 0 100-2 1 1 0 000 2zm-4 0a1 1 0 100-2 1 1 0 000 2zm1-5a1 1 0 11-2 0 1 1 0 012 0zm3 1a1 1 0 100-2 1 1 0 000 2zm1-5a1 1 0 11-2 0 1 1 0 012 0zM6 5a1 1 0 100-2 1 1 0 000 2z'
)

handleTemplate.content.appendChild(span)
span.appendChild(svg)
svg.appendChild(path)

const initialized = new WeakMap()

// Only top-level lists are draggable, and nested lists drag with their parent item.
Expand Down