fix(options): custom color picker group — equal-height parts, no third "effective" swatch
Row 143: the input group of a color-chooser's custom picker (shown when "Other ..." is chosen) had three parts and two problems: 1. The text input was lower than the swatch part (.input-group-text holding input[type=color], whose default height exceeds the form-control line box). Fixed in the inline <style> of options.twig: the color input is set to the same line box as .form-control (height: 1.5em), so swatch part and text input are both calc(1.5em + 0.75rem + 2px) tall. 2. The third part — the appended "effective color" swatch (.color-mode-effective) — is removed entirely (options.js refreshEffective / effectiveColor deleted, CSS rule deleted). The group is now just swatch + text input. OPTIONS_JS_TOKEN -> 20261126.18. Verified: render tc=663 (no color-mode-effective in the page, options.js?v=20261126.18), jsdom 7/7 incl. new pins (no third part in the DOM at load or after mode changes; equal-height rule present; stale rule gone), export exit 0. Variants not rebuilt (deferred). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
cd62f2f752
commit
02e9babe7c
2 changed files with 17 additions and 28 deletions
|
|
@ -771,19 +771,12 @@ var ThemeOptions = function () {
|
|||
|| sel.find('option').not('[value="inherit"]').first().attr('value')
|
||||
|| '');
|
||||
var customInput = globalForm.find('input[name="' + key + 'custom"]');
|
||||
var rowLabel = String(sel.closest('.mb-3').find('.form-label').first().text() || key);
|
||||
var currentColor = function (ckey) {
|
||||
var f = globalForm.find('#simple_edit_options_' + ckey);
|
||||
var v = f.val();
|
||||
if (!v) { v = f.data('inheritvalue'); }
|
||||
return v ? String(v) : '';
|
||||
};
|
||||
var effectiveColor = function () {
|
||||
var mode = String(sel.val());
|
||||
if (mode === 'other') { return customInput.length && customInput.val() ? String(customInput.val()) : ''; }
|
||||
var pk = presets[mode];
|
||||
return pk ? currentColor(pk) : '';
|
||||
};
|
||||
var refreshLabels = function () {
|
||||
sel.find('option').each(function () {
|
||||
var op = $(this);
|
||||
|
|
@ -847,19 +840,10 @@ var ThemeOptions = function () {
|
|||
.toggleClass('is-default', defaultMode !== '' && mode === defaultMode);
|
||||
});
|
||||
};
|
||||
var refreshEffective = function () {
|
||||
var group = customInput.closest('.input-group');
|
||||
if (!group.length) { return; }
|
||||
var sw = group.find('.color-mode-effective');
|
||||
if (!sw.length) {
|
||||
sw = $('<span class="color-mode-effective"></span>');
|
||||
group.append($('<div class="input-group-text"></div>').append(sw));
|
||||
}
|
||||
var c = effectiveColor();
|
||||
sw.css('background', c || 'transparent');
|
||||
sw.attr('title', c ? 'Effective color (' + rowLabel + '): ' + c : 'Effective color (' + rowLabel + '): (none)');
|
||||
};
|
||||
var refreshAll = function () { refreshLabels(); refreshChips(); refreshEffective(); };
|
||||
// row 143: NO third part in the input group any more — the "effective color"
|
||||
// swatch (.color-mode-effective) is removed; the group is just the swatch
|
||||
// part + the text input, both the same height (CSS in options.twig)
|
||||
var refreshAll = function () { refreshLabels(); refreshChips(); };
|
||||
colorModeRefreshers.push(refreshAll);
|
||||
// legacy migration: stored hex (pre-dropdown value) -> mode "other" + hex into the custom field
|
||||
var stored = legacyColorValues[key];
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control).
|
||||
Re-register it with a version token: bump OPTIONS_JS_TOKEN below whenever
|
||||
options/options.js changes, so every browser fetches the new file once. #}
|
||||
{% set OPTIONS_JS_TOKEN = '20261126.17' %}
|
||||
{% set OPTIONS_JS_TOKEN = '20261126.18' %}
|
||||
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
|
||||
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
|
||||
|
||||
|
|
@ -176,14 +176,19 @@
|
|||
.tab-content h2:not(.modal-title) {
|
||||
font-size: 24px;
|
||||
}
|
||||
.color-mode-effective {
|
||||
display: inline-block;
|
||||
width: 1.1rem;
|
||||
height: 1.1rem;
|
||||
border: 1px solid rgba(0, 0, 0, 0.35);
|
||||
border-radius: 0.25rem;
|
||||
vertical-align: middle;
|
||||
/* row 143: in the color picker input group the swatch part (.input-group-text
|
||||
holding input[type=color]) must be exactly as high as the text input — set
|
||||
the color input to the same line box (1.5em) as .form-control, so both parts
|
||||
end up calc(1.5em + 0.75rem + 2px) tall. (The third part of the group, the
|
||||
appended effective-color swatch, was removed — see options.js.) */
|
||||
.input-group > .style__colorpicker input[type="color"] {
|
||||
display: block;
|
||||
width: 2.5em;
|
||||
height: 1.5em;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue