OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/frontend/app/components/work-packages/wp-attachments-formattable-.../models/markup-model.ts

34 lines
828 B

import {InsertMode} from '../wp-attachments-formattable.enums';
import IAugmentedJQuery = angular.IAugmentedJQuery;
export class MarkupModel {
public createMarkup(insertUrl:string, insertMode:InsertMode, addLineBreak:boolean = false):string {
if (angular.isUndefined((insertUrl))) {
return '';
}
var markup:string = ' ';
switch (insertMode) {
case InsertMode.ATTACHMENT:
markup += 'attachment:' + insertUrl.split('/').pop();
break;
case InsertMode.DELAYED_ATTACHMENT:
markup += 'attachment:' + insertUrl;
break;
case InsertMode.INLINE:
markup += '!' + insertUrl + '!';
break;
case InsertMode.LINK:
markup += insertUrl;
break;
}
if (addLineBreak) {
markup += '\r\n';
}
return markup;
}
}