0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Refactored the card diffing into a separate method

This makes it easier to enable and disable the card diffing in dev
This commit is contained in:
Fabien "egg" O'Carroll 2023-04-20 15:21:22 +01:00
parent bd127eae6d
commit e3fbab9dad

View file

@ -126,6 +126,11 @@ export default ModalComponent.extend({
const result = diff(previousHTML, currentHTML);
const div = document.createElement('div');
div.innerHTML = result;
this.diffCards(div);
return div.innerHTML;
},
diffCards(div) {
const cards = div.querySelectorAll('div[data-kg-card]');
for (const card of cards) {
const hasChanges = !!card.querySelectorAll('del').length || !!card.querySelectorAll('ins').length;
@ -159,7 +164,6 @@ export default ModalComponent.extend({
card.remove();
}
}
return div.innerHTML;
},
updateDiff() {