mirror of
https://github.com/michivonah/click-guide.git
synced 2025-12-22 22:16:28 +01:00
add delete step button
This commit is contained in:
parent
1b6c6c0f91
commit
85bc8eaf43
3 changed files with 42 additions and 1 deletions
|
|
@ -116,6 +116,7 @@ function createStepElement(label, description, imgSrc, triggerAction, triggerEle
|
|||
|
||||
// create container for text & image
|
||||
const textContainer = document.createElement("div");
|
||||
const stepControls = document.createElement("div");
|
||||
const imgContainer = document.createElement("div");
|
||||
|
||||
// create title
|
||||
|
|
@ -135,6 +136,23 @@ function createStepElement(label, description, imgSrc, triggerAction, triggerEle
|
|||
image.src = imgSrc;
|
||||
imgContainer.appendChild(image);
|
||||
|
||||
// create stepcontrol + delete button
|
||||
const delBtn = document.createElement("button");
|
||||
const delBtnIcon = document.createElement("span");
|
||||
delBtn.textContent = "Delete step";
|
||||
delBtnIcon.className = "material-symbols-outlined";
|
||||
delBtnIcon.textContent = "delete";
|
||||
delBtn.appendChild(delBtnIcon);
|
||||
|
||||
delBtn.addEventListener('click', function(){
|
||||
// remove step
|
||||
event.target.parentNode.parentNode.parentNode.remove();
|
||||
});
|
||||
|
||||
stepControls.classList = "stepControls editor";
|
||||
stepControls.appendChild(delBtn);
|
||||
textContainer.appendChild(stepControls);
|
||||
|
||||
// append to main container
|
||||
container.appendChild(textContainer);
|
||||
container.appendChild(imgContainer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue