Skip to content

Commit

Permalink
remove unneeded changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanValverdeU committed Jun 5, 2024
1 parent 92dc7d7 commit 5b1c7bd
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,10 @@ function applyDefaultFormat(
applyDefaultFormat(segment, format, applyDefaultFormatOption);
}

segment.format = mergeSegmentFormat(
applyDefaultFormatOption,
format,
segment.format,
decoratorFormat
);
segment.format = mergeSegmentFormat(applyDefaultFormatOption, format, {
...decoratorFormat,
...segment.format,
});

if (segment.link) {
segment.link.format = mergeSegmentFormat(
Expand Down Expand Up @@ -410,11 +408,10 @@ function getSegmentFormatInLinkFormat(
function mergeSegmentFormat(
applyDefaultFormatOption: 'mergeAll' | 'keepSourceEmphasisFormat',
targetFormat: ContentModelSegmentFormat,
sourceFormat: ContentModelSegmentFormat,
decoratorFormat: ContentModelSegmentFormat = {}
sourceFormat: ContentModelSegmentFormat
): ContentModelSegmentFormat {
return applyDefaultFormatOption == 'mergeAll'
? { ...targetFormat, ...decoratorFormat, ...sourceFormat }
? { ...targetFormat, ...sourceFormat }
: {
...getFormatWithoutSegmentFormat(sourceFormat),
...targetFormat,
Expand All @@ -441,7 +438,8 @@ function getSemanticFormat(segmentFormat: ContentModelSegmentFormat): ContentMod
}

/**
* Segment format can also contain other type of metadata, for example in Images/Hyperlink we want to preserve those properties
* Segment format can also contain other type of metadata, for example in Images/Hyperlink,
* we want to preserve these properties when merging format
*/
function getFormatWithoutSegmentFormat(
sourceFormat: ContentModelSegmentFormat
Expand Down

0 comments on commit 5b1c7bd

Please sign in to comment.