escape html tags from wp display attr value and set as title for formattable

pull/5460/head
Jens Ulferts 8 years ago
parent 09c0fa0cc9
commit b9e4a41d39
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 4
      frontend/app/components/work-packages/wp-display-attr/wp-display-attr.directive.ts
  2. 6
      frontend/app/components/wp-display/field-types/wp-display-formattable-field.module.ts

@ -119,7 +119,9 @@ export class WorkPackageDisplayAttributeController {
this.__d__renderer = this.__d__renderer || this.$element.find(".__d__renderer");
this.field.render(this.__d__renderer[0], this.displayText);
this.$element.attr("aria-label", this.label + " " + this.displayText);
// strip html tags
let ariaLabel = angular.element(this.displayText).text();
this.$element.attr('aria-label', this.label + ' ' + ariaLabel);
this.__d__cell = this.__d__cell || this.$element.find(".__d__cell");
this.__d__cell.toggleClass("-placeholder", this.isEmpty);

@ -42,6 +42,12 @@ export class FormattableDisplayField extends DisplayField {
}
public render(element:HTMLElement, displayText:string):void {
// title stripped of html tags
if (this.value) {
let title = angular.element(this.value).text();
element.setAttribute('title', title);
}
angular.element(element).addClass('-multiline');
let span = document.createElement('span');

Loading…
Cancel
Save