Gitlab Community Edition Instance

Skip to content

add error handling to CommentaryField.convert

/** Take an array of paragraphs and convert it to a `ContentState`.
 * @param {Array.Array.<string>} paragraphs
 * @returns {ContentState} the draft editor content state
 */
function convert (paragraphs) {
  let pString = "";
  for (const p of paragraphs) {
    console.debug(p);
    pString += "<p>" + p.join("") + "</p>";
  }
  const contentState = convertFromHTML(
    conversionMapReverse)(
    pString
  );
  return contentState;
}

in this code snippet from CommentaryField.js handle

TypeError: p.join is not a function