JsDiff.diffWords in Rollback freezes browser
This commit is contained in:
Sebastiaan Janssen
2020-11-12 09:40:59 +01:00
parent d60f14708b
commit 4e5b2e4b82

View File

@@ -2,7 +2,7 @@
"use strict"; "use strict";
function RollbackController($scope, contentResource, localizationService, assetsService, dateHelper, userService) { function RollbackController($scope, contentResource, localizationService, assetsService, dateHelper, userService) {
var vm = this; var vm = this;
vm.rollback = rollback; vm.rollback = rollback;
@@ -56,7 +56,7 @@
}); });
}); });
} }
function changeLanguage(language) { function changeLanguage(language) {
@@ -103,7 +103,7 @@
var timestampFormatted = dateHelper.getLocalDate(version.versionDate, currentUser.locale, 'LLL'); var timestampFormatted = dateHelper.getLocalDate(version.versionDate, currentUser.locale, 'LLL');
version.displayValue = timestampFormatted + ' - ' + version.versionAuthorName; version.displayValue = timestampFormatted + ' - ' + version.versionAuthorName;
return version; return version;
}); });
}); });
}); });
} }
@@ -146,7 +146,7 @@
var diffProperty = { var diffProperty = {
"alias": property.alias, "alias": property.alias,
"label": property.label, "label": property.label,
"diff": JsDiff.diffWords(property.value, oldProperty.value), "diff": (property.isObject) ? JsDiff.diffJson(property.value, oldProperty.value) : JsDiff.diffWords(property.value, oldProperty.value),
"isObject": (property.isObject || oldProperty.isObject) ? true : false "isObject": (property.isObject || oldProperty.isObject) ? true : false
}; };
@@ -163,7 +163,7 @@
const nodeId = $scope.model.node.id; const nodeId = $scope.model.node.id;
const versionId = vm.previousVersion.versionId; const versionId = vm.previousVersion.versionId;
const culture = $scope.model.node.variants.length > 1 ? vm.currentVersion.language.culture : null; const culture = $scope.model.node.variants.length > 1 ? vm.currentVersion.language.culture : null;
return contentResource.rollback(nodeId, versionId, culture) return contentResource.rollback(nodeId, versionId, culture)
.then(data => { .then(data => {