| 1367 | const id = $(tagElement).attr('id'); | 1367 | const id = $(tagElement).attr('id'); |
| 1368 | const tag = tags.find(x => x.id === id); | 1368 | const tag = tags.find(x => x.id === id); |
| 1369 | | 1369 | |
| 1370 | // Fix the defined colors, because if there is no color set, they seem to get automatically set to black | | |
| 1371 | // based on the color picker after drag&drop, even if there was no color chosen. We just set them back. | | |
| 1372 | const color = $(tagElement).find('.tagColorPickerHolder .tag-color').attr('color'); | | |
| 1373 | const color2 = $(tagElement).find('.tagColorPicker2Holder .tag-color2').attr('color'); | | |
| 1374 | if (color === '' || color === undefined) { | | |
| 1375 | tag.color = ''; | | |
| 1376 | fixColor('background-color', tag.color); | | |
| 1377 | } | | |
| 1378 | if (color2 === '' || color2 === undefined) { | | |
| 1379 | tag.color2 = ''; | | |
| 1380 | fixColor('color', tag.color2); | | |
| 1381 | } | | |
| 1382 | | | |
| 1383 | // Update the sort order | 1370 | // Update the sort order |
| 1384 | tag.sort_order = i; | 1371 | tag.sort_order = i; |
| 1385 | | | |
| 1386 | function fixColor(property, color) { | | |
| 1387 | $(tagElement).find('.tag_view_name').css(property, color); | | |
| 1388 | $(`.tag[id="${id}"]`).css(property, color); | | |
| 1389 | $(`.bogus_folder_select[tagid="${id}"] .avatar`).css(property, color); | | |
| 1390 | } | | |
| 1391 | }); | 1372 | }); |
| 1392 | | 1373 | |
| 1393 | // If tags were dragged manually, we have to disable auto sorting | 1374 | // If tags were dragged manually, we have to disable auto sorting |