Merge pull request #2579 from SillyTavern/fix-tag-management Fix colors resetting on Tag Management dragging

7ccc98803c767cbec5d540b24b252c002c47c67a

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +6 -25Showing whitespace changes
public/css/tags.css+6 -6
@@ -209,20 +209,20 @@
209 opacity: 1;209 opacity: 1;
210}210}
211211
212.tag_as_folder {212.tag_as_folder.right_menu_button {
213 filter: brightness(75%) saturate(0.6);213 filter: brightness(75%) saturate(0.6);
214}214}
215215
216.tag_as_folder:hover,216.tag_as_folder.right_menu_button:hover,
217.tag_as_folder.flash {217.tag_as_folder.right_menu_button.flash {
218 filter: brightness(150%) saturate(0.6) !important;218 filter: brightness(150%) saturate(0.6);
219}219}
220220
221.tag_as_folder.no_folder {221.tag_as_folder.right_menu_button.no_folder {
222 filter: brightness(25%) saturate(0.25);222 filter: brightness(25%) saturate(0.25);
223}223}
224224
225.tag_as_folder .tag_folder_indicator {225.tag_as_folder.right_menu_button .tag_folder_indicator {
226 position: absolute;226 position: absolute;
227 top: calc(var(--mainFontSize) * -0.5);227 top: calc(var(--mainFontSize) * -0.5);
228 right: calc(var(--mainFontSize) * -0.5);228 right: calc(var(--mainFontSize) * -0.5);
public/scripts/tags.js+0 -19
@@ -1367,27 +1367,8 @@ function makeTagListDraggable(tagContainer) {
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);
13691369
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 order1370 // 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 });
13921373
1393 // If tags were dragged manually, we have to disable auto sorting1374 // If tags were dragged manually, we have to disable auto sorting