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:
parent
bd127eae6d
commit
e3fbab9dad
1 changed files with 5 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue