Highlight selected template

This commit is contained in:
Balakrishnan Balasubramanian 2023-09-14 14:57:33 -04:00
parent 61a8d4ca5c
commit ab636df83d
2 changed files with 6 additions and 0 deletions

View File

@ -48,6 +48,10 @@
height: 100px; height: 100px;
} }
.template-selected {
background-color: green;
}
.template div { .template div {
border: 1px solid; border: 1px solid;
} }

View File

@ -204,8 +204,10 @@ function pageSizeChange() {
* @param {HTMLDivElement} templateDiv * @param {HTMLDivElement} templateDiv
*/ */
function applyTemplate(templateDiv) { function applyTemplate(templateDiv) {
document.getElementsByClassName("template-selected").item(0)?.classList.remove("template-selected")
/** @type {HTMLDivElement} */ /** @type {HTMLDivElement} */
const templateClone = templateDiv.cloneNode(true) const templateClone = templateDiv.cloneNode(true)
templateDiv.classList.add("template-selected")
for (const index in imageUrls) { for (const index in imageUrls) {
const url = imageUrls[index] const url = imageUrls[index]
const imgClass = `img${index}` const imgClass = `img${index}`