Revert color to text input type

#1074 changed the input type for these fields to "color", but it turns
out the browser support for this input type sucks (they give you a very
limited color picker, and make it hard to input hex codes).
This commit is contained in:
Toby Zerner 2017-11-05 16:17:15 +10:30
parent 5343d6eff9
commit a6553954e2
2 changed files with 22 additions and 11 deletions

View File

@ -17536,11 +17536,13 @@ System.register('flarum/components/AdminNav', ['flarum/Component', 'flarum/compo
babelHelpers.createClass(AdminNav, [{
key: 'view',
value: function view() {
return m(SelectDropdown, {
className: 'AdminNav App-titleControl',
buttonClassName: 'Button',
children: this.items().toArray()
});
return m(
SelectDropdown,
{
className: 'AdminNav App-titleControl',
buttonClassName: 'Button' },
this.items().toArray()
);
}
}, {
key: 'items',
@ -17832,8 +17834,8 @@ System.register('flarum/components/AppearancePage', ['flarum/components/Page', '
m(
'div',
{ className: 'AppearancePage-colors-input' },
m('input', { className: 'FormControl', type: 'color', placeholder: '#aaaaaa', value: this.primaryColor(), onchange: m.withAttr('value', this.primaryColor) }),
m('input', { className: 'FormControl', type: 'color', placeholder: '#aaaaaa', value: this.secondaryColor(), onchange: m.withAttr('value', this.secondaryColor) })
m('input', { className: 'FormControl', type: 'text', placeholder: '#aaaaaa', value: this.primaryColor(), onchange: m.withAttr('value', this.primaryColor) }),
m('input', { className: 'FormControl', type: 'text', placeholder: '#aaaaaa', value: this.secondaryColor(), onchange: m.withAttr('value', this.secondaryColor) })
),
Switch.component({
state: this.darkMode(),
@ -18509,6 +18511,10 @@ System.register('flarum/components/Dropdown', ['flarum/Component', 'flarum/helpe
$menu.toggleClass('Dropdown-menu--top', $menu.offset().top + $menu.height() > $(window).scrollTop() + $(window).height());
if ($menu.offset().top < 0) {
$menu.removeClass('Dropdown-menu--top');
}
$menu.toggleClass('Dropdown-menu--right', isRight || $menu.offset().left + $menu.width() > $(window).scrollLeft() + $(window).width());
});
@ -23313,7 +23319,7 @@ System.register('flarum/utils/extractText', [], function (_export, _context) {
return vdom.map(function (element) {
return extractText(element);
}).join('');
} else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object') {
} else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object' && vdom !== null) {
return extractText(vdom.children);
} else {
return vdom;
@ -23599,7 +23605,12 @@ System.register('flarum/utils/patchMithril', ['../Component'], function (_export
}
if (comp.prototype && comp.prototype instanceof Component) {
return comp.component.apply(comp, args);
var children = args.slice(1);
if (children.length === 1 && Array.isArray(children[0])) {
children = children[0];
}
return comp.component(args[0], children);
}
var node = mo.apply(this, arguments);

View File

@ -28,8 +28,8 @@ export default class AppearancePage extends Page {
</div>
<div className="AppearancePage-colors-input">
<input className="FormControl" type="color" placeholder="#aaaaaa" value={this.primaryColor()} onchange={m.withAttr('value', this.primaryColor)}/>
<input className="FormControl" type="color" placeholder="#aaaaaa" value={this.secondaryColor()} onchange={m.withAttr('value', this.secondaryColor)}/>
<input className="FormControl" type="text" placeholder="#aaaaaa" value={this.primaryColor()} onchange={m.withAttr('value', this.primaryColor)}/>
<input className="FormControl" type="text" placeholder="#aaaaaa" value={this.secondaryColor()} onchange={m.withAttr('value', this.secondaryColor)}/>
</div>
{Switch.component({