fix: mark per-subreddit mode dirty on color picker change
Without this, new subreddit entries would not persist their color overrides because _dirtyModes was never set when picking via the custom color picker. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
el.style.backgroundColor = val;
|
||||
}
|
||||
|
||||
function openPickerForSwatch(swatchEl) {
|
||||
function openPickerForSwatch(swatchEl, onBeforeChange) {
|
||||
if (!picker) {
|
||||
picker = window.RedditTweaks.colorPicker.create();
|
||||
}
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
picker.open(getColorValue(swatchEl), function (hex) {
|
||||
setColorValue(swatchEl, hex);
|
||||
if (onBeforeChange) onBeforeChange();
|
||||
saveFromControls();
|
||||
});
|
||||
}
|
||||
@@ -161,7 +162,9 @@
|
||||
|
||||
[bgSwatch, borderSwatch, textSwatch].forEach(function (swatch) {
|
||||
swatch.addEventListener("click", function () {
|
||||
openPickerForSwatch(swatch);
|
||||
openPickerForSwatch(swatch, function () {
|
||||
entry._dirtyModes[modeSelect.value] = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user