Skip to content

Commit

Permalink
Add utilNoAuto to remove autocorrect/spellcheck features from inputs
Browse files Browse the repository at this point in the history
(closes #3839)
  • Loading branch information
bhousel committed Feb 14, 2017
1 parent 35da6aa commit 2314acf
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 52 deletions.
3 changes: 2 additions & 1 deletion modules/ui/entity_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { uiRawMembershipEditor } from './raw_membership_editor';
import { uiRawTagEditor } from './raw_tag_editor';
import { uiTagReference } from './tag_reference';
import { uiPreset } from './preset';
import { utilRebind } from '../util/rebind';
import { utilRebind } from '../util';


export function uiEntityEditor(context) {
var dispatch = d3.dispatch('choose'),
Expand Down
19 changes: 13 additions & 6 deletions modules/ui/feature_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { services } from '../services/index';
import {
utilDisplayName,
utilDisplayType,
utilEntityOrMemberSelector
utilEntityOrMemberSelector,
utilNoAuto
} from '../util/index';


Expand All @@ -19,28 +20,34 @@ export function uiFeatureList(context) {


function featureList(selection) {
var header = selection.append('div')
var header = selection
.append('div')
.attr('class', 'header fillL cf');

header.append('h3')
.text(t('inspector.feature_list'));

var searchWrap = selection.append('div')
var searchWrap = selection
.append('div')
.attr('class', 'search-header');

var search = searchWrap.append('input')
var search = searchWrap
.append('input')
.attr('placeholder', t('inspector.search'))
.attr('type', 'search')
.call(utilNoAuto)
.on('keypress', keypress)
.on('input', inputevent);

searchWrap
.call(svgIcon('#icon-search', 'pre-text'));

var listWrap = selection.append('div')
var listWrap = selection
.append('div')
.attr('class', 'inspector-body');

var list = listWrap.append('div')
var list = listWrap
.append('div')
.attr('class', 'feature-list cf');

context
Expand Down
8 changes: 6 additions & 2 deletions modules/ui/fields/access.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import * as d3 from 'd3';
import _ from 'lodash';
import { utilRebind } from '../../util/rebind';
import { utilGetSetValue } from '../../util/get_set_value';
import { d3combobox } from '../../lib/d3.combobox.js';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export function uiFieldAccess(field) {
Expand Down Expand Up @@ -48,6 +51,7 @@ export function uiFieldAccess(field) {
.attr('type', 'text')
.attr('class', 'preset-input-access')
.attr('id', function(d) { return 'preset-input-access-' + d; })
.call(utilNoAuto)
.each(function(d) {
d3.select(this)
.call(d3combobox()
Expand Down
8 changes: 6 additions & 2 deletions modules/ui/fields/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import {
} from '../../geo/index';

import { services } from '../../services/index';
import { utilRebind } from '../../util/rebind';
import { utilGetSetValue } from '../../util/get_set_value';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export function uiFieldAddress(field, context) {
Expand Down Expand Up @@ -155,6 +158,7 @@ export function uiFieldAddress(field, context) {
return field.t('placeholders.' + tkey);
})
.attr('class', function (d) { return 'addr-' + d.id; })
.call(utilNoAuto)
.style('width', function (d) { return d.width * 100 + '%'; });

// Update
Expand Down
9 changes: 7 additions & 2 deletions modules/ui/fields/combo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import _ from 'lodash';
import { t } from '../../util/locale';
import { d3combobox } from '../../lib/d3.combobox.js';
import { services } from '../../services/index';
import { utilRebind } from '../../util/rebind';
import { utilGetSetValue } from '../../util/get_set_value';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export {
uiFieldCombo as uiFieldTypeCombo,
Expand Down Expand Up @@ -247,6 +251,7 @@ export function uiFieldCombo(field, context) {
.append('input')
.attr('type', 'text')
.attr('id', 'preset-input-' + field.id)
.call(utilNoAuto)
.call(initCombo, selection)
.merge(input);

Expand Down
8 changes: 6 additions & 2 deletions modules/ui/fields/cycleway.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as d3 from 'd3';
import { d3combobox } from '../../lib/d3.combobox.js';
import { utilRebind } from '../../util/rebind';
import { utilGetSetValue } from '../../util/get_set_value';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export function uiFieldCycleway(field) {
Expand Down Expand Up @@ -52,6 +55,7 @@ export function uiFieldCycleway(field) {
.append('input')
.attr('type', 'text')
.attr('class', function(d) { return 'preset-input-cycleway preset-input-' + stripcolon(d); })
.call(utilNoAuto)
.each(function(d) {
d3.select(this).call(d3combobox().data(cycleway.options(d)));
});
Expand Down
9 changes: 7 additions & 2 deletions modules/ui/fields/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import * as d3 from 'd3';
import { t } from '../../util/locale';
import { dataPhoneFormats } from '../../../data/index';
import { services } from '../../services/index';
import { utilRebind } from '../../util/rebind';
import { utilGetSetValue } from '../../util/get_set_value';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export {
uiFieldText as uiFieldUrl,
Expand Down Expand Up @@ -31,6 +35,7 @@ export function uiFieldText(field, context) {
.attr('type', field.type)
.attr('id', fieldId)
.attr('placeholder', field.placeholder() || t('inspector.unknown'))
.call(utilNoAuto)
.merge(input);

input
Expand Down
10 changes: 7 additions & 3 deletions modules/ui/fields/localized.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import { services } from '../../services/index';
import { svgIcon } from '../../svg/index';
import { tooltip } from '../../util/tooltip';
import { utilDetect } from '../../util/detect';
import { utilGetSetValue } from '../../util/get_set_value';
import { utilRebind } from '../../util/rebind';
import { utilSuggestNames } from '../../util/index';
import {
utilGetSetValue,
utilNoAuto,
utilRebind,
utilSuggestNames
} from '../../util';


export function uiFieldLocalized(field, context) {
Expand All @@ -31,6 +34,7 @@ export function uiFieldLocalized(field, context) {
.attr('id', 'preset-input-' + field.id)
.attr('class', 'localized-main')
.attr('placeholder', field.placeholder())
.call(utilNoAuto)
.merge(input);

if (field.id === 'name') {
Expand Down
8 changes: 6 additions & 2 deletions modules/ui/fields/maxspeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import _ from 'lodash';
import { d3combobox } from '../../lib/d3.combobox.js';
import { dataImperial } from '../../../data/index';
import { geoPointInPolygon } from '../../geo/index';
import { utilRebind } from '../../util/rebind';
import { utilGetSetValue } from '../../util/get_set_value';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export function uiFieldMaxspeed(field, context) {
Expand All @@ -31,6 +34,7 @@ export function uiFieldMaxspeed(field, context) {
.attr('type', 'text')
.attr('id', 'preset-input-' + field.id)
.attr('placeholder', field.placeholder())
.call(utilNoAuto)
.call(combobox)
.merge(input);

Expand Down
8 changes: 6 additions & 2 deletions modules/ui/fields/textarea.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as d3 from 'd3';
import { t } from '../../util/locale';
import { utilGetSetValue } from '../../util/get_set_value';
import { utilRebind } from '../../util/rebind';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export function uiFieldTextarea(field) {
Expand All @@ -18,6 +21,7 @@ export function uiFieldTextarea(field) {
.attr('id', 'preset-input-' + field.id)
.attr('placeholder', field.placeholder() || t('inspector.unknown'))
.attr('maxlength', 255)
.call(utilNoAuto)
.on('input', change(true))
.on('blur', change())
.on('change', change())
Expand Down
9 changes: 7 additions & 2 deletions modules/ui/fields/wikipedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { dataWikipedia } from '../../../data/index';
import { services } from '../../services/index';
import { svgIcon } from '../../svg/index';
import { utilDetect } from '../../util/detect';
import { utilGetSetValue } from '../../util/get_set_value';
import { utilRebind } from '../../util/rebind';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../../util';


export function uiFieldWikipedia(field, context) {
Expand Down Expand Up @@ -58,6 +61,7 @@ export function uiFieldWikipedia(field, context) {
.attr('type', 'text')
.attr('class', 'wiki-lang')
.attr('placeholder', t('translate.localized_translation_language'))
.call(utilNoAuto)
.merge(lang);

utilGetSetValue(lang, language()[1]);
Expand All @@ -76,6 +80,7 @@ export function uiFieldWikipedia(field, context) {
.attr('type', 'text')
.attr('class', 'wiki-title')
.attr('id', 'preset-input-' + field.id)
.call(utilNoAuto)
.merge(title);

title
Expand Down
8 changes: 6 additions & 2 deletions modules/ui/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { svgIcon } from '../svg/index';
import { uiDisclosure } from './disclosure';
import { uiFields } from './fields/index';
import { uiTagReference } from './tag_reference';
import { utilRebind } from '../util/rebind';
import { utilGetSetValue } from '../util/get_set_value';
import {
utilGetSetValue,
utilNoAuto,
utilRebind
} from '../util';


export function uiPreset(context) {
Expand Down Expand Up @@ -240,6 +243,7 @@ export function uiPreset(context) {
.append('input')
.attr('class', 'value')
.attr('type', 'text')
.call(utilNoAuto)
.merge(input);

input
Expand Down
3 changes: 2 additions & 1 deletion modules/ui/preset_list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as d3 from 'd3';
import { utilRebind } from '../util/rebind';
import { d3keybinding } from '../lib/d3.keybinding.js';
import { t, textDirection } from '../util/locale';
import { actionChangePreset } from '../actions/index';
Expand All @@ -8,6 +7,7 @@ import { modeBrowse } from '../modes/index';
import { svgIcon } from '../svg/index';
import { uiPresetIcon } from './preset_icon';
import { uiTagReference } from './tag_reference';
import { utilNoAuto, utilRebind } from '../util';


export function uiPresetList(context) {
Expand Down Expand Up @@ -106,6 +106,7 @@ export function uiPresetList(context) {
.attr('class', 'preset-search-input')
.attr('placeholder', t('inspector.search'))
.attr('type', 'search')
.call(utilNoAuto)
.on('keydown', keydown)
.on('keypress', keypress)
.on('input', inputevent);
Expand Down
17 changes: 11 additions & 6 deletions modules/ui/raw_member_editor.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import * as d3 from 'd3';
import { d3combobox } from '../lib/d3.combobox.js';
import { t } from '../util/locale';
import { actionChangeMember, actionDeleteMember } from '../actions/index';
import { modeBrowse, modeSelect } from '../modes/index';
import { osmEntity } from '../osm/index';
import { svgIcon } from '../svg/index';
import { services } from '../services/index';
import { actionChangeMember, actionDeleteMember } from '../actions';
import { modeBrowse, modeSelect } from '../modes';
import { osmEntity } from '../osm';
import { svgIcon } from '../svg';
import { services } from '../services';
import { uiDisclosure } from './disclosure';
import { utilDisplayName, utilDisplayType } from '../util/index';
import {
utilDisplayName,
utilDisplayType,
utilNoAuto
} from '../util';


export function uiRawMemberEditor(context) {
Expand Down Expand Up @@ -131,6 +135,7 @@ export function uiRawMemberEditor(context) {
.property('type', 'text')
.attr('maxlength', 255)
.attr('placeholder', t('inspector.role'))
.call(utilNoAuto)
.property('value', function(d) { return d.role; })
.on('change', changeRole);

Expand Down
7 changes: 5 additions & 2 deletions modules/ui/raw_membership_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { osmEntity, osmRelation } from '../osm/index';
import { services } from '../services/index';
import { svgIcon } from '../svg/index';
import { uiDisclosure } from './disclosure';
import { utilDisplayName } from '../util/index';
import { utilDisplayName, utilNoAuto } from '../util/index';


export function uiRawMembershipEditor(context) {
Expand Down Expand Up @@ -191,6 +191,7 @@ export function uiRawMembershipEditor(context) {
.property('type', 'text')
.attr('maxlength', 255)
.attr('placeholder', t('inspector.role'))
.call(utilNoAuto)
.property('value', function(d) { return d.member.role; })
.on('change', changeRole);

Expand Down Expand Up @@ -219,14 +220,16 @@ export function uiRawMembershipEditor(context) {
enter
.append('input')
.attr('type', 'text')
.attr('class', 'member-entity-input');
.attr('class', 'member-entity-input')
.call(utilNoAuto);

enter
.append('input')
.attr('class', 'member-role')
.property('type', 'text')
.attr('maxlength', 255)
.attr('placeholder', t('inspector.role'))
.call(utilNoAuto)
.on('change', changeRole);

enter
Expand Down
Loading

0 comments on commit 2314acf

Please sign in to comment.