mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 06:35:20 +02:00
Make taginfo configurable and default to disabling taginfo related features
This commit is contained in:
committed by
John Firebaugh
parent
e0020c37e2
commit
dab742a501
Vendored
+2
-1
@@ -66,7 +66,8 @@
|
||||
} else {
|
||||
var id = iD()
|
||||
.presets(iD.data.presets)
|
||||
.imagery(iD.data.imagery);
|
||||
.imagery(iD.data.imagery)
|
||||
.taginfo(iD.taginfo());
|
||||
|
||||
d3.select('#id-container')
|
||||
.call(id.ui());
|
||||
|
||||
@@ -232,6 +232,7 @@
|
||||
id = iD()
|
||||
.presets(iD.data.presets)
|
||||
.imagery(iD.data.imagery)
|
||||
.taginfo(iD.taginfo())
|
||||
.assetPath('dist/');
|
||||
|
||||
d3.select('#id-container')
|
||||
|
||||
@@ -243,6 +243,14 @@ window.iD = function () {
|
||||
return context;
|
||||
};
|
||||
|
||||
/* Taginfo */
|
||||
var taginfo;
|
||||
context.taginfo = function(_) {
|
||||
if (!arguments.length) return taginfo;
|
||||
taginfo = _;
|
||||
return context;
|
||||
};
|
||||
|
||||
var embed = false;
|
||||
context.embed = function(_) {
|
||||
if (!arguments.length) return embed;
|
||||
|
||||
@@ -172,7 +172,7 @@ iD.ui.EntityEditor = function(context) {
|
||||
if (!arguments.length) return preset;
|
||||
if (_ !== preset) {
|
||||
preset = _;
|
||||
reference = iD.ui.TagReference(preset.reference(context.geometry(id)))
|
||||
reference = iD.ui.TagReference(preset.reference(context.geometry(id)), context)
|
||||
.showing(false);
|
||||
}
|
||||
return entityEditor;
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ iD.ui.preset = function(context) {
|
||||
return field.present();
|
||||
})
|
||||
.each(function(field) {
|
||||
var reference = iD.ui.TagReference(field.reference || {key: field.key});
|
||||
var reference = iD.ui.TagReference(field.reference || {key: field.key}, context);
|
||||
|
||||
if (state === 'hover') {
|
||||
reference.showing(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
iD.ui.preset.combo =
|
||||
iD.ui.preset.typeCombo = function(field) {
|
||||
iD.ui.preset.typeCombo = function(field, context) {
|
||||
var event = d3.dispatch('change'),
|
||||
optstrings = field.strings && field.strings.options,
|
||||
optarray = field.options,
|
||||
@@ -34,8 +34,8 @@ iD.ui.preset.typeCombo = function(field) {
|
||||
strings[k] = k.replace(/_+/g, ' ');
|
||||
});
|
||||
stringsLoaded();
|
||||
} else {
|
||||
iD.taginfo().values({key: field.key}, function(err, data) {
|
||||
} else if (context.taginfo()) {
|
||||
context.taginfo().values({key: field.key}, function(err, data) {
|
||||
if (!err) {
|
||||
_.each(_.pluck(data, 'value'), function(k) {
|
||||
strings[k] = k.replace(/_+/g, ' ');
|
||||
|
||||
@@ -213,7 +213,7 @@ iD.ui.PresetList = function(context) {
|
||||
};
|
||||
|
||||
item.preset = preset;
|
||||
item.reference = iD.ui.TagReference(preset.reference(context.geometry(id)));
|
||||
item.reference = iD.ui.TagReference(preset.reference(context.geometry(id)), context);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
iD.ui.RawTagEditor = function(context) {
|
||||
var event = d3.dispatch('change'),
|
||||
taginfo = iD.taginfo(),
|
||||
showBlank = false,
|
||||
state,
|
||||
preset,
|
||||
@@ -77,14 +76,16 @@ iD.ui.RawTagEditor = function(context) {
|
||||
.append('span')
|
||||
.attr('class', 'icon delete');
|
||||
|
||||
$enter.each(bindTypeahead);
|
||||
if (context.taginfo()) {
|
||||
$enter.each(bindTypeahead);
|
||||
}
|
||||
|
||||
// Update
|
||||
|
||||
$items.order();
|
||||
|
||||
$items.each(function(tag) {
|
||||
var reference = iD.ui.TagReference({key: tag.key});
|
||||
var reference = iD.ui.TagReference({key: tag.key}, context);
|
||||
|
||||
if (state === 'hover') {
|
||||
reference.showing(false);
|
||||
@@ -139,7 +140,7 @@ iD.ui.RawTagEditor = function(context) {
|
||||
|
||||
key.call(d3.combobox()
|
||||
.fetcher(function(value, callback) {
|
||||
taginfo.keys({
|
||||
context.taginfo().keys({
|
||||
debounce: true,
|
||||
geometry: context.geometry(id),
|
||||
query: value
|
||||
@@ -150,7 +151,7 @@ iD.ui.RawTagEditor = function(context) {
|
||||
|
||||
value.call(d3.combobox()
|
||||
.fetcher(function(value, callback) {
|
||||
taginfo.values({
|
||||
context.taginfo().values({
|
||||
debounce: true,
|
||||
key: key.value(),
|
||||
geometry: context.geometry(id),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
iD.ui.TagReference = function(tag) {
|
||||
iD.ui.TagReference = function(tag, context) {
|
||||
var tagReference = {},
|
||||
taginfo = iD.taginfo(),
|
||||
button,
|
||||
body,
|
||||
loaded,
|
||||
@@ -34,7 +33,7 @@ iD.ui.TagReference = function(tag) {
|
||||
function load() {
|
||||
button.classed('tag-reference-loading', true);
|
||||
|
||||
taginfo.docs(tag, function(err, docs) {
|
||||
context.taginfo().docs(tag, function(err, docs) {
|
||||
if (!err && docs) {
|
||||
docs = findLocal(docs);
|
||||
}
|
||||
@@ -117,7 +116,9 @@ iD.ui.TagReference = function(tag) {
|
||||
} else if (loaded) {
|
||||
show();
|
||||
} else {
|
||||
load();
|
||||
if (context.taginfo()) {
|
||||
load();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user