@searpent/react-image-annotate 2.0.70 → 2.0.72
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.
|
@@ -1181,8 +1181,8 @@ export default (function (state, action) {
|
|
|
1181
1181
|
var name = action.name,
|
|
1182
1182
|
value = action.value,
|
|
1183
1183
|
_imageIndex = action.imageIndex,
|
|
1184
|
-
_groupId2 = action.groupId
|
|
1185
|
-
|
|
1184
|
+
_groupId2 = action.groupId,
|
|
1185
|
+
metadataId = action.metadataId;
|
|
1186
1186
|
|
|
1187
1187
|
if (isNaN(_imageIndex)) {
|
|
1188
1188
|
var _state$albumMetadata;
|
|
@@ -1221,7 +1221,7 @@ export default (function (state, action) {
|
|
|
1221
1221
|
var articleRegionToUpdate = (_state$images$_imageI2 = state.images[_imageIndex]) === null || _state$images$_imageI2 === void 0 ? void 0 : _state$images$_imageI2.regions[articleMetadataRegionIdx];
|
|
1222
1222
|
var articleMetadata = JSON.parse(articleRegionToUpdate.text);
|
|
1223
1223
|
var toBeUpdatedMetadataIdx = articleMetadata.findIndex(function (i) {
|
|
1224
|
-
return i.
|
|
1224
|
+
return i.metadataId === metadataId;
|
|
1225
1225
|
});
|
|
1226
1226
|
|
|
1227
1227
|
if (toBeUpdatedMetadataIdx < 0) {
|
|
@@ -13,10 +13,14 @@ var MetadataItemDiv = styled("div")(function (_ref) {
|
|
|
13
13
|
"& > label": {
|
|
14
14
|
fontSize: "1rem",
|
|
15
15
|
marginBottom: ".5em",
|
|
16
|
-
textTransform: "capitalize"
|
|
16
|
+
textTransform: "capitalize",
|
|
17
|
+
wordWrap: "break-word"
|
|
17
18
|
},
|
|
18
19
|
label: {
|
|
19
20
|
width: "50%"
|
|
21
|
+
},
|
|
22
|
+
select: {
|
|
23
|
+
width: "100%"
|
|
20
24
|
}
|
|
21
25
|
};
|
|
22
26
|
});
|
|
@@ -26,6 +30,7 @@ var MetadataItem = function MetadataItem(_ref2) {
|
|
|
26
30
|
|
|
27
31
|
var name = _ref2.name,
|
|
28
32
|
value = _ref2.value,
|
|
33
|
+
metadataId = _ref2.metadataId,
|
|
29
34
|
imageIndex = _ref2.imageIndex,
|
|
30
35
|
groupId = _ref2.groupId,
|
|
31
36
|
onChange = _ref2.onChange,
|
|
@@ -37,27 +42,31 @@ var MetadataItem = function MetadataItem(_ref2) {
|
|
|
37
42
|
var _e$target = e.target,
|
|
38
43
|
name = _e$target.name,
|
|
39
44
|
value = _e$target.value;
|
|
40
|
-
console.log("onChange", {
|
|
41
|
-
name: name,
|
|
42
|
-
value: value
|
|
43
|
-
});
|
|
44
45
|
onChange({
|
|
45
46
|
name: name,
|
|
46
47
|
value: value,
|
|
47
48
|
imageIndex: imageIndex,
|
|
48
|
-
groupId: groupId
|
|
49
|
+
groupId: groupId,
|
|
50
|
+
metadataId: metadataId
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
return React.createElement(MetadataItemDiv, null, React.createElement("label", {
|
|
53
55
|
for: name
|
|
54
|
-
}, name), React.createElement("div",
|
|
56
|
+
}, name), React.createElement("div", {
|
|
57
|
+
style: {
|
|
58
|
+
width: "50%"
|
|
59
|
+
}
|
|
60
|
+
}, (metadataConfig === null || metadataConfig === void 0 ? void 0 : metadataConfig.selectable) !== true && React.createElement(React.Fragment, null, React.createElement("input", {
|
|
55
61
|
type: "text",
|
|
56
62
|
value: value,
|
|
57
63
|
name: name,
|
|
58
64
|
onChange: handleChange,
|
|
59
65
|
id: name,
|
|
60
|
-
list: "".concat(name, "-list")
|
|
66
|
+
list: "".concat(name, "-list"),
|
|
67
|
+
style: {
|
|
68
|
+
width: "100%"
|
|
69
|
+
}
|
|
61
70
|
}), React.createElement("datalist", {
|
|
62
71
|
id: "".concat(name, "-list")
|
|
63
72
|
}, metadataConfig === null || metadataConfig === void 0 ? void 0 : (_metadataConfig$optio = metadataConfig.options) === null || _metadataConfig$optio === void 0 ? void 0 : _metadataConfig$optio.map(function (opt) {
|
|
@@ -75,7 +84,10 @@ var MetadataItem = function MetadataItem(_ref2) {
|
|
|
75
84
|
}))), (metadataConfig === null || metadataConfig === void 0 ? void 0 : metadataConfig.selectable) === true && React.createElement("select", {
|
|
76
85
|
name: name,
|
|
77
86
|
id: name,
|
|
78
|
-
onChange: handleChange
|
|
87
|
+
onChange: handleChange,
|
|
88
|
+
style: {
|
|
89
|
+
width: '100%'
|
|
90
|
+
}
|
|
79
91
|
}, metadataConfig === null || metadataConfig === void 0 ? void 0 : (_metadataConfig$optio2 = metadataConfig.options) === null || _metadataConfig$optio2 === void 0 ? void 0 : _metadataConfig$optio2.map(function (opt) {
|
|
80
92
|
if (opt.value && opt.label) {
|
|
81
93
|
return React.createElement("option", {
|
|
@@ -102,11 +114,13 @@ var MetadataList = function MetadataList(_ref3) {
|
|
|
102
114
|
groupId = _ref3.groupId;
|
|
103
115
|
return React.createElement("div", null, React.createElement("h2", null, title), metadata && metadata.map(function (_ref4) {
|
|
104
116
|
var key = _ref4.key,
|
|
105
|
-
value = _ref4.value
|
|
117
|
+
value = _ref4.value,
|
|
118
|
+
metadataId = _ref4.metadataId;
|
|
106
119
|
return React.createElement(MetadataItem, {
|
|
107
120
|
name: key,
|
|
108
121
|
value: value,
|
|
109
122
|
imageIndex: imageIndex,
|
|
123
|
+
metadataId: metadataId,
|
|
110
124
|
groupId: groupId,
|
|
111
125
|
onChange: onMetadataChange,
|
|
112
126
|
metadataConfig: metadataConfigs.find(function (i) {
|
|
@@ -160,7 +174,7 @@ export var MetadataEditorSidebarBox = function MetadataEditorSidebarBox(_ref6) {
|
|
|
160
174
|
var selectedGroupId = state === null || state === void 0 ? void 0 : (_state$images$state$s2 = state.images[state.selectedImage]) === null || _state$images$state$s2 === void 0 ? void 0 : (_state$images$state$s3 = _state$images$state$s2.regions) === null || _state$images$state$s3 === void 0 ? void 0 : (_state$images$state$s4 = _state$images$state$s3.find(function (r) {
|
|
161
175
|
return r.highlighted === true;
|
|
162
176
|
})) === null || _state$images$state$s4 === void 0 ? void 0 : _state$images$state$s4.groupId;
|
|
163
|
-
var articleMetadata = [];
|
|
177
|
+
var articleMetadata = []; // example: [{key: "previousArticleId", value "123-123-123-123-123"}]
|
|
164
178
|
|
|
165
179
|
if (selectedGroupId !== undefined) {
|
|
166
180
|
var articleMetadataRegion = state === null || state === void 0 ? void 0 : state.images[state.selectedImage].regions.find(function (r) {
|