Skip to content

Commit

Permalink
Revert "Fix lists diff"
Browse files Browse the repository at this point in the history
This reverts commit 9c6325e.
  • Loading branch information
bastianjoel committed May 22, 2024
1 parent e9aa810 commit d611b6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { TranslateService } from '@ngx-translate/core';
import { ModificationType } from 'src/app/domain/models/motions/motions.constants';
import { djb2hash, splitStringKeepSeperator } from 'src/app/infrastructure/utils';
import * as DomHelpers from 'src/app/infrastructure/utils/dom-helpers';
import { diffDomTiptapMigration } from 'src/app/ui/modules/editor/components/editor/helpers/migrate-diff';

import {
CommonAncestorData,
Expand Down Expand Up @@ -1334,22 +1333,24 @@ export class MotionDiffService {
// TODO: This is a workaround to make sure the first element of a amendment
// has a line number for correct display of amendments in front of list
// or block elements
const parser = new DOMParser();
const htmlNewEl = parser.parseFromString(htmlNew, `text/html`);
const htmlOldEl = parser.parseFromString(htmlOld, `text/html`);
if (htmlNewEl.body.children[0] && !htmlNewEl.body.children[0].querySelector(`.os-line-number`)) {
if (htmlNewEl.body.querySelector(`.os-line-number`) && htmlOldEl.body.querySelector(`.os-line-number`)) {
const ln = htmlNewEl.body.querySelector(`.os-line-number`);
htmlNewEl.body.children[0].childNodes[0].before(ln);
htmlOldEl.body.children[0].querySelector(`.os-line-number`).remove();
const htmlOldEl = document.createElement(`template`);
const htmlNewEl = document.createElement(`template`);
htmlNewEl.innerHTML = htmlNew;
htmlOldEl.innerHTML = htmlOld;
if (htmlNewEl.content.children[0] && !htmlNewEl.content.children[0].querySelector(`.os-line-number`)) {
if (
htmlNewEl.content.querySelector(`.os-line-number`) &&
htmlOldEl.content.querySelector(`.os-line-number`)
) {
const ln = htmlNewEl.content.querySelector(`.os-line-number`);
htmlNewEl.content.children[0].childNodes[0].before(ln);
htmlOldEl.content.children[0].querySelector(`.os-line-number`).remove();

htmlNew = htmlNewEl.innerHTML;
htmlOld = htmlOldEl.innerHTML;
}
}

diffDomTiptapMigration(htmlOldEl, htmlNewEl);

htmlNew = htmlNewEl.body.innerHTML;
htmlOld = htmlOldEl.body.innerHTML;

// os-split-after should not be considered for detecting changes in paragraphs, so we strip it here
// and add it afterwards.
// We only do this for P for now, as for more complex types like UL/LI that tend to be nestend,
Expand Down

This file was deleted.

0 comments on commit d611b6e

Please sign in to comment.