Add jsonDiff to difference component
This commit is contained in:
@@ -207,7 +207,8 @@ module.exports = {
|
|||||||
...result.difference,
|
...result.difference,
|
||||||
{
|
{
|
||||||
admin_user: result.updatedBy.id,
|
admin_user: result.updatedBy.id,
|
||||||
paroles: state.diff,
|
paroles: state.diff.path,
|
||||||
|
jsonDiff: state.diff.jsonDiff,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
sources: 'transcription'
|
sources: 'transcription'
|
||||||
}]
|
}]
|
||||||
|
|||||||
@@ -72,7 +72,12 @@ module.exports = createCoreService('api::parole.parole', ({strapi}) => ({
|
|||||||
const parsePatch = Diff.parsePatch(patch)
|
const parsePatch = Diff.parsePatch(patch)
|
||||||
|
|
||||||
if (parsePatch[0].hunks.length > 0) {
|
if (parsePatch[0].hunks.length > 0) {
|
||||||
return patch
|
const jsonDiff = Diff.diffWords(oldString, newString)
|
||||||
|
|
||||||
|
return {
|
||||||
|
patch,
|
||||||
|
jsonDiff
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
"type": "relation",
|
"type": "relation",
|
||||||
"relation": "oneToOne",
|
"relation": "oneToOne",
|
||||||
"target": "admin::user"
|
"target": "admin::user"
|
||||||
|
},
|
||||||
|
"jsonDiff": {
|
||||||
|
"type": "json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user