mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-21 15:59:15 +00:00
[TSK-1396] Fix description diff (#3162)
Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
parent
3dc7ba9e96
commit
148cbd4898
@ -377,7 +377,9 @@ export async function getValue (client: TxOperations, m: AttributeModel, tx: Dis
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getPrevValue (client: TxOperations, m: AttributeModel, tx: DisplayTx): any {
|
export function getPrevValue (client: TxOperations, m: AttributeModel, tx: DisplayTx): any {
|
||||||
if (tx.prevDoc !== undefined) {
|
if (tx.txes.length > 0 && tx.txes[0].prevDoc !== undefined) {
|
||||||
|
return getObjectValue(m.key, tx.txes[0].prevDoc)
|
||||||
|
} else if (tx.prevDoc !== undefined) {
|
||||||
return getObjectValue(m.key, tx.prevDoc)
|
return getObjectValue(m.key, tx.prevDoc)
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
|
@ -22,17 +22,16 @@
|
|||||||
export let showOnlyDiff: boolean = false
|
export let showOnlyDiff: boolean = false
|
||||||
|
|
||||||
function removeSimilarLines (str1: string | undefined, str2: string | undefined) {
|
function removeSimilarLines (str1: string | undefined, str2: string | undefined) {
|
||||||
if (str1 === undefined || str2 === undefined) {
|
str1 = str1 ?? ''
|
||||||
return
|
str2 = str2 ?? ''
|
||||||
}
|
|
||||||
const lines1 = str1.split('</p>')
|
const lines1 = str1.split('</p>')
|
||||||
const lines2 = str2.split('</p>')
|
const lines2 = str2.split('</p>')
|
||||||
let result1 = ''
|
let result1 = ''
|
||||||
let result2 = ''
|
let result2 = ''
|
||||||
for (let i = 0; i < lines1.length; i++) {
|
for (let i = 0; i < Math.max(lines1.length, lines2.length); i++) {
|
||||||
if (lines1[i] !== lines2[i]) {
|
if (lines1[i] !== lines2[i]) {
|
||||||
result1 += lines1[i] ?? '' + '</p>'
|
if (lines1[i]) result1 += lines1[i] + '</p>'
|
||||||
result2 += lines2[i] ?? '' + '</p>'
|
if (lines2[i]) result2 += lines2[i] + '</p>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = result1
|
value = result1
|
||||||
@ -44,6 +43,6 @@
|
|||||||
|
|
||||||
<ShowMore>
|
<ShowMore>
|
||||||
{#key [value, compareValue]}
|
{#key [value, compareValue]}
|
||||||
<CollaborationDiffViewer content={value ?? ''} comparedVersion={compareValue} noButton readonly />
|
<CollaborationDiffViewer content={value ?? ''} comparedVersion={compareValue ?? ''} noButton readonly />
|
||||||
{/key}
|
{/key}
|
||||||
</ShowMore>
|
</ShowMore>
|
||||||
|
Loading…
Reference in New Issue
Block a user