mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Add utilNoAuto to remove autocorrect/spellcheck features from inputs
(closes #3839)
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -10,7 +10,8 @@ import { services } from '../services/index';
|
||||
import {
|
||||
utilDisplayName,
|
||||
utilDisplayType,
|
||||
utilEntityOrMemberSelector
|
||||
utilEntityOrMemberSelector,
|
||||
utilNoAuto
|
||||
} from '../util/index';
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
@@ -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()
|
||||
|
||||
@@ -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) {
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
@@ -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)));
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
@@ -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') {
|
||||
|
||||
@@ -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) {
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
@@ -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())
|
||||
|
||||
@@ -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) {
|
||||
@@ -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]);
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
@@ -240,6 +243,7 @@ export function uiPreset(context) {
|
||||
.append('input')
|
||||
.attr('class', 'value')
|
||||
.attr('type', 'text')
|
||||
.call(utilNoAuto)
|
||||
.merge(input);
|
||||
|
||||
input
|
||||
|
||||
@@ -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';
|
||||
@@ -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) {
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
@@ -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);
|
||||
|
||||
@@ -219,7 +220,8 @@ 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')
|
||||
@@ -227,6 +229,7 @@ export function uiRawMembershipEditor(context) {
|
||||
.property('type', 'text')
|
||||
.attr('maxlength', 255)
|
||||
.attr('placeholder', t('inspector.role'))
|
||||
.call(utilNoAuto)
|
||||
.on('change', changeRole);
|
||||
|
||||
enter
|
||||
|
||||
@@ -5,8 +5,11 @@ import { services } from '../services/index';
|
||||
import { svgIcon } from '../svg/index';
|
||||
import { uiDisclosure } from './disclosure';
|
||||
import { uiTagReference } from './tag_reference';
|
||||
import { utilGetSetValue } from '../util/get_set_value';
|
||||
import { utilRebind } from '../util/rebind';
|
||||
import {
|
||||
utilGetSetValue,
|
||||
utilNoAuto,
|
||||
utilRebind
|
||||
} from '../util';
|
||||
|
||||
|
||||
export function uiRawTagEditor(context) {
|
||||
@@ -83,6 +86,7 @@ export function uiRawTagEditor(context) {
|
||||
.property('type', 'text')
|
||||
.attr('class', 'key')
|
||||
.attr('maxlength', 255)
|
||||
.call(utilNoAuto)
|
||||
.on('blur', keyChange)
|
||||
.on('change', keyChange);
|
||||
|
||||
@@ -93,6 +97,7 @@ export function uiRawTagEditor(context) {
|
||||
.property('type', 'text')
|
||||
.attr('class', 'value')
|
||||
.attr('maxlength', 255)
|
||||
.call(utilNoAuto)
|
||||
.on('blur', valueChange)
|
||||
.on('change', valueChange)
|
||||
.on('keydown.push-more', pushMore);
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
export { utilTagText } from './util';
|
||||
export { utilEntitySelector } from './util';
|
||||
export { utilEntityOrMemberSelector } from './util';
|
||||
export { utilGetAllNodes } from './util';
|
||||
export { utilAsyncMap } from './util';
|
||||
export { utilDisplayName } from './util';
|
||||
export { utilDisplayNameForPath } from './util';
|
||||
export { utilDisplayType } from './util';
|
||||
export { utilStringQs } from './util';
|
||||
export { utilQsString } from './util';
|
||||
export { utilPrefixDOMProperty } from './util';
|
||||
export { utilPrefixCSSProperty } from './util';
|
||||
export { utilSetTransform } from './util';
|
||||
export { utilEditDistance } from './util';
|
||||
export { utilEntitySelector } from './util';
|
||||
export { utilEntityOrMemberSelector } from './util';
|
||||
export { utilFastMouse } from './util';
|
||||
export { utilGetPrototypeOf } from './util';
|
||||
export { utilAsyncMap } from './util';
|
||||
export { utilWrap } from './util';
|
||||
export { utilFunctor } from './util';
|
||||
export { utilSessionMutex } from './session_mutex';
|
||||
export { utilSuggestNames } from './suggest_names';
|
||||
export { utilTriggerEvent } from './trigger_event';
|
||||
export { utilGetAllNodes } from './util';
|
||||
export { utilGetPrototypeOf } from './util';
|
||||
export { utilGetSetValue } from './get_set_value';
|
||||
export { utilNoAuto } from './util';
|
||||
export { utilPrefixCSSProperty } from './util';
|
||||
export { utilPrefixDOMProperty } from './util';
|
||||
export { utilQsString } from './util';
|
||||
export { utilRebind } from './rebind';
|
||||
export { utilSetTransform } from './util';
|
||||
export { utilSessionMutex } from './session_mutex';
|
||||
export { utilStringQs } from './util';
|
||||
export { utilSuggestNames } from './suggest_names';
|
||||
export { utilTagText } from './util';
|
||||
export { utilTriggerEvent } from './trigger_event';
|
||||
export { utilWrap } from './util';
|
||||
|
||||
@@ -252,3 +252,12 @@ export function utilFunctor(value) {
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export function utilNoAuto(selection) {
|
||||
return selection
|
||||
.attr('autocomplete', 'off')
|
||||
.attr('autocorrect', 'off')
|
||||
.attr('autocapitalize', 'off')
|
||||
.attr('spellcheck', 'false');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user