_formatContents({ str, dir }) {
    const p = document.createElement("p");
    p.classList.add("popupContent");
    p.dir = dir;
    const lines = str.split(/(?:\r\n?|\n)/);
    for (let i = 0, ii = lines.length; i < ii; ++i) {
      const line = lines[i];
      p.append(document.createTextNode(line));
      if (i < ii - 1) {
        p.append(document.createElement("br"));
      }
    }
    return p;
  }
Format the contents of the popup by adding newlines where necessary.

@private
@param {Object<string, string>} contentsObj
@memberof PopupElement
@returns {HTMLParagraphElement}