Hi All,
I am creating Article, In which I am creation custom component Section. In which Every Section has Title and Description.
I need Version Difference functionality for this.
I added <cq:text> tag but only Text Added is coming. Text Removed is not coming.
I tried with DiffInfo and DiffService code also, but in the Value Map I am not getting values. I am getting values {jcr:frozenUuid, sling:resourceType, jcr:uuid, jcr:frozenPrimaryType, jcr:primaryType. So my DiffText is coming Empty. Below is the code which I am using inside my Sections.jsp. Also Headline is Variable which is giving me Section Title corresponidng to Section .
String diffOutput = null;
DiffInfo diffInfo = resource.adaptTo(DiffInfo.class);
if (diffInfo != null) {
DiffService diffService = sling.getService(DiffService.class);
ValueMap map = ResourceUtil.getValueMap(diffInfo.getContent());
String diffText = map.get("title", "");
}
diffOutput = diffService.diff(headLine, diffText, false);
if (headLine.equals(diffOutput)) {
diffOutput = null;
}
}
if (diffOutput != null) {
headLine = diffOutput;
}
Also I am creating section like section 1, 2. so each section has its Title and Description.
So since DiffText is coming empty and also adding <cq:text> is giving only text added, so is this mean I am creating components in a wrong way. If yes then how should I create components. My requirement is to have Version Difference Functionality for my article. please suggest me about way I should go.
Thanks