TagSpaces is an offline, open source, document manager with tagging support
fix openlocationcode integration
Ilian Sapundshiev17fe8c179a59
diff --git a/app/components/Search.tsx b/app/components/Search.tsxindex 9e7c269c7..a9ec98860 100644--- a/app/components/Search.tsx+++ b/app/components/Search.tsx@@ -47,6 +47,7 @@ import IconButton from '@material-ui/core/IconButton';import Select from '@material-ui/core/Select';import FormControl from '@material-ui/core/FormControl';import MoreVertIcon from '@material-ui/icons/MoreVert';+import OpenLocationCode from 'open-location-code-typescript';import TagsSelect from './TagsSelect';import CustomLogo from './CustomLogo';import { actions as AppActions, getDirectoryPath } from '../reducers/app';@@ -62,7 +63,6 @@ import { FileTypeGroups, SearchQuery } from '../services/search';import { Pro } from '../pro';import SearchMenu from './menus/SearchMenu';import { Tag } from '../reducers/taglibrary';-// import openlocationcode from '../utils/openlocationcode';import { formatDateTime, extractTimePeriod } from '../utils/dates';import { isPlusCode, parseLatLon } from '../utils/misc';import PlatformIO from '../services/platform-io';@@ -102,7 +102,7 @@ interface State {searchMenuAnchorEl: Element | null;}-const olc = {}; // new openlocationcode();+// const olc = new openlocationcode();class Search extends React.Component<Props, State> {// @ts-ignore@@ -180,9 +180,9 @@ class Search extends React.Component<Props, State> {let tagPlaceHelper;if (isPlusCode(value)) {- // const coord = olc.decode(value);- // lat = Number(coord.latitudeCenter.toFixed(7));- // lon = Number(coord.longitudeCenter.toFixed(7));+ const coord = OpenLocationCode.decode(value);+ lat = Number(coord.latitudeCenter.toFixed(7));+ lon = Number(coord.longitudeCenter.toFixed(7));} else {const latLon = parseLatLon(value);if (latLon) {diff --git a/package.json b/package.jsonindex f0db35ba7..d51c293ae 100644--- a/package.json+++ b/package.json@@ -250,6 +250,7 @@"marked": "^0.6.1","memoize-one": "^5.0.0","open-location-code": "^1.0.3",+ "open-location-code-typescript": "^1.4.0","path": "^0.12.7","pdfjs-dist": "^2.0.943","rc-table": "^6.4.0",diff --git a/yarn.lock b/yarn.lockindex e3b318c13..7c98e3485 100644--- a/yarn.lock+++ b/yarn.lock@@ -12268,6 +12268,11 @@ onetime@^5.1.0:dependencies:mimic-fn "^2.1.0"+open-location-code-typescript@^1.4.0:+ version "1.4.0"+ resolved "https://registry.yarnpkg.com/open-location-code-typescript/-/open-location-code-typescript-1.4.0.tgz#509f51e7e02799b954ffb00be6f425167f5b0c66"+ integrity sha512-k5qeLR3NiEXHCy8BjqazbfvOJbIlnTiBN+JkHAJHROuSVTD4c1I+wFRw3aZet1FxksoWuo7z6MXb6Ei21NLY8g==+open-location-code@^1.0.3:version "1.0.3"resolved "https://registry.yarnpkg.com/open-location-code/-/open-location-code-1.0.3.tgz#5ea1a34ee5221c6cafa04392e1bd906fd7488f7e"