From 2589f2f4729073ef3ec21c1ee135b8b70739433b Mon Sep 17 00:00:00 2001 From: Bruno Camara Date: Thu, 12 May 2016 23:08:22 +0100 Subject: [PATCH] check if field type is html to replace newlines by BRs --- app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app.js b/app.js index 6be837e..dd2cc3d 100644 --- a/app.js +++ b/app.js @@ -215,6 +215,7 @@ return { refName: field.referenceName, name: field.name, + type: field.type }; }); }, @@ -1095,6 +1096,15 @@ }, buildPatchToAddWorkItemField: function (fieldName, value) { + // Check if the field type is html to replace newlines by br + var field = this.getFieldByFieldRefName(fieldName); + if (field && field.type && value) { + var fieldType = field.type.toLowerCase(); + if (fieldType === "html" || fieldType === "history") { + value = value.replace(/\n/g, "
"); + } + } + return { op: "add", path: helpers.fmt("/fields/%@", fieldName),