@searpent/react-image-annotate 2.0.62 → 2.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,6 @@ import clamp from "clamp";
15
15
  import getLandmarksWithTransform from "../../utils/get-landmarks-with-transform";
16
16
  import setInLocalStorage from "../../utils/set-in-local-storage";
17
17
  import onlyUnique from "../../utils/filter-only-unique";
18
- import regionsGroups from '../../utils/regions-groups';
19
18
  import nextGroupId from "../../utils/next-group-id";
20
19
  import defaultLockedUntil from "../../utils/default-locked-until";
21
20
 
@@ -23,7 +23,7 @@ var GroupItemDiv = styled("div")(function (_ref) {
23
23
 
24
24
  var GroupItem = function GroupItem(_ref2) {
25
25
  var group = _ref2.group;
26
- return React.createElement(GroupItemDiv, null, uuidToHash(group));
26
+ return React.createElement(GroupItemDiv, null, uuidToHash(group.id));
27
27
  };
28
28
 
29
29
  var GroupList = function GroupList(_ref3) {
@@ -46,8 +46,8 @@ export var RegionLabel = function RegionLabel(_ref) {
46
46
  if (hideNotEditingLabel && !editing) return null;
47
47
  var allowedGroupsForSelect = allowedGroups ? allowedGroups.map(function (g) {
48
48
  return {
49
- value: "".concat(g),
50
- label: uuidToHash(g)
49
+ value: "".concat(g.id),
50
+ label: g.label || uuidToHash(g.id)
51
51
  };
52
52
  }) : [];
53
53
  return React.createElement(ThemeProvider, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searpent/react-image-annotate",
3
- "version": "2.0.62",
3
+ "version": "2.0.64",
4
4
  "dependencies": {
5
5
  "@editorjs/editorjs": "^2.25.0",
6
6
  "@editorjs/paragraph": "^2.8.0",
@@ -29,7 +29,7 @@ function blocksToArticle(blocks) {
29
29
  acc[labelName] = "";
30
30
  }
31
31
 
32
- var connectingSymbol = ""; // if last symbol is dot, next sentence should start with space
32
+ var connectingSymbol = labelName === 'text' ? "" : "<br>"; // if last symbol is dot, next sentence should start with space
33
33
 
34
34
  if (acc[labelName].charAt(acc[labelName].length - 1) === ".") {
35
35
  connectingSymbol = " ";
@@ -1,17 +1,24 @@
1
+ var MAX_GROUP_LENGTH = 20;
2
+
1
3
  function regionsGroups(regions) {
2
4
  if (!regions) {
3
5
  return [];
4
6
  }
5
7
 
6
- var groups = regions.reduce(function (prev, curr) {
8
+ var groups = regions.reduce(function (acc, curr) {
7
9
  var groupId = curr.groupId;
8
10
 
9
- if (prev.includes(groupId)) {
10
- return prev;
11
+ if (acc.some(function (e) {
12
+ return e.id === groupId;
13
+ })) {
14
+ return acc;
11
15
  }
12
16
 
13
- prev.push(groupId);
14
- return prev;
17
+ acc.push({
18
+ id: groupId,
19
+ label: curr.text.substring(0, MAX_GROUP_LENGTH)
20
+ });
21
+ return acc;
15
22
  }, []);
16
23
  return groups;
17
24
  }