Skip to content

Commit

Permalink
Merge pull request #11 from palourde/bugfix/multi-line-output
Browse files Browse the repository at this point in the history
Respect line breaks of results output
  • Loading branch information
palourde authored Nov 30, 2017
2 parents 14a6e6b + dd70d34 commit cd38721
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion css/bootstrap-uchiwa/bootstrap-uchiwa.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/bootstrap-uchiwa/bootstrap-uchiwa.css.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion css/uchiwa-dark/uchiwa-dark.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/uchiwa-dark/uchiwa-dark.css.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions css/uchiwa-default/_element-view.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

.element-view .value {
overflow-wrap: break-word;
white-space: pre-wrap;
}

.element-view .value img {
Expand Down
3 changes: 2 additions & 1 deletion css/uchiwa-default/uchiwa-default.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/uchiwa-default/uchiwa-default.css.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ function($filter, $q, $rootScope) {
return isSelected;
};
this.isUrl = function(value) {
return /target="_blank"/.test(value);
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
return regexp.test(value);
};
// openLink stops event propagation if an A tag is clicked
this.openLink = function($event) {
Expand Down
9 changes: 5 additions & 4 deletions js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ filterModule.filter('relativeTimestamp', function() {
};
});

filterModule.filter('richOutput', ['$filter', '$sce', '$sanitize', '$interpolate', function($filter, $sce, $sanitize, $interpolate) {
filterModule.filter('richOutput', ['$filter', 'Helpers', '$sce', '$sanitize', '$interpolate', function($filter, Helpers, $sce, $sanitize, $interpolate) {
return function(text) {
var output = '';

Expand All @@ -377,10 +377,11 @@ filterModule.filter('richOutput', ['$filter', '$sce', '$sanitize', '$interpolate
var iframeSrc = $sanitize(text.replace(/^iframe:/, ''));
var exp = $interpolate('<span class="iframe"><iframe width="100%" src="{{iframeSrc}}"></iframe></span>')({ 'iframeSrc': iframeSrc });
output = $sce.trustAsHtml(exp);
}
else {
var linkified = $filter('linky')(text, '_blank');
} else if (Helpers.isUrl(text)) {
var linkified = $filter('linky')(text);
output = $filter('imagey')(linkified);
} else {
return text;
}
return output;
};
Expand Down

0 comments on commit cd38721

Please sign in to comment.