Skip to content

Commit

Permalink
fix the diff view so we show a syntax highlighted view of a diff
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Nov 26, 2013
1 parent 7f9bee4 commit fa43f4a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions hawtio-web/src/main/webapp/app/wiki/js/view.ts
Expand Up @@ -452,9 +452,13 @@ module Wiki {

setTimeout(maybeUpdateView, 50);

function updateView() {
function isDiffView() {
var path = $location.path();
if (path && path.startsWith("/wiki/diff")) {
return path && path.startsWith("/wiki/diff");
}

function updateView() {
if (isDiffView()) {
var baseObjectId = $routeParams["baseObjectId"];
$scope.git = wikiRepository.diff($scope.objectId, baseObjectId, $scope.pageId, onFileDetails);
} else {
Expand All @@ -467,7 +471,13 @@ module Wiki {

function viewContents(pageName, contents) {
$scope.sourceView = null;
var format = Wiki.fileFormat(pageName, fileExtensionTypeRegistry) || $scope.format;

var format: string = null;
if (isDiffView()) {
format = "diff";
} else {
format = Wiki.fileFormat(pageName, fileExtensionTypeRegistry) || $scope.format;
}
if ("markdown" === format) {
// lets convert it to HTML
$scope.html = contents ? marked(contents) : "";
Expand Down

0 comments on commit fa43f4a

Please sign in to comment.