Revize ecf6d2e0
Přidáno uživatelem Vojtěch Bartička před téměř 3 roky(ů)
Backend/Core/Services/AnnotationService/AnnotationServiceEF.cs | ||
---|---|---|
436 | 436 |
|
437 | 437 |
private void WrapTextInSpan(IEnumerable<HtmlNode> descendantsOriginal, HtmlDocument docToEdit) |
438 | 438 |
{ |
439 |
// Special case for non-html documents |
|
440 |
if (descendantsOriginal.Count() == 2) |
|
441 |
{ |
|
442 |
var documentNode = descendantsOriginal.ElementAt(0); |
|
443 |
var childNode = descendantsOriginal.ElementAt(1); |
|
444 |
if (documentNode.Name == "#document" && childNode.Name == "#text") |
|
445 |
{ |
|
446 |
HtmlNode coveringSpan = docToEdit.CreateElement("span"); |
|
447 |
coveringSpan.InnerHtml = childNode.InnerHtml; |
|
448 |
TagStartPositions.Add(childNode.InnerStartIndex); |
|
449 |
TagStartLengths.Add(0); |
|
450 |
TagClosingPositions.Add(childNode.InnerStartIndex + childNode.InnerLength); |
|
451 |
TagClosingLengths.Add(0); |
|
452 |
coveringSpan.Attributes.Add(TAG_ID_ATTRIBUTE_NAME, (TagStartPositions.Count - 1).ToString()); |
|
453 |
|
|
454 |
var parent = NodeDict[documentNode]; |
|
455 |
|
|
456 |
parent.ChildNodes.RemoveAt(0); |
|
457 |
parent.ChildNodes.Add(coveringSpan); |
|
458 |
|
|
459 |
return; |
|
460 |
} |
|
461 |
} |
|
462 |
|
|
439 | 463 |
foreach (var node in descendantsOriginal) |
440 | 464 |
{ |
441 | 465 |
var originalNode = node; |
... | ... | |
583 | 607 |
{ |
584 | 608 |
var node = descendantsToEdit.ElementAt(i); |
585 | 609 |
if (!node.Name.Contains("#text") || addedForSelection.Contains(node) || addedForSelection.Contains(node.ParentNode) || |
586 |
node.ParentNode.Name == "style") |
|
610 |
node.ParentNode.Name == "style" || node.ParentNode.Name.StartsWith("#"))
|
|
587 | 611 |
{ |
588 | 612 |
continue; |
589 | 613 |
} |
Také k dispozici: Unified diff
Fixed annotation problems Re #9715 , Re #9716