mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
Consolidate localization behavior and init to a coreLocalizer function and singleton Explicitly support `en-US` locale Rename coreData to coreFileFetcher and export a singleton rather than using a property of coreContext Add `apiConnections` property of coreContext to simplify adding a source switcher Replace some init functions with re-callable, promise-supporting `ensureLoaded` functions Make coreContext itself load the UI if a container has been specified at init time Fix code tests
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
import { t } from '../core/localizer';
|
|
import { services } from '../services';
|
|
import { svgIcon } from '../svg/icon';
|
|
import { QAItem } from '../osm';
|
|
|
|
export function uiViewOnKeepRight() {
|
|
let _qaItem;
|
|
|
|
function viewOnKeepRight(selection) {
|
|
let url;
|
|
if (services.keepRight && (_qaItem instanceof QAItem)) {
|
|
url = services.keepRight.issueURL(_qaItem);
|
|
}
|
|
|
|
const link = selection.selectAll('.view-on-keepRight')
|
|
.data(url ? [url] : []);
|
|
|
|
// exit
|
|
link.exit()
|
|
.remove();
|
|
|
|
// enter
|
|
const linkEnter = link.enter()
|
|
.append('a')
|
|
.attr('class', 'view-on-keepRight')
|
|
.attr('target', '_blank')
|
|
.attr('rel', 'noopener') // security measure
|
|
.attr('href', d => d)
|
|
.call(svgIcon('#iD-icon-out-link', 'inline'));
|
|
|
|
linkEnter
|
|
.append('span')
|
|
.text(t('inspector.view_on_keepRight'));
|
|
}
|
|
|
|
viewOnKeepRight.what = function(val) {
|
|
if (!arguments.length) return _qaItem;
|
|
_qaItem = val;
|
|
return viewOnKeepRight;
|
|
};
|
|
|
|
return viewOnKeepRight;
|
|
}
|