|
46 | 46 | var copyButton = document.createElement("button"); |
47 | 47 | copyButton.className = "imageGalleryNav-copyButton btn btn-secondary"; |
48 | 48 | copyButton.innerText = "Copy"; |
49 | | - copyButton.onclick = () => handleCopyClick(); |
| 49 | + copyButton.onclick = (event) => { |
| 50 | + event.preventDefault(); |
| 51 | + handleCopyClick(); |
| 52 | + } |
50 | 53 |
|
51 | 54 | var pasteButton = document.createElement("button"); |
52 | 55 | pasteButton.className = "imageGalleryNav-pasteButton btn btn-secondary"; |
53 | 56 | pasteButton.innerText = "Paste"; |
54 | | - pasteButton.onclick = () => handlePasteClick(objID, objType); |
| 57 | + pasteButton.onclick = (event) => { |
| 58 | + event.preventDefault(); |
| 59 | + handlePasteClick(objID, objType); |
| 60 | + } |
55 | 61 |
|
56 | 62 | if (document.querySelector("button.imageGalleryNav-pasteButton") == null) { |
57 | 63 | document.querySelector("label[for='tag_ids']").append(pasteButton); |
|
77 | 83 | var inputTagList = tagInput.split(",") // do de-duplication later |
78 | 84 |
|
79 | 85 | // Get tags from input box and also add to tag list. |
80 | | - const existingTagList = ("label[for='tag_ids'] + div .react-select__multi-value__label") |
| 86 | + const existingTagList = getAllInnerText("label[for='tag_ids'] + div .react-select__multi-value__label") |
81 | 87 |
|
82 | 88 | inputTagList = [...new Set([...inputTagList, ...existingTagList])].sort(); |
83 | 89 |
|
|
88 | 94 | // Search for tag ID for each tag. If exists, add to tag ID list. If not exists, create new tag and add to tag ID list. |
89 | 95 | for (const inputTag of inputTagList) { |
90 | 96 | const tagID = await getTagByName(inputTag.trim()); |
91 | | - if (tagID) { |
| 97 | + if (tagID && tagID.length) { |
92 | 98 | existingTags.push(inputTag); |
93 | 99 | tagUpdateList.push(tagID[0]); |
94 | 100 | } else { |
|
0 commit comments