Revize f260dac8
Přidáno uživatelem Vojtěch Bartička před téměř 3 roky(ů)
Backend/Core/Services/AnnotationService/AnnotationServiceEF.cs | ||
---|---|---|
224 | 224 |
{ |
225 | 225 |
if (annotation.ModifiedType == EModified.ADDED) |
226 | 226 |
{ |
227 |
var lastModifiedTag = context.AnnotationTags.Where(at => at.Id == annotation.LastModifiedTagId).First(); |
|
227 |
|
|
228 |
AnnotationTagGeneric lastModifiedTag = isFinal ? context.FinalAnnotationTags.Where(at => at.Id == annotation.LastModifiedTagId).First() : |
|
229 |
context.AnnotationTags.Where(at => at.Id == annotation.LastModifiedTagId).First(); |
|
230 |
|
|
228 | 231 |
var result = htmlService.PartialPreprocessHTMLAddTag(docToRender, documentContent.Content, lastModifiedTag, tags, cachedInfoToReturn); |
229 | 232 |
docToRender = result.Item1; |
230 | 233 |
cachedInfoToReturn = result.Item2; |
... | ... | |
315 | 318 |
Length = request.Length, |
316 | 319 |
Position = request.Position, |
317 | 320 |
SelectedText = request.SelectedText, |
318 |
Note = "" |
|
321 |
Note = "", |
|
322 |
IsFinal = true |
|
319 | 323 |
}; |
320 | 324 |
} |
321 | 325 |
else |
... | ... | |
754 | 758 |
|
755 | 759 |
return true; |
756 | 760 |
} |
761 |
|
|
762 |
public void SetTagIsFinal(Guid annotationId, Guid occurenceId, bool isFinal) |
|
763 |
{ |
|
764 |
Annotation annotation; |
|
765 |
try |
|
766 |
{ |
|
767 |
annotation = context.FinalAnnotations.Single(fa => fa.Id == annotationId); |
|
768 |
} |
|
769 |
catch (Exception) |
|
770 |
{ |
|
771 |
throw new InvalidOperationException("Annotation not found"); |
|
772 |
} |
|
773 |
|
|
774 |
FinalAnnotationTag finalTagInstance; |
|
775 |
try |
|
776 |
{ |
|
777 |
finalTagInstance = context.FinalAnnotationTags.Single(fat => fat.Id == occurenceId); |
|
778 |
} |
|
779 |
catch (Exception) |
|
780 |
{ |
|
781 |
throw new InvalidOperationException("Tag instance not found"); |
|
782 |
} |
|
783 |
|
|
784 |
finalTagInstance.IsFinal = isFinal; |
|
785 |
|
|
786 |
context.SaveChanges(); |
|
787 |
} |
|
757 | 788 |
} |
758 | 789 |
} |
Backend/Core/Services/HTMLService/HTMLService.cs | ||
---|---|---|
452 | 452 |
* Partial HTML Preprocessing ---------------------------------------------------------------------------- |
453 | 453 |
*/ |
454 | 454 |
|
455 |
public (string, CachedInfo) PartialPreprocessHTMLAddTag(string htmlToEdit, string htmlOriginal, AnnotationTag tagToAdd, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo) |
|
455 |
public (string, CachedInfo) PartialPreprocessHTMLAddTag(string htmlToEdit, string htmlOriginal, AnnotationTagGeneric tagToAdd, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo)
|
|
456 | 456 |
{ |
457 | 457 |
UnpackCachedInfo(cachedInfo); |
458 | 458 |
|
... | ... | |
524 | 524 |
} |
525 | 525 |
|
526 | 526 |
|
527 |
public (string, CachedInfo) PartialPreprocessHTMLRemoveTag(string htmlToEdit, string htmlOriginal, AnnotationTag tagToRemove, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo) |
|
527 |
public (string, CachedInfo) PartialPreprocessHTMLRemoveTag(string htmlToEdit, string htmlOriginal, AnnotationTagGeneric tagToRemove, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo)
|
|
528 | 528 |
{ |
529 | 529 |
UnpackCachedInfo(cachedInfo); |
530 | 530 |
|
Backend/Core/Services/HTMLService/IHTMLService.cs | ||
---|---|---|
11 | 11 |
public interface IHTMLService |
12 | 12 |
{ |
13 | 13 |
public (string, CachedInfo) FullPreprocessHTML(string htmlSource, List<AnnotationTagGeneric> tags); |
14 |
public (string, CachedInfo) PartialPreprocessHTMLAddTag(string htmlToEdit, string htmlOriginal, AnnotationTag tagToAdd, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo); |
|
15 |
public (string, CachedInfo) PartialPreprocessHTMLRemoveTag(string htmlToEdit, string htmlOriginal, AnnotationTag tagToRemove, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo); |
|
14 |
public (string, CachedInfo) PartialPreprocessHTMLAddTag(string htmlToEdit, string htmlOriginal, AnnotationTagGeneric tagToAdd, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo);
|
|
15 |
public (string, CachedInfo) PartialPreprocessHTMLRemoveTag(string htmlToEdit, string htmlOriginal, AnnotationTagGeneric tagToRemove, List<AnnotationTagGeneric> tags, CachedInfo cachedInfo);
|
|
16 | 16 |
} |
17 | 17 |
} |
Také k dispozici: Unified diff
Fixed issues in AnnotationService and HTMLService