diff --git a/src/LexSetup.tsx b/src/LexSetup.tsx
index 6f4ed6d..002ec47 100644
--- a/src/LexSetup.tsx
+++ b/src/LexSetup.tsx
@@ -183,7 +183,15 @@ const fieldMetaMap = {
_.negate(_.isEqual)
))
},
-
+ groups: {
+ type: 'list',
+ ...listAttrAccessor(attrPredGen(
+ 'groups[0].property',
+ 'id',
+ 'frame',
+ _.negate(_.isEqual)
+ ))
+ },
};
const xmlToEntries = (xmlData: any) => {
diff --git a/src/LexSingleInput.tsx b/src/LexSingleInput.tsx
index b0b6118..4b047ce 100644
--- a/src/LexSingleInput.tsx
+++ b/src/LexSingleInput.tsx
@@ -86,7 +86,7 @@ function imagePreview(params: any) {
let imageSrc = '/png/' + value;
return value !== '' ? (
-
+
) : textInput(params);
}
diff --git a/src/reducers.tsx b/src/reducers.tsx
index 7e47950..9cc89c5 100644
--- a/src/reducers.tsx
+++ b/src/reducers.tsx
@@ -20,17 +20,15 @@ function updateXMLState(state: any = {}, action: any) {
return action.xmlData;
}
if (action.type === 'ACTION_SAVE_LEXITEM') {
- // debugger;
- // let guid = action.lexSelector.guid.get(action.lexItem);
- // let lang = action.lexSelector.lang.get(action.lexItem);
- // // action.lexItem;
- // _.findIndex(_.get(state,'document.lexicon[0].item'),(o)=>{
- // return _.isEqual(_.get(o,'$.guid'),guid) && _.isEqual(_.get(o,'entry[0].lang'),lang)
- // });
- _.noop();
- return {
- ...state
- };
+ let newState = _.cloneDeep(state);
+ let guid = action.lexSelector.guid.get(action.lexItem);
+ let lang = action.lexSelector.lang.get(action.lexItem);
+ let entries = _.get(newState, 'document.lexicon[0].item');
+ let entGuid = _.find(entries, (o) => _.isEqual(_.get(o, '$.guid'), guid));
+ let entLang = _.get(entGuid, 'entry');
+ let entlang = _.find(entLang, (o) => _.isEqual(_.get(o, 'lang[0].$.id'), lang));
+ _.set(entlang, 'lang[0]', action.lexItem);
+ return newState;
}
return state;
}