Fixes #6030 - amending a list item does not show the change inline in diff box
This commit is contained in:
parent
d86fcd80b7
commit
705c42bd11
@ -1866,21 +1866,37 @@ export class DiffService {
|
|||||||
// We only do this for P for now, as for more complex types like UL/LI that tend to be nestend,
|
// We only do this for P for now, as for more complex types like UL/LI that tend to be nestend,
|
||||||
// information would get lost by this that we will need to recursively merge it again later on.
|
// information would get lost by this that we will need to recursively merge it again later on.
|
||||||
let oldIsSplitAfter = false,
|
let oldIsSplitAfter = false,
|
||||||
newIsSplitAfter = false;
|
newIsSplitAfter = false,
|
||||||
|
oldIsSplitBefore = false,
|
||||||
|
newIsSplitBefore = false;
|
||||||
htmlOld = htmlOld.replace(
|
htmlOld = htmlOld.replace(
|
||||||
/(\s*<p[^>]+class\s*=\s*["'][^"']*)os-split-after/gi,
|
/(\s*<(?:p|ul|ol|li|blockquote|div)[^>]+class\s*=\s*["'][^"']*)os-split-after */gi,
|
||||||
(match: string, beginning: string): string => {
|
(match: string, beginning: string): string => {
|
||||||
oldIsSplitAfter = true;
|
oldIsSplitAfter = true;
|
||||||
return beginning;
|
return beginning;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
htmlNew = htmlNew.replace(
|
htmlNew = htmlNew.replace(
|
||||||
/(\s*<p[^>]+class\s*=\s*["'][^"']*)os-split-after/gi,
|
/(\s*<(?:p|ul|ol|li|blockquote|div)[^>]+class\s*=\s*["'][^"']*)os-split-after */gi,
|
||||||
(match: string, beginning: string): string => {
|
(match: string, beginning: string): string => {
|
||||||
newIsSplitAfter = true;
|
newIsSplitAfter = true;
|
||||||
return beginning;
|
return beginning;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
htmlOld = htmlOld.replace(
|
||||||
|
/(\s*<(?:p|ul|ol|li|blockquote|div)[^>]+class\s*=\s*["'][^"']*)os-split-before */gi,
|
||||||
|
(match: string, beginning: string): string => {
|
||||||
|
oldIsSplitBefore = true;
|
||||||
|
return beginning;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
htmlNew = htmlNew.replace(
|
||||||
|
/(\s*<(?:p|ul|ol|li|blockquote|div)[^>]+class\s*=\s*["'][^"']*)os-split-before */gi,
|
||||||
|
(match: string, beginning: string): string => {
|
||||||
|
newIsSplitBefore = true;
|
||||||
|
return beginning;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Performing the actual diff
|
// Performing the actual diff
|
||||||
const str = this.diffString(workaroundPrepend + htmlOld, workaroundPrepend + htmlNew);
|
const str = this.diffString(workaroundPrepend + htmlOld, workaroundPrepend + htmlNew);
|
||||||
@ -2150,6 +2166,9 @@ export class DiffService {
|
|||||||
if (oldIsSplitAfter || newIsSplitAfter) {
|
if (oldIsSplitAfter || newIsSplitAfter) {
|
||||||
diff = this.addClassToLastNode(diff, 'os-split-after');
|
diff = this.addClassToLastNode(diff, 'os-split-after');
|
||||||
}
|
}
|
||||||
|
if (oldIsSplitBefore || newIsSplitBefore) {
|
||||||
|
diff = this.addClassToLastNode(diff, 'os-split-before');
|
||||||
|
}
|
||||||
|
|
||||||
this.diffCache.put(cacheKey, diff);
|
this.diffCache.put(cacheKey, diff);
|
||||||
return diff;
|
return diff;
|
||||||
|
Loading…
Reference in New Issue
Block a user