mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 17:14:04 +02:00
Fix merge conflicts
This commit is contained in:
@@ -13,13 +13,13 @@ import { utilDetect } from '../../util/detect';
|
||||
export function uiSectionBackgroundDisplayOptions(context) {
|
||||
|
||||
var section = uiSection('background-display-options', context)
|
||||
.title(t('background.display_options'))
|
||||
.label(t.html('background.display_options'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
var _detected = utilDetect();
|
||||
var _storedOpacity = prefs('background-opacity');
|
||||
var _minVal = 0.25;
|
||||
var _maxVal = _detected.cssfilters ? 2 : 1;
|
||||
var _minVal = 0;
|
||||
var _maxVal = _detected.cssfilters ? 3 : 1;
|
||||
|
||||
var _sliders = _detected.cssfilters
|
||||
? ['brightness', 'contrast', 'saturation', 'sharpness']
|
||||
@@ -70,11 +70,15 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
|
||||
slidersEnter
|
||||
.append('h5')
|
||||
.text(function(d) { return t('background.' + d); })
|
||||
.html(function(d) { return t.html('background.' + d); })
|
||||
.append('span')
|
||||
.attr('class', function(d) { return 'display-option-value display-option-value-' + d; });
|
||||
|
||||
slidersEnter
|
||||
var sildersControlEnter = slidersEnter
|
||||
.append('div')
|
||||
.attr('class', 'control-wrap');
|
||||
|
||||
sildersControlEnter
|
||||
.append('input')
|
||||
.attr('class', function(d) { return 'display-option-input display-option-input-' + d; })
|
||||
.attr('type', 'range')
|
||||
@@ -86,7 +90,7 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
updateValue(d, val);
|
||||
});
|
||||
|
||||
slidersEnter
|
||||
sildersControlEnter
|
||||
.append('button')
|
||||
.attr('title', t('background.reset'))
|
||||
.attr('class', function(d) { return 'display-option-reset display-option-reset-' + d; })
|
||||
@@ -101,7 +105,7 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
.append('a')
|
||||
.attr('class', 'display-option-resetlink')
|
||||
.attr('href', '#')
|
||||
.text(t('background.reset_all'))
|
||||
.html(t.html('background.reset_all'))
|
||||
.on('click', function() {
|
||||
for (var i = 0; i < _sliders.length; i++) {
|
||||
updateValue(_sliders[i],1);
|
||||
@@ -116,7 +120,7 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
.property('value', function(d) { return _options[d]; });
|
||||
|
||||
container.selectAll('.display-option-value')
|
||||
.text(function(d) { return Math.floor(_options[d] * 100) + '%'; });
|
||||
.html(function(d) { return Math.floor(_options[d] * 100) + '%'; });
|
||||
|
||||
container.selectAll('.display-option-reset')
|
||||
.classed('disabled', function(d) { return _options[d] === 1; });
|
||||
|
||||
@@ -24,7 +24,7 @@ export function uiSectionBackgroundList(context) {
|
||||
.on('change', customChanged);
|
||||
|
||||
var section = uiSection('background-list', context)
|
||||
.title(t('background.backgrounds'))
|
||||
.label(t.html('background.backgrounds'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
function previousBackgroundID() {
|
||||
@@ -56,7 +56,7 @@ export function uiSectionBackgroundList(context) {
|
||||
.attr('class', 'minimap-toggle-item')
|
||||
.append('label')
|
||||
.call(uiTooltip()
|
||||
.title(t('background.minimap.tooltip'))
|
||||
.title(t.html('background.minimap.tooltip'))
|
||||
.keys([t('background.minimap.key')])
|
||||
.placement('top')
|
||||
);
|
||||
@@ -71,7 +71,7 @@ export function uiSectionBackgroundList(context) {
|
||||
|
||||
minimapLabelEnter
|
||||
.append('span')
|
||||
.text(t('background.minimap.description'));
|
||||
.html(t.html('background.minimap.description'));
|
||||
|
||||
|
||||
var panelLabelEnter = bgExtrasListEnter
|
||||
@@ -79,7 +79,7 @@ export function uiSectionBackgroundList(context) {
|
||||
.attr('class', 'background-panel-toggle-item')
|
||||
.append('label')
|
||||
.call(uiTooltip()
|
||||
.title(t('background.panel.tooltip'))
|
||||
.title(t.html('background.panel.tooltip'))
|
||||
.keys([uiCmd('⌘⇧' + t('info_panels.background.key'))])
|
||||
.placement('top')
|
||||
);
|
||||
@@ -94,14 +94,14 @@ export function uiSectionBackgroundList(context) {
|
||||
|
||||
panelLabelEnter
|
||||
.append('span')
|
||||
.text(t('background.panel.description'));
|
||||
.html(t.html('background.panel.description'));
|
||||
|
||||
var locPanelLabelEnter = bgExtrasListEnter
|
||||
.append('li')
|
||||
.attr('class', 'location-panel-toggle-item')
|
||||
.append('label')
|
||||
.call(uiTooltip()
|
||||
.title(t('background.location_panel.tooltip'))
|
||||
.title(t.html('background.location_panel.tooltip'))
|
||||
.keys([uiCmd('⌘⇧' + t('info_panels.location.key'))])
|
||||
.placement('top')
|
||||
);
|
||||
@@ -116,7 +116,7 @@ export function uiSectionBackgroundList(context) {
|
||||
|
||||
locPanelLabelEnter
|
||||
.append('span')
|
||||
.text(t('background.location_panel.description'));
|
||||
.html(t.html('background.location_panel.description'));
|
||||
|
||||
|
||||
// "Info / Report a Problem" link
|
||||
@@ -130,7 +130,7 @@ export function uiSectionBackgroundList(context) {
|
||||
.call(svgIcon('#iD-icon-out-link', 'inline'))
|
||||
.attr('href', 'https://github.com/openstreetmap/iD/blob/develop/FAQ.md#how-can-i-report-an-issue-with-background-imagery')
|
||||
.append('span')
|
||||
.text(t('background.imagery_problem_faq'));
|
||||
.html(t.html('background.imagery_problem_faq'));
|
||||
|
||||
_backgroundList
|
||||
.call(drawListItems, 'radio', chooseBackground, function(d) { return !d.isHidden() && !d.overlay; });
|
||||
@@ -149,13 +149,13 @@ export function uiSectionBackgroundList(context) {
|
||||
if (d.id === previousBackgroundID()) {
|
||||
item.call(uiTooltip()
|
||||
.placement(placement)
|
||||
.title('<div>' + t('background.switch') + '</div>')
|
||||
.title('<div>' + t.html('background.switch') + '</div>')
|
||||
.keys([uiCmd('⌘' + t('background.key'))])
|
||||
);
|
||||
} else if (description || isOverflowing) {
|
||||
item.call(uiTooltip()
|
||||
.placement(placement)
|
||||
.title(description || d.name())
|
||||
.title(description || d.label())
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -164,10 +164,18 @@ export function uiSectionBackgroundList(context) {
|
||||
function drawListItems(layerList, type, change, filter) {
|
||||
var sources = context.background()
|
||||
.sources(context.map().extent(), context.map().zoom(), true)
|
||||
.filter(filter);
|
||||
.filter(filter)
|
||||
.sort(function(a, b) {
|
||||
return a.best() && !b.best() ? -1
|
||||
: b.best() && !a.best() ? 1
|
||||
: d3_descending(a.area(), b.area()) || d3_ascending(a.name(), b.name()) || 0;
|
||||
});
|
||||
|
||||
var layerLinks = layerList.selectAll('li')
|
||||
.data(sources, function(d) { return d.name(); });
|
||||
// We have to be a bit inefficient about reordering the list since
|
||||
// arrow key navigation of radio values likes to work in the order
|
||||
// they were added, not the display document order.
|
||||
.data(sources, function(d, i) { return d.id + '---' + i; });
|
||||
|
||||
layerLinks.exit()
|
||||
.remove();
|
||||
@@ -183,18 +191,21 @@ export function uiSectionBackgroundList(context) {
|
||||
label
|
||||
.append('input')
|
||||
.attr('type', type)
|
||||
.attr('name', 'layers')
|
||||
.attr('name', 'background-layer')
|
||||
.attr('value', function(d) {
|
||||
return d.id;
|
||||
})
|
||||
.on('change', change);
|
||||
|
||||
label
|
||||
.append('span')
|
||||
.text(function(d) { return d.name(); });
|
||||
.html(function(d) { return d.label(); });
|
||||
|
||||
enter.filter(function(d) { return d.id === 'custom'; })
|
||||
.append('button')
|
||||
.attr('class', 'layer-browse')
|
||||
.call(uiTooltip()
|
||||
.title(t('settings.custom_background.tooltip'))
|
||||
.title(t.html('settings.custom_background.tooltip'))
|
||||
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')
|
||||
)
|
||||
.on('click', editCustom)
|
||||
@@ -204,25 +215,14 @@ export function uiSectionBackgroundList(context) {
|
||||
.append('div')
|
||||
.attr('class', 'best')
|
||||
.call(uiTooltip()
|
||||
.title(t('background.best_imagery'))
|
||||
.title(t.html('background.best_imagery'))
|
||||
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')
|
||||
)
|
||||
.append('span')
|
||||
.html('★');
|
||||
|
||||
|
||||
layerList.selectAll('li')
|
||||
.sort(sortSources);
|
||||
|
||||
layerList
|
||||
.call(updateLayerSelections);
|
||||
|
||||
|
||||
function sortSources(a, b) {
|
||||
return a.best() && !b.best() ? -1
|
||||
: b.best() && !a.best() ? 1
|
||||
: d3_descending(a.area(), b.area()) || d3_ascending(a.name(), b.name()) || 0;
|
||||
}
|
||||
}
|
||||
|
||||
function updateLayerSelections(selection) {
|
||||
@@ -244,12 +244,10 @@ export function uiSectionBackgroundList(context) {
|
||||
return editCustom();
|
||||
}
|
||||
|
||||
d3_event.preventDefault();
|
||||
var previousBackground = context.background().baseLayerSource();
|
||||
prefs('background-last-used-toggle', previousBackground.id);
|
||||
prefs('background-last-used', d.id);
|
||||
context.background().baseLayerSource(d);
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { uiSection } from '../section';
|
||||
export function uiSectionBackgroundOffset(context) {
|
||||
|
||||
var section = uiSection('background-offset', context)
|
||||
.title(t('background.fix_misalignment'))
|
||||
.label(t.html('background.fix_misalignment'))
|
||||
.disclosureContent(renderDisclosureContent)
|
||||
.expandedByDefault(false);
|
||||
|
||||
@@ -161,7 +161,7 @@ export function uiSectionBackgroundOffset(context) {
|
||||
containerEnter
|
||||
.append('div')
|
||||
.attr('class', 'nudge-instructions')
|
||||
.text(t('background.offset'));
|
||||
.html(t.html('background.offset'));
|
||||
|
||||
var nudgeEnter = containerEnter
|
||||
.append('div')
|
||||
@@ -172,9 +172,10 @@ export function uiSectionBackgroundOffset(context) {
|
||||
.append('div')
|
||||
.attr('class', 'nudge-inner-rect')
|
||||
.append('input')
|
||||
.attr('type', 'text')
|
||||
.on('change', inputOffset);
|
||||
|
||||
containerEnter
|
||||
nudgeEnter
|
||||
.append('div')
|
||||
.selectAll('button')
|
||||
.data(_directions).enter()
|
||||
|
||||
@@ -26,10 +26,10 @@ export function uiSectionChanges(context) {
|
||||
.catch(function() { /* ignore */ });
|
||||
|
||||
var section = uiSection('changes-list', context)
|
||||
.title(function() {
|
||||
.label(function() {
|
||||
var history = context.history();
|
||||
var summary = history.difference().summary();
|
||||
return t('commit.changes', { count: summary.length });
|
||||
return t('inspector.title_count', { title: t.html('commit.changes'), count: summary.length });
|
||||
})
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
@@ -59,29 +59,35 @@ export function uiSectionChanges(context) {
|
||||
.append('li')
|
||||
.attr('class', 'change-item');
|
||||
|
||||
itemsEnter
|
||||
var buttons = itemsEnter
|
||||
.append('button')
|
||||
.on('mouseover', mouseover)
|
||||
.on('mouseout', mouseout)
|
||||
.on('click', click);
|
||||
|
||||
buttons
|
||||
.each(function(d) {
|
||||
d3_select(this)
|
||||
.call(svgIcon('#iD-icon-' + d.entity.geometry(d.graph), 'pre-text ' + d.changeType));
|
||||
});
|
||||
|
||||
itemsEnter
|
||||
buttons
|
||||
.append('span')
|
||||
.attr('class', 'change-type')
|
||||
.text(function(d) { return t('commit.' + d.changeType) + ' '; });
|
||||
.html(function(d) { return t.html('commit.' + d.changeType) + ' '; });
|
||||
|
||||
itemsEnter
|
||||
buttons
|
||||
.append('strong')
|
||||
.attr('class', 'entity-type')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
var matched = presetManager.match(d.entity, d.graph);
|
||||
return (matched && matched.name()) || utilDisplayType(d.entity.id);
|
||||
});
|
||||
|
||||
itemsEnter
|
||||
buttons
|
||||
.append('span')
|
||||
.attr('class', 'entity-name')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
var name = utilDisplayName(d.entity) || '',
|
||||
string = '';
|
||||
if (name !== '') {
|
||||
@@ -90,19 +96,9 @@ export function uiSectionChanges(context) {
|
||||
return string += ' ' + name;
|
||||
});
|
||||
|
||||
itemsEnter
|
||||
.style('opacity', 0)
|
||||
.transition()
|
||||
.style('opacity', 1);
|
||||
|
||||
items = itemsEnter
|
||||
.merge(items);
|
||||
|
||||
items
|
||||
.on('mouseover', mouseover)
|
||||
.on('mouseout', mouseout)
|
||||
.on('click', click);
|
||||
|
||||
|
||||
// Download changeset link
|
||||
var changeset = new osmChangeset().update({ id: undefined });
|
||||
@@ -136,7 +132,7 @@ export function uiSectionChanges(context) {
|
||||
linkEnter
|
||||
.call(svgIcon('#iD-icon-load', 'inline'))
|
||||
.append('span')
|
||||
.text(t('commit.download_changes'));
|
||||
.html(t.html('commit.download_changes'));
|
||||
|
||||
|
||||
function mouseover(d) {
|
||||
|
||||
@@ -22,7 +22,7 @@ export function uiSectionDataLayers(context) {
|
||||
var layers = context.layers();
|
||||
|
||||
var section = uiSection('data-layers', context)
|
||||
.title(t('map_data.data_layers'))
|
||||
.label(t.html('map_data.data_layers'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
function renderDisclosureContent(selection) {
|
||||
@@ -96,14 +96,14 @@ export function uiSectionDataLayers(context) {
|
||||
if (d.id === 'osm') {
|
||||
d3_select(this)
|
||||
.call(uiTooltip()
|
||||
.title(t('map_data.layers.' + d.id + '.tooltip'))
|
||||
.title(t.html('map_data.layers.' + d.id + '.tooltip'))
|
||||
.keys([uiCmd('⌥' + t('area_fill.wireframe.key'))])
|
||||
.placement('bottom')
|
||||
);
|
||||
} else {
|
||||
d3_select(this)
|
||||
.call(uiTooltip()
|
||||
.title(t('map_data.layers.' + d.id + '.tooltip'))
|
||||
.title(t.html('map_data.layers.' + d.id + '.tooltip'))
|
||||
.placement('bottom')
|
||||
);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export function uiSectionDataLayers(context) {
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
.text(function(d) { return t('map_data.layers.' + d.id + '.title'); });
|
||||
.html(function(d) { return t.html('map_data.layers.' + d.id + '.title'); });
|
||||
|
||||
|
||||
// Update
|
||||
@@ -155,7 +155,7 @@ export function uiSectionDataLayers(context) {
|
||||
.each(function(d) {
|
||||
d3_select(this)
|
||||
.call(uiTooltip()
|
||||
.title(t('map_data.layers.' + d.id + '.tooltip'))
|
||||
.title(t.html('map_data.layers.' + d.id + '.tooltip'))
|
||||
.placement('bottom')
|
||||
);
|
||||
});
|
||||
@@ -167,7 +167,7 @@ export function uiSectionDataLayers(context) {
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
.text(function(d) { return t('map_data.layers.' + d.id + '.title'); });
|
||||
.html(function(d) { return t.html('map_data.layers.' + d.id + '.title'); });
|
||||
|
||||
|
||||
// Update
|
||||
@@ -218,7 +218,7 @@ export function uiSectionDataLayers(context) {
|
||||
containerEnter
|
||||
.append('h4')
|
||||
.attr('class', 'vectortile-header')
|
||||
.text('Detroit Vector Tiles (Beta)');
|
||||
.html('Detroit Vector Tiles (Beta)');
|
||||
|
||||
containerEnter
|
||||
.append('ul')
|
||||
@@ -229,11 +229,10 @@ export function uiSectionDataLayers(context) {
|
||||
.attr('class', 'vectortile-footer')
|
||||
.append('a')
|
||||
.attr('target', '_blank')
|
||||
.attr('tabindex', -1)
|
||||
.call(svgIcon('#iD-icon-out-link', 'inline'))
|
||||
.attr('href', 'https://github.com/osmus/detroit-mapping-challenge')
|
||||
.append('span')
|
||||
.text('About these layers');
|
||||
.html('About these layers');
|
||||
|
||||
container = container
|
||||
.merge(containerEnter);
|
||||
@@ -267,7 +266,7 @@ export function uiSectionDataLayers(context) {
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
.text(function(d) { return d.name; });
|
||||
.html(function(d) { return d.name; });
|
||||
|
||||
// Update
|
||||
li
|
||||
@@ -315,7 +314,7 @@ export function uiSectionDataLayers(context) {
|
||||
var labelEnter = liEnter
|
||||
.append('label')
|
||||
.call(uiTooltip()
|
||||
.title(t('map_data.layers.custom.tooltip'))
|
||||
.title(t.html('map_data.layers.custom.tooltip'))
|
||||
.placement('top')
|
||||
);
|
||||
|
||||
@@ -326,12 +325,13 @@ export function uiSectionDataLayers(context) {
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
.text(t('map_data.layers.custom.title'));
|
||||
.html(t.html('map_data.layers.custom.title'));
|
||||
|
||||
liEnter
|
||||
.append('button')
|
||||
.attr('class', 'open-data-options')
|
||||
.call(uiTooltip()
|
||||
.title(t('settings.custom_data.tooltip'))
|
||||
.title(t.html('settings.custom_data.tooltip'))
|
||||
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')
|
||||
)
|
||||
.on('click', editCustom)
|
||||
@@ -339,16 +339,19 @@ export function uiSectionDataLayers(context) {
|
||||
|
||||
liEnter
|
||||
.append('button')
|
||||
.attr('class', 'zoom-to-data')
|
||||
.call(uiTooltip()
|
||||
.title(t('map_data.layers.custom.zoom'))
|
||||
.title(t.html('map_data.layers.custom.zoom'))
|
||||
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')
|
||||
)
|
||||
.on('click', function() {
|
||||
if (d3_select(this).classed('disabled')) return;
|
||||
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
dataLayer.fitZoom();
|
||||
})
|
||||
.call(svgIcon('#iD-icon-framed-dot'));
|
||||
.call(svgIcon('#iD-icon-framed-dot', 'monochrome'));
|
||||
|
||||
// Update
|
||||
ul = ul
|
||||
@@ -361,6 +364,9 @@ export function uiSectionDataLayers(context) {
|
||||
.selectAll('input')
|
||||
.property('disabled', !hasData)
|
||||
.property('checked', showsData);
|
||||
|
||||
ul.selectAll('button.zoom-to-data')
|
||||
.classed('disabled', !hasData);
|
||||
}
|
||||
|
||||
function editCustom() {
|
||||
@@ -393,7 +399,7 @@ export function uiSectionDataLayers(context) {
|
||||
.attr('class', 'history-panel-toggle-item')
|
||||
.append('label')
|
||||
.call(uiTooltip()
|
||||
.title(t('map_data.history_panel.tooltip'))
|
||||
.title(t.html('map_data.history_panel.tooltip'))
|
||||
.keys([uiCmd('⌘⇧' + t('info_panels.history.key'))])
|
||||
.placement('top')
|
||||
);
|
||||
@@ -408,14 +414,14 @@ export function uiSectionDataLayers(context) {
|
||||
|
||||
historyPanelLabelEnter
|
||||
.append('span')
|
||||
.text(t('map_data.history_panel.title'));
|
||||
.html(t.html('map_data.history_panel.title'));
|
||||
|
||||
var measurementPanelLabelEnter = panelsListEnter
|
||||
.append('li')
|
||||
.attr('class', 'measurement-panel-toggle-item')
|
||||
.append('label')
|
||||
.call(uiTooltip()
|
||||
.title(t('map_data.measurement_panel.tooltip'))
|
||||
.title(t.html('map_data.measurement_panel.tooltip'))
|
||||
.keys([uiCmd('⌘⇧' + t('info_panels.measurement.key'))])
|
||||
.placement('top')
|
||||
);
|
||||
@@ -430,7 +436,7 @@ export function uiSectionDataLayers(context) {
|
||||
|
||||
measurementPanelLabelEnter
|
||||
.append('span')
|
||||
.text(t('map_data.measurement_panel.title'));
|
||||
.html(t.html('map_data.measurement_panel.title'));
|
||||
}
|
||||
|
||||
context.layers().on('change.uiSectionDataLayers', section.reRender);
|
||||
|
||||
@@ -16,8 +16,8 @@ export function uiSectionEntityIssues(context) {
|
||||
.shouldDisplay(function() {
|
||||
return _issues.length > 0;
|
||||
})
|
||||
.title(function() {
|
||||
return t('issues.list_title', { count: _issues.length });
|
||||
.label(function() {
|
||||
return t('inspector.title_count', { title: t.html('issues.list_title'), count: _issues.length });
|
||||
})
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
@@ -79,7 +79,11 @@ export function uiSectionEntityIssues(context) {
|
||||
|
||||
var labelsEnter = itemsEnter
|
||||
.append('div')
|
||||
.attr('class', 'issue-label')
|
||||
.attr('class', 'issue-label');
|
||||
|
||||
var textEnter = labelsEnter
|
||||
.append('button')
|
||||
.attr('class', 'issue-text')
|
||||
.on('click', function(d) {
|
||||
|
||||
makeActiveIssue(d.id); // expand only the clicked item
|
||||
@@ -91,17 +95,11 @@ export function uiSectionEntityIssues(context) {
|
||||
}
|
||||
});
|
||||
|
||||
var textEnter = labelsEnter
|
||||
.append('span')
|
||||
.attr('class', 'issue-text');
|
||||
|
||||
textEnter
|
||||
.append('span')
|
||||
.attr('class', 'issue-icon')
|
||||
.each(function(d) {
|
||||
var iconName = '#iD-icon-' + (d.severity === 'warning' ? 'alert' : 'error');
|
||||
d3_select(this)
|
||||
.call(svgIcon(iconName));
|
||||
.call(svgIcon(iconName, 'issue-icon'));
|
||||
});
|
||||
|
||||
textEnter
|
||||
@@ -113,7 +111,6 @@ export function uiSectionEntityIssues(context) {
|
||||
.append('button')
|
||||
.attr('class', 'issue-info-button')
|
||||
.attr('title', t('icons.information'))
|
||||
.attr('tabindex', -1)
|
||||
.call(svgIcon('#iD-icon-inspect'));
|
||||
|
||||
infoButton
|
||||
@@ -163,7 +160,7 @@ export function uiSectionEntityIssues(context) {
|
||||
.call(d.reference);
|
||||
} else {
|
||||
d3_select(this)
|
||||
.text(t('inspector.no_documentation_key'));
|
||||
.html(t.html('inspector.no_documentation_key'));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -174,7 +171,7 @@ export function uiSectionEntityIssues(context) {
|
||||
.classed('active', function(d) { return d.id === _activeIssueID; });
|
||||
|
||||
containers.selectAll('.issue-message')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
return d.message(context);
|
||||
});
|
||||
|
||||
@@ -189,10 +186,13 @@ export function uiSectionEntityIssues(context) {
|
||||
|
||||
var fixesEnter = fixes.enter()
|
||||
.append('li')
|
||||
.attr('class', 'issue-fix-item')
|
||||
.attr('class', 'issue-fix-item');
|
||||
|
||||
var buttons = fixesEnter
|
||||
.append('button')
|
||||
.on('click', function(d) {
|
||||
// not all fixes are actionable
|
||||
if (!d3_select(this).classed('actionable') || !d.onClick) return;
|
||||
if (d3_select(this).attr('disabled') || !d.onClick) return;
|
||||
|
||||
// Don't run another fix for this issue within a second of running one
|
||||
// (Necessary for "Select a feature type" fix. Most fixes should only ever run once)
|
||||
@@ -221,26 +221,28 @@ export function uiSectionEntityIssues(context) {
|
||||
utilHighlightEntities(d.entityIds, false, context);
|
||||
});
|
||||
|
||||
fixesEnter
|
||||
.append('span')
|
||||
.attr('class', 'fix-icon')
|
||||
buttons
|
||||
.each(function(d) {
|
||||
var iconName = d.icon || 'iD-icon-wrench';
|
||||
if (iconName.startsWith('maki')) {
|
||||
iconName += '-15';
|
||||
}
|
||||
d3_select(this).call(svgIcon('#' + iconName));
|
||||
d3_select(this).call(svgIcon('#' + iconName, 'fix-icon'));
|
||||
});
|
||||
|
||||
fixesEnter
|
||||
buttons
|
||||
.append('span')
|
||||
.attr('class', 'fix-message')
|
||||
.text(function(d) { return d.title; });
|
||||
.html(function(d) { return d.title; });
|
||||
|
||||
fixesEnter.merge(fixes)
|
||||
.selectAll('button')
|
||||
.classed('actionable', function(d) {
|
||||
return d.onClick;
|
||||
})
|
||||
.attr('disabled', function(d) {
|
||||
return d.onClick ? null : 'true';
|
||||
})
|
||||
.attr('title', function(d) {
|
||||
if (d.disabledReason) {
|
||||
return d.disabledReason;
|
||||
|
||||
@@ -23,7 +23,7 @@ export function uiSectionFeatureType(context) {
|
||||
var _tagReference;
|
||||
|
||||
var section = uiSection('feature-type', context)
|
||||
.title(t('inspector.feature_type'))
|
||||
.label(t.html('inspector.feature_type'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
function renderDisclosureContent(selection) {
|
||||
@@ -42,7 +42,7 @@ export function uiSectionFeatureType(context) {
|
||||
.append('button')
|
||||
.attr('class', 'preset-list-button preset-reset')
|
||||
.call(uiTooltip()
|
||||
.title(t('inspector.back_tooltip'))
|
||||
.title(t.html('inspector.back_tooltip'))
|
||||
.placement('bottom')
|
||||
);
|
||||
|
||||
@@ -95,8 +95,10 @@ export function uiSectionFeatureType(context) {
|
||||
.preset(_presets.length === 1 ? _presets[0] : presetManager.item('point'))
|
||||
);
|
||||
|
||||
// NOTE: split on en-dash, not a hypen (to avoid conflict with hyphenated names)
|
||||
var names = _presets.length === 1 ? _presets[0].name().split(' – ') : [t('inspector.multiple_types')];
|
||||
var names = _presets.length === 1 ? [
|
||||
_presets[0].nameLabel(),
|
||||
_presets[0].subtitleLabel()
|
||||
].filter(Boolean) : [t('inspector.multiple_types')];
|
||||
|
||||
var label = selection.select('.label-inner');
|
||||
var nameparts = label.selectAll('.namepart')
|
||||
@@ -109,7 +111,7 @@ export function uiSectionFeatureType(context) {
|
||||
.enter()
|
||||
.append('div')
|
||||
.attr('class', 'namepart')
|
||||
.text(function(d) { return d; });
|
||||
.html(function(d) { return d; });
|
||||
}
|
||||
|
||||
section.entityIDs = function(val) {
|
||||
@@ -125,9 +127,8 @@ export function uiSectionFeatureType(context) {
|
||||
if (!utilArrayIdentical(val, _presets)) {
|
||||
_presets = val;
|
||||
|
||||
var geometries = entityGeometries();
|
||||
if (_presets.length === 1 && geometries.length) {
|
||||
_tagReference = uiTagReference(_presets[0].reference(geometries[0]), context)
|
||||
if (_presets.length === 1) {
|
||||
_tagReference = uiTagReference(_presets[0].reference(), context)
|
||||
.showing(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export function uiSectionMapFeatures(context) {
|
||||
var _features = context.features().keys();
|
||||
|
||||
var section = uiSection('map-features', context)
|
||||
.title(t('map_data.map_features'))
|
||||
.label(t.html('map_data.map_features'))
|
||||
.disclosureContent(renderDisclosureContent)
|
||||
.expandedByDefault(false);
|
||||
|
||||
@@ -32,18 +32,18 @@ export function uiSectionMapFeatures(context) {
|
||||
.append('a')
|
||||
.attr('class', 'feature-list-link')
|
||||
.attr('href', '#')
|
||||
.text(t('issues.enable_all'))
|
||||
.html(t.html('issues.disable_all'))
|
||||
.on('click', function() {
|
||||
context.features().enableAll();
|
||||
context.features().disableAll();
|
||||
});
|
||||
|
||||
footer
|
||||
.append('a')
|
||||
.attr('class', 'feature-list-link')
|
||||
.attr('href', '#')
|
||||
.text(t('issues.disable_all'))
|
||||
.html(t.html('issues.enable_all'))
|
||||
.on('click', function() {
|
||||
context.features().disableAll();
|
||||
context.features().enableAll();
|
||||
});
|
||||
|
||||
// Update
|
||||
@@ -67,9 +67,9 @@ export function uiSectionMapFeatures(context) {
|
||||
.append('li')
|
||||
.call(uiTooltip()
|
||||
.title(function(d) {
|
||||
var tip = t(name + '.' + d + '.tooltip');
|
||||
var tip = t.html(name + '.' + d + '.tooltip');
|
||||
if (autoHiddenFeature(d)) {
|
||||
var msg = showsLayer('osm') ? t('map_data.autohidden') : t('map_data.osmhidden');
|
||||
var msg = showsLayer('osm') ? t.html('map_data.autohidden') : t.html('map_data.osmhidden');
|
||||
tip += '<div>' + msg + '</div>';
|
||||
}
|
||||
return tip;
|
||||
@@ -88,7 +88,7 @@ export function uiSectionMapFeatures(context) {
|
||||
|
||||
label
|
||||
.append('span')
|
||||
.text(function(d) { return t(name + '.' + d + '.description'); });
|
||||
.html(function(d) { return t.html(name + '.' + d + '.description'); });
|
||||
|
||||
// Update
|
||||
items = items
|
||||
|
||||
@@ -9,7 +9,7 @@ import { uiSection } from '../section';
|
||||
export function uiSectionMapStyleOptions(context) {
|
||||
|
||||
var section = uiSection('fill-area', context)
|
||||
.title(t('map_data.style_options'))
|
||||
.label(t.html('map_data.style_options'))
|
||||
.disclosureContent(renderDisclosureContent)
|
||||
.expandedByDefault(false);
|
||||
|
||||
@@ -48,7 +48,7 @@ export function uiSectionMapStyleOptions(context) {
|
||||
.append('li')
|
||||
.call(uiTooltip()
|
||||
.title(function(d) {
|
||||
return t(name + '.' + d + '.tooltip');
|
||||
return t.html(name + '.' + d + '.tooltip');
|
||||
})
|
||||
.keys(function(d) {
|
||||
var key = (d === 'wireframe' ? t('area_fill.wireframe.key') : null);
|
||||
@@ -69,7 +69,7 @@ export function uiSectionMapStyleOptions(context) {
|
||||
|
||||
label
|
||||
.append('span')
|
||||
.text(function(d) { return t(name + '.' + d + '.description'); });
|
||||
.html(function(d) { return t.html(name + '.' + d + '.description'); });
|
||||
|
||||
// Update
|
||||
items = items
|
||||
|
||||
@@ -12,7 +12,7 @@ import { uiSection } from '../section';
|
||||
export function uiSectionOverlayList(context) {
|
||||
|
||||
var section = uiSection('overlay-list', context)
|
||||
.title(t('background.overlays'))
|
||||
.label(t.html('background.overlays'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
var _overlayList = d3_select(null);
|
||||
@@ -81,7 +81,7 @@ export function uiSectionOverlayList(context) {
|
||||
|
||||
label
|
||||
.append('span')
|
||||
.text(function(d) { return d.name(); });
|
||||
.html(function(d) { return d.label(); });
|
||||
|
||||
|
||||
layerList.selectAll('li')
|
||||
|
||||
@@ -11,7 +11,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
var layers = context.layers();
|
||||
|
||||
var section = uiSection('photo-overlays', context)
|
||||
.title(t('photo_overlays.title'))
|
||||
.label(t.html('photo_overlays.title'))
|
||||
.disclosureContent(renderDisclosureContent)
|
||||
.expandedByDefault(false);
|
||||
|
||||
@@ -76,7 +76,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
else titleID = d.id.replace(/-/g, '_') + '.tooltip';
|
||||
d3_select(this)
|
||||
.call(uiTooltip()
|
||||
.title(t(titleID))
|
||||
.title(t.html(titleID))
|
||||
.placement('top')
|
||||
);
|
||||
});
|
||||
@@ -88,10 +88,10 @@ export function uiSectionPhotoOverlays(context) {
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
var id = d.id;
|
||||
if (id === 'mapillary-signs') id = 'photo_overlays.traffic_signs';
|
||||
return t(id.replace(/-/g, '_') + '.title');
|
||||
return t.html(id.replace(/-/g, '_') + '.title');
|
||||
});
|
||||
|
||||
// Update
|
||||
@@ -138,7 +138,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
.each(function(d) {
|
||||
d3_select(this)
|
||||
.call(uiTooltip()
|
||||
.title(t('photo_overlays.photo_type.' + d + '.tooltip'))
|
||||
.title(t.html('photo_overlays.photo_type.' + d + '.tooltip'))
|
||||
.placement('top')
|
||||
);
|
||||
});
|
||||
@@ -152,7 +152,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
return t('photo_overlays.photo_type.' + d + '.title');
|
||||
});
|
||||
|
||||
|
||||
@@ -15,9 +15,7 @@ import { uiSection } from '../section';
|
||||
export function uiSectionPresetFields(context) {
|
||||
|
||||
var section = uiSection('preset-fields', context)
|
||||
.title(function() {
|
||||
return t('inspector.fields');
|
||||
})
|
||||
.label(t.html('inspector.fields'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
var dispatch = d3_dispatch('change', 'revert');
|
||||
@@ -34,7 +32,8 @@ export function uiSectionPresetFields(context) {
|
||||
var graph = context.graph();
|
||||
|
||||
var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
|
||||
return geoms[graph.entity(entityID).geometry(graph)] = true;
|
||||
geoms[graph.entity(entityID).geometry(graph)] = true;
|
||||
return geoms;
|
||||
}, {}));
|
||||
|
||||
var presetsManager = presetManager;
|
||||
@@ -126,7 +125,9 @@ export function uiSectionPresetFields(context) {
|
||||
selection.selectAll('.wrap-form-field input')
|
||||
.on('keydown', function() {
|
||||
// if user presses enter, and combobox is not active, accept edits..
|
||||
if (d3_event.keyCode === 13 && context.container().select('.combobox').empty()) {
|
||||
if (d3_event.keyCode === 13 && // ↩ Return
|
||||
context.container().select('.combobox').empty()) {
|
||||
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import { uiSection } from '../section';
|
||||
export function uiSectionPrivacy(context) {
|
||||
|
||||
let section = uiSection('preferences-third-party', context)
|
||||
.title(t('preferences.privacy.title'))
|
||||
.label(t.html('preferences.privacy.title'))
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
let _showThirdPartyIcons = prefs('preferences.privacy.thirdpartyicons') || 'true';
|
||||
@@ -29,7 +29,7 @@ export function uiSectionPrivacy(context) {
|
||||
.attr('class', 'privacy-third-party-icons-item')
|
||||
.append('label')
|
||||
.call(uiTooltip()
|
||||
.title(t('preferences.privacy.third_party_icons.tooltip'))
|
||||
.title(t.html('preferences.privacy.third_party_icons.tooltip'))
|
||||
.placement('bottom')
|
||||
);
|
||||
|
||||
@@ -45,7 +45,7 @@ export function uiSectionPrivacy(context) {
|
||||
|
||||
thirdPartyIconsEnter
|
||||
.append('span')
|
||||
.text(t('preferences.privacy.third_party_icons.description'));
|
||||
.html(t.html('preferences.privacy.third_party_icons.description'));
|
||||
|
||||
|
||||
// Privacy Policy link
|
||||
@@ -59,7 +59,7 @@ export function uiSectionPrivacy(context) {
|
||||
.call(svgIcon('#iD-icon-out-link', 'inline'))
|
||||
.attr('href', 'https://github.com/openstreetmap/iD/blob/release/PRIVACY.md')
|
||||
.append('span')
|
||||
.text(t('preferences.privacy.privacy_link'));
|
||||
.html(t.html('preferences.privacy.privacy_link'));
|
||||
|
||||
update();
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ export function uiSectionRawMemberEditor(context) {
|
||||
var entity = context.hasEntity(_entityIDs[0]);
|
||||
return entity && entity.type === 'relation';
|
||||
})
|
||||
.title(function() {
|
||||
.label(function() {
|
||||
var entity = context.hasEntity(_entityIDs[0]);
|
||||
if (!entity) return '';
|
||||
|
||||
var gt = entity.members.length > _maxMembers ? '>' : '';
|
||||
var count = gt + entity.members.slice(0, _maxMembers).length;
|
||||
return t('inspector.title_count', { title: t('inspector.members'), count: count });
|
||||
return t('inspector.title_count', { title: t.html('inspector.members'), count: count });
|
||||
})
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
@@ -90,6 +90,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
actionChangeMember(d.relation.id, member, d.index),
|
||||
t('operations.change_role.annotation')
|
||||
);
|
||||
context.validator().validate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +106,13 @@ export function uiSectionRawMemberEditor(context) {
|
||||
);
|
||||
|
||||
if (!context.hasEntity(d.relation.id)) {
|
||||
// Removing the last member will also delete the relation.
|
||||
// If this happens we need to exit the selection mode
|
||||
context.enter(modeBrowse(context));
|
||||
} else {
|
||||
// Changing the mode also runs `validate`, but otherwise we need to
|
||||
// rerun it manually
|
||||
context.validator().validate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +187,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
labelLink
|
||||
.append('span')
|
||||
.attr('class', 'member-entity-type')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
var matched = presetManager.match(d.member, context.graph());
|
||||
return (matched && matched.name()) || utilDisplayType(d.member.id);
|
||||
});
|
||||
@@ -188,11 +195,10 @@ export function uiSectionRawMemberEditor(context) {
|
||||
labelLink
|
||||
.append('span')
|
||||
.attr('class', 'member-entity-name')
|
||||
.text(function(d) { return utilDisplayName(d.member); });
|
||||
.html(function(d) { return utilDisplayName(d.member); });
|
||||
|
||||
label
|
||||
.append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('title', t('icons.remove'))
|
||||
.attr('class', 'remove member-delete')
|
||||
.call(svgIcon('#iD-operation-delete'));
|
||||
@@ -212,18 +218,17 @@ export function uiSectionRawMemberEditor(context) {
|
||||
labelText
|
||||
.append('span')
|
||||
.attr('class', 'member-entity-type')
|
||||
.text(t('inspector.' + d.type, { id: d.id }));
|
||||
.html(t.html('inspector.' + d.type, { id: d.id }));
|
||||
|
||||
labelText
|
||||
.append('span')
|
||||
.attr('class', 'member-entity-name')
|
||||
.text(t('inspector.incomplete', { id: d.id }));
|
||||
.html(t.html('inspector.incomplete', { id: d.id }));
|
||||
|
||||
label
|
||||
.append('button')
|
||||
.attr('class', 'member-download')
|
||||
.attr('title', t('icons.download'))
|
||||
.attr('tabindex', -1)
|
||||
.call(svgIcon('#iD-icon-load'))
|
||||
.on('click', downloadMember);
|
||||
}
|
||||
@@ -320,6 +325,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
actionMoveMember(d.relation.id, index, targetIndex),
|
||||
t('operations.reorder_members.annotation')
|
||||
);
|
||||
context.validator().validate();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -27,14 +27,14 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
.shouldDisplay(function() {
|
||||
return _entityIDs && _entityIDs.length === 1;
|
||||
})
|
||||
.title(function() {
|
||||
.label(function() {
|
||||
var entity = context.hasEntity(_entityIDs[0]);
|
||||
if (!entity) return '';
|
||||
|
||||
var parents = context.graph().parentRelations(entity);
|
||||
var gt = parents.length > _maxMemberships ? '>' : '';
|
||||
var count = gt + parents.slice(0, _maxMemberships).length;
|
||||
return t('inspector.title_count', { title: t('inspector.relations'), count: count });
|
||||
return t('inspector.title_count', { title: t.html('inspector.relations'), count: count });
|
||||
})
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
@@ -74,7 +74,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
|
||||
|
||||
function changeRole(d) {
|
||||
if (d === 0) return; // called on newrow (shoudn't happen)
|
||||
if (d === 0) return; // called on newrow (shouldn't happen)
|
||||
if (_inChange) return; // avoid accidental recursive call #5731
|
||||
|
||||
var oldRole = d.member.role;
|
||||
@@ -86,6 +86,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
actionChangeMember(d.relation.id, Object.assign({}, d.member, { role: newRole }), d.index),
|
||||
t('operations.change_role.annotation')
|
||||
);
|
||||
context.validator().validate();
|
||||
}
|
||||
_inChange = false;
|
||||
}
|
||||
@@ -102,6 +103,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
actionAddMember(d.relation.id, member),
|
||||
t('operations.add_member.annotation')
|
||||
);
|
||||
context.validator().validate();
|
||||
|
||||
} else {
|
||||
var relation = osmRelation();
|
||||
@@ -110,7 +112,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
actionAddMember(relation.id, member),
|
||||
t('operations.add.annotation.relation')
|
||||
);
|
||||
|
||||
// changing the mode also runs `validate`
|
||||
context.enter(modeSelect(context, [relation.id]).newFeature(true));
|
||||
}
|
||||
}
|
||||
@@ -118,7 +120,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
|
||||
function deleteMembership(d) {
|
||||
this.blur(); // avoid keeping focus on the button
|
||||
if (d === 0) return; // called on newrow (shoudn't happen)
|
||||
if (d === 0) return; // called on newrow (shouldn't happen)
|
||||
|
||||
// remove the hover-highlight styling
|
||||
utilHighlightEntities([d.relation.id], false, context);
|
||||
@@ -127,11 +129,16 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
actionDeleteMember(d.relation.id, d.index),
|
||||
t('operations.delete_member.annotation')
|
||||
);
|
||||
context.validator().validate();
|
||||
}
|
||||
|
||||
|
||||
function fetchNearbyRelations(q, callback) {
|
||||
var newRelation = { relation: null, value: t('inspector.new_relation') };
|
||||
var newRelation = {
|
||||
relation: null,
|
||||
value: t('inspector.new_relation'),
|
||||
display: t.html('inspector.new_relation')
|
||||
};
|
||||
|
||||
var entityID = _entityIDs[0];
|
||||
|
||||
@@ -259,7 +266,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
labelLink
|
||||
.append('span')
|
||||
.attr('class', 'member-entity-type')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
var matched = presetManager.match(d.relation, context.graph());
|
||||
return (matched && matched.name()) || t('inspector.relation');
|
||||
});
|
||||
@@ -267,11 +274,10 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
labelLink
|
||||
.append('span')
|
||||
.attr('class', 'member-entity-name')
|
||||
.text(function(d) { return utilDisplayName(d.relation); });
|
||||
.html(function(d) { return utilDisplayName(d.relation); });
|
||||
|
||||
labelEnter
|
||||
.append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', 'remove member-delete')
|
||||
.call(svgIcon('#iD-operation-delete'))
|
||||
.on('click', deleteMembership);
|
||||
@@ -330,7 +336,6 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
|
||||
newLabelEnter
|
||||
.append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', 'remove member-delete')
|
||||
.call(svgIcon('#iD-operation-delete'))
|
||||
.on('click', function() {
|
||||
@@ -377,7 +382,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
addRelationButton
|
||||
.call(svgIcon('#iD-icon-plus', 'light'));
|
||||
addRelationButton
|
||||
.call(uiTooltip().title(t('inspector.add_to_relation')).placement(localizer.textDirection() === 'ltr' ? 'right' : 'left'));
|
||||
.call(uiTooltip().title(t.html('inspector.add_to_relation')).placement(localizer.textDirection() === 'ltr' ? 'right' : 'left'));
|
||||
|
||||
addRowEnter
|
||||
.append('div')
|
||||
|
||||
@@ -15,9 +15,9 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
|
||||
var section = uiSection(id, context)
|
||||
.classes('raw-tag-editor')
|
||||
.title(function() {
|
||||
.label(function() {
|
||||
var count = Object.keys(_tags).filter(function(d) { return d; }).length;
|
||||
return t('inspector.title_count', { title: t('inspector.tags'), count: count });
|
||||
return t('inspector.title_count', { title: t.html('inspector.tags'), count: count });
|
||||
})
|
||||
.expandedByDefault(false)
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
@@ -25,8 +25,8 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
var taginfo = services.taginfo;
|
||||
var dispatch = d3_dispatch('change');
|
||||
var availableViews = [
|
||||
{ id: 'text', icon: '#fas-i-cursor' },
|
||||
{ id: 'list', icon: '#fas-th-list' }
|
||||
{ id: 'list', icon: '#fas-th-list' },
|
||||
{ id: 'text', icon: '#fas-i-cursor' }
|
||||
];
|
||||
|
||||
var _tagView = (prefs('raw-tag-editor-view') || 'list'); // 'list, 'text'
|
||||
@@ -39,6 +39,11 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
var _presets;
|
||||
var _tags;
|
||||
var _entityIDs;
|
||||
var _didInteract = false;
|
||||
|
||||
function interacted() {
|
||||
_didInteract = true;
|
||||
}
|
||||
|
||||
function renderDisclosureContent(wrap) {
|
||||
|
||||
@@ -127,6 +132,7 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
.call(utilGetSetValue, textData)
|
||||
.each(setTextareaHeight)
|
||||
.on('input', setTextareaHeight)
|
||||
.on('focus', interacted)
|
||||
.on('blur', textChanged)
|
||||
.on('change', textChanged);
|
||||
|
||||
@@ -188,6 +194,7 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
.property('type', 'text')
|
||||
.attr('class', 'key')
|
||||
.call(utilNoAuto)
|
||||
.on('focus', interacted)
|
||||
.on('blur', keyChange)
|
||||
.on('change', keyChange);
|
||||
|
||||
@@ -198,13 +205,13 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
.property('type', 'text')
|
||||
.attr('class', 'value')
|
||||
.call(utilNoAuto)
|
||||
.on('focus', interacted)
|
||||
.on('blur', valueChange)
|
||||
.on('change', valueChange)
|
||||
.on('keydown.push-more', pushMore);
|
||||
|
||||
innerWrap
|
||||
.append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', 'form-field-button remove')
|
||||
.attr('title', t('icons.remove'))
|
||||
.call(svgIcon('#iD-operation-delete'));
|
||||
@@ -225,20 +232,11 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
bindTypeahead(key, value);
|
||||
}
|
||||
|
||||
var reference;
|
||||
|
||||
if (typeof d.value !== 'string') {
|
||||
reference = uiTagReference({ key: d.key }, context);
|
||||
} else {
|
||||
var isRelation = _entityIDs && _entityIDs.some(function(entityID) {
|
||||
return context.entity(entityID).type === 'relation';
|
||||
});
|
||||
if (isRelation && d.key === 'type') {
|
||||
reference = uiTagReference({ rtype: d.value }, context);
|
||||
} else {
|
||||
reference = uiTagReference({ key: d.key, value: d.value }, context);
|
||||
}
|
||||
var referenceOptions = { key: d.key };
|
||||
if (typeof d.value === 'string') {
|
||||
referenceOptions.value = d.value;
|
||||
}
|
||||
var reference = uiTagReference(referenceOptions, context);
|
||||
|
||||
if (_state === 'hover') {
|
||||
reference.showing(false);
|
||||
@@ -294,8 +292,11 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
if (_tagView !== 'text') return;
|
||||
|
||||
var selection = d3_select(this);
|
||||
selection.style('height', null);
|
||||
selection.style('height', selection.node().scrollHeight + 5 + 'px');
|
||||
var matches = selection.node().value.match(/\n/g);
|
||||
var lineCount = 2 + Number(matches && matches.length);
|
||||
var lineHeight = 20;
|
||||
|
||||
selection.style('height', lineCount * lineHeight + 'px');
|
||||
}
|
||||
|
||||
function stringify(s) {
|
||||
@@ -582,7 +583,9 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
_presets = val;
|
||||
if (_presets && _presets.length && _presets[0].isFallback()) {
|
||||
section.disclosureExpanded(true);
|
||||
} else {
|
||||
|
||||
// don't collapse the disclosure if the mapper used the raw tag editor - #1881
|
||||
} else if (!_didInteract) {
|
||||
section.disclosureExpanded(null);
|
||||
}
|
||||
return section;
|
||||
|
||||
@@ -16,8 +16,8 @@ export function uiSectionSelectionList(context) {
|
||||
.shouldDisplay(function() {
|
||||
return _selectedIDs.length > 1;
|
||||
})
|
||||
.title(function() {
|
||||
return t('inspector.title_count', { title: t('inspector.features'), count: _selectedIDs.length });
|
||||
.label(function() {
|
||||
return t('inspector.title_count', { title: t.html('inspector.features'), count: _selectedIDs.length });
|
||||
})
|
||||
.disclosureContent(renderDisclosureContent);
|
||||
|
||||
@@ -71,7 +71,7 @@ export function uiSectionSelectionList(context) {
|
||||
|
||||
// Enter
|
||||
var enter = items.enter()
|
||||
.append('div')
|
||||
.append('button')
|
||||
.attr('class', 'feature-list-item')
|
||||
.on('click', selectEntity);
|
||||
|
||||
@@ -86,7 +86,7 @@ export function uiSectionSelectionList(context) {
|
||||
});
|
||||
|
||||
var label = enter
|
||||
.append('button')
|
||||
.append('div')
|
||||
.attr('class', 'label');
|
||||
|
||||
enter
|
||||
@@ -119,10 +119,10 @@ export function uiSectionSelectionList(context) {
|
||||
});
|
||||
|
||||
items.selectAll('.entity-type')
|
||||
.text(function(entity) { return presetManager.match(entity, context.graph()).name(); });
|
||||
.html(function(entity) { return presetManager.match(entity, context.graph()).name(); });
|
||||
|
||||
items.selectAll('.entity-name')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
// fetch latest entity
|
||||
var entity = context.entity(d.id);
|
||||
return utilDisplayName(entity);
|
||||
|
||||
@@ -16,10 +16,10 @@ export function uiSectionValidationIssues(id, severity, context) {
|
||||
var _issues = [];
|
||||
|
||||
var section = uiSection(id, context)
|
||||
.title(function() {
|
||||
.label(function() {
|
||||
if (!_issues) return '';
|
||||
var issueCountText = _issues.length > 1000 ? '1000+' : String(_issues.length);
|
||||
return t('issues.' + severity + 's.list_title', { count: issueCountText });
|
||||
return t('inspector.title_count', { title: t.html('issues.' + severity + 's.list_title'), count: issueCountText });
|
||||
})
|
||||
.disclosureContent(renderDisclosureContent)
|
||||
.shouldDisplay(function() {
|
||||
@@ -147,7 +147,7 @@ export function uiSectionValidationIssues(id, severity, context) {
|
||||
.order();
|
||||
|
||||
items.selectAll('.issue-message')
|
||||
.text(function(d) {
|
||||
.html(function(d) {
|
||||
return d.message(context);
|
||||
});
|
||||
|
||||
@@ -175,7 +175,7 @@ export function uiSectionValidationIssues(id, severity, context) {
|
||||
linkEnter
|
||||
.append('span')
|
||||
.attr('class', 'autofix-all-link-text')
|
||||
.text(t('issues.fix_all.title'));
|
||||
.html(t.html('issues.fix_all.title'));
|
||||
|
||||
linkEnter
|
||||
.append('span')
|
||||
|
||||
@@ -36,7 +36,7 @@ export function uiSectionValidationOptions(context) {
|
||||
optionsEnter
|
||||
.append('div')
|
||||
.attr('class', 'issues-option-title')
|
||||
.text(function(d) { return t('issues.options.' + d.key + '.title'); });
|
||||
.html(function(d) { return t.html('issues.options.' + d.key + '.title'); });
|
||||
|
||||
var valuesEnter = optionsEnter.selectAll('label')
|
||||
.data(function(d) {
|
||||
@@ -55,7 +55,7 @@ export function uiSectionValidationOptions(context) {
|
||||
|
||||
valuesEnter
|
||||
.append('span')
|
||||
.text(function(d) { return t('issues.options.' + d.key + '.' + d.value); });
|
||||
.html(function(d) { return t.html('issues.options.' + d.key + '.' + d.value); });
|
||||
}
|
||||
|
||||
function getOptions() {
|
||||
|
||||
@@ -17,7 +17,7 @@ export function uiSectionValidationRules(context) {
|
||||
|
||||
var section = uiSection('issues-rules', context)
|
||||
.disclosureContent(renderDisclosureContent)
|
||||
.title(t('issues.rules.title'));
|
||||
.label(t.html('issues.rules.title'));
|
||||
|
||||
var _ruleKeys = context.validator().getRuleKeys()
|
||||
.filter(function(key) { return key !== 'maprules'; })
|
||||
@@ -46,18 +46,18 @@ export function uiSectionValidationRules(context) {
|
||||
.append('a')
|
||||
.attr('class', 'issue-rules-link')
|
||||
.attr('href', '#')
|
||||
.text(t('issues.enable_all'))
|
||||
.html(t.html('issues.disable_all'))
|
||||
.on('click', function() {
|
||||
context.validator().disableRules([]);
|
||||
context.validator().disableRules(_ruleKeys);
|
||||
});
|
||||
|
||||
ruleLinks
|
||||
.append('a')
|
||||
.attr('class', 'issue-rules-link')
|
||||
.attr('href', '#')
|
||||
.text(t('issues.disable_all'))
|
||||
.html(t.html('issues.enable_all'))
|
||||
.on('click', function() {
|
||||
context.validator().disableRules(_ruleKeys);
|
||||
context.validator().disableRules([]);
|
||||
});
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ export function uiSectionValidationRules(context) {
|
||||
if (name === 'rule') {
|
||||
enter
|
||||
.call(uiTooltip()
|
||||
.title(function(d) { return t('issues.' + d + '.tip'); })
|
||||
.title(function(d) { return t.html('issues.' + d + '.tip'); })
|
||||
.placement('top')
|
||||
);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export function uiSectionValidationRules(context) {
|
||||
if (d === 'unsquare_way') {
|
||||
params.val = '<span class="square-degrees"></span>';
|
||||
}
|
||||
return t('issues.' + d + '.title', params);
|
||||
return t.html('issues.' + d + '.title', params);
|
||||
});
|
||||
|
||||
// Update
|
||||
@@ -144,7 +144,7 @@ export function uiSectionValidationRules(context) {
|
||||
this.select();
|
||||
})
|
||||
.on('keyup', function () {
|
||||
if (d3_event.keyCode === 13) { // enter
|
||||
if (d3_event.keyCode === 13) { // ↩ Return
|
||||
this.blur();
|
||||
this.select();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ export function uiSectionValidationStatus(context) {
|
||||
.merge(resetIgnoredEnter);
|
||||
|
||||
resetIgnored.select('a')
|
||||
.text(t('issues.reset_ignored', { count: ignoredIssues.length.toString() }));
|
||||
.html(t('inspector.title_count', { title: t.html('issues.reset_ignored'), count: ignoredIssues.length }));
|
||||
|
||||
resetIgnored.on('click', function() {
|
||||
context.validator().resetIgnoredIssues();
|
||||
@@ -95,7 +95,7 @@ export function uiSectionValidationStatus(context) {
|
||||
var hiddenIssues = context.validator().getIssues(hiddenOpts);
|
||||
if (hiddenIssues.length) {
|
||||
selection.select('.box .details')
|
||||
.text(t(
|
||||
.html(t.html(
|
||||
'issues.no_issues.hidden_issues.' + type,
|
||||
{ count: hiddenIssues.length.toString() }
|
||||
));
|
||||
@@ -103,7 +103,7 @@ export function uiSectionValidationStatus(context) {
|
||||
}
|
||||
}
|
||||
selection.select('.box .details')
|
||||
.text(t('issues.no_issues.hidden_issues.none'));
|
||||
.html(t.html('issues.no_issues.hidden_issues.none'));
|
||||
}
|
||||
|
||||
var messageType;
|
||||
@@ -158,7 +158,7 @@ export function uiSectionValidationStatus(context) {
|
||||
}
|
||||
|
||||
selection.select('.box .message')
|
||||
.text(t('issues.no_issues.message.' + messageType));
|
||||
.html(t.html('issues.no_issues.message.' + messageType));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user