diff --git a/components/IdentifyViewer.jsx b/components/IdentifyViewer.jsx index 5438ad67a..1e898856f 100644 --- a/components/IdentifyViewer.jsx +++ b/components/IdentifyViewer.jsx @@ -314,7 +314,7 @@ class IdentifyViewer extends React.Component { this.export({[layer]: [result]}); }; export = (json, clipboard = false) => { - const exporter = [...BuiltinExporters, ...this.props.customExporters].find(entry => entry.id === this.state.exportFormat); + const exporter = this.getExporters().find(entry => entry.id === this.state.exportFormat); if (exporter) { if (!this.props.exportGeometry) { json = Object.entries(json).reduce((res, [layerId, features]) => ( @@ -422,9 +422,7 @@ class IdentifyViewer extends React.Component { ); }); } - if (this.props.attributeCalculator) { - rows = rows.concat(this.props.attributeCalculator(layer, result)); - } + rows.push(...this.computeExtraAttributes(layer, result)); if (featureReportTemplate) { rows = rows.concat(
@@ -528,7 +526,8 @@ class IdentifyViewer extends React.Component {
);
}
// "el.style.background='inherit'": HACK to trigger an additional repaint, since Safari/Chrome on iOS render the element cut off the first time
- const clipboardExportDisabled = ([...BuiltinExporters, ...this.props.customExporters].find(entry => entry.id === this.state.exportFormat) || {}).allowClipboard !== true;
+ const exporters = this.getExporters();
+ const clipboardExportDisabled = exporters.find(entry => entry.id === this.state.exportFormat)?.allowClipboard !== true;
return (
{ if (el) el.style.background = 'inherit'; } }>
{body}
@@ -537,12 +536,7 @@ class IdentifyViewer extends React.Component {
{LocaleUtils.tr("identify.exportformat")}
);
}
+ computeExtraAttributes = (layer, result) => {
+ const rows = [];
+ Object.values(window.qwc2.__attributeCalculators || {}).forEach((calc, idx) => {
+ const row = calc(layer, result);
+ if (row.length === 2) {
+ rows.push((
+ | |
{row[0]} | +{row[1]} | +
{row[0]} | +