fix(options): mark the default color choice with [ ] in the dropdown, not bold
Row 134: bolding <option> text is not rendered by every browser (native dropdown popups ignore it), so the default entry of a color-chooser dropdown is now enclosed in square brackets instead — e.g. "[Default font color] [#444444]". The brackets live in config.xml on the <option data-default="1"> (navbarfontcolor + the five <el>textcolor dropdowns), so they show even before JS runs; options.js strips and re-adds them idempotently while appending the live hexcode. Removed from the dropdown list: the <b> wrap (row 129), the inline font-weight (row 132), the CSS option[data-default] rule and the :has() closed-select rule. The bold REMAINS only on the swatch label below the swatch (.color-chip-label.is-default), where it renders reliably. OPTIONS_JS_TOKEN -> 20261126.13. Verified: render tc=618 (raw option "[Default font color]", served options.js?v=20261126.13), jsdom 6/6 incl. pins (label "[Default font color] [#444444]", no <b>/inline bold/stale CSS rules, non-default not bracketed, swatch label still bold), 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
1b6ae85f83
commit
57c7009ec2
1 changed files with 35 additions and 46 deletions
|
|
@ -754,12 +754,12 @@ var ThemeOptions = function () {
|
|||
// "Default background color" is the SECOND choice, right after "Same as
|
||||
// default font color".
|
||||
var presets = { 'default': 'fontcolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' };
|
||||
// row 126/132: the option's DEFAULT choice — the config.xml <option data-default="1">
|
||||
// (same value as the <default> element text). Shown bold via every mechanism
|
||||
// available, because browsers differ: CSS on the option + a real <b> + inline
|
||||
// style (row 132) for the popup, :has() rule for the CLOSED select box, and the
|
||||
// is-default class on the swatch label. Fallback when the marker is missing:
|
||||
// the inherited value, else the first non-"inherit" entry.
|
||||
// row 126/134: the option's DEFAULT choice — the config.xml <option data-default="1">
|
||||
// (same value as the <default> element text). In the dropdown LIST it is
|
||||
// enclosed in [ ] (bolding <option> is not rendered by every browser — row 134);
|
||||
// the swatch label below the swatch stays bold via the is-default class.
|
||||
// Fallback when the marker is missing: the inherited value, else the first
|
||||
// non-"inherit" entry.
|
||||
var defaultMode = String(sel.find('option[data-default="1"]').first().attr('value')
|
||||
|| sel.data('inheritvalue')
|
||||
|| sel.find('option').not('[value="inherit"]').first().attr('value')
|
||||
|
|
@ -781,30 +781,24 @@ var ThemeOptions = function () {
|
|||
sel.find('option').each(function () {
|
||||
var op = $(this);
|
||||
var mode = String(op.attr('value'));
|
||||
if (op.attr('data-default')) {
|
||||
// row 132: inline style as well — some browsers only honour the
|
||||
// inline style on <option>, not the stylesheet rule
|
||||
op.css('font-weight', '700');
|
||||
if (!op.data('base-label')) {
|
||||
// strip the [ ] default marker from config.xml so re-wrapping stays idempotent
|
||||
op.data('base-label', op.text().replace(/^\s*\[(.*)\]\s*$/, '$1'));
|
||||
}
|
||||
if (!op.data('base-label')) { op.data('base-label', op.text()); }
|
||||
var base = String(op.data('base-label'));
|
||||
var pk = presets[mode];
|
||||
// row 131: every entry shows its chosen hexcode — the preset colors
|
||||
// from their option fields, "Other ..." from the custom picker's value
|
||||
var c = pk ? currentColor(pk)
|
||||
: (mode === 'other' && customInput.length && /^#[0-9a-fA-F]{3,8}$/.test(String(customInput.val() || '')) ? String(customInput.val()) : '');
|
||||
// row 134: the DEFAULT choice is enclosed in [ ] in the dropdown list —
|
||||
// bolding <option> text is not rendered by every browser, so brackets
|
||||
// are the marker in the list (the swatch label below the swatch stays bold)
|
||||
var name = op.attr('data-default') ? '[' + base + ']' : base;
|
||||
if (pk || mode === 'other') {
|
||||
var label = c ? base + ' [' + c + ']' : base;
|
||||
if (op.attr('data-default')) {
|
||||
// row 129: the DEFAULT choice is bold — via a real <b> element
|
||||
// (not every browser applies font-weight CSS to <option>),
|
||||
// on top of the select option[data-default="1"] CSS rule
|
||||
op.empty().append($('<b>').text(label));
|
||||
} else {
|
||||
op.text(label);
|
||||
}
|
||||
op.text(c ? name + ' [' + c + ']' : name);
|
||||
} else if (op.attr('data-default')) {
|
||||
op.empty().append($('<b>').text(base));
|
||||
op.text(name);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue