(element)
| 193 | } |
| 194 | |
| 195 | processElement(element) { |
| 196 | let attributes |
| 197 | if (nodeIsAttachmentElement(element)) { |
| 198 | attributes = parseTrixDataAttribute(element, "attachment") |
| 199 | if (Object.keys(attributes).length) { |
| 200 | const textAttributes = this.getTextAttributes(element) |
| 201 | this.appendAttachmentWithAttributes(attributes, textAttributes) |
| 202 | // We have everything we need so avoid processing inner nodes |
| 203 | element.innerHTML = "" |
| 204 | } |
| 205 | return this.processedElements.push(element) |
| 206 | } else { |
| 207 | switch (tagName(element)) { |
| 208 | case "br": |
| 209 | if (!this.isExtraBR(element) && !this.isBlockElement(element.nextSibling)) { |
| 210 | this.appendStringWithAttributes("\n", this.getTextAttributes(element)) |
| 211 | } |
| 212 | return this.processedElements.push(element) |
| 213 | case "img": |
| 214 | attributes = { url: element.getAttribute("src"), contentType: "image" } |
| 215 | const object = getImageDimensions(element) |
| 216 | for (const key in object) { |
| 217 | const value = object[key] |
| 218 | attributes[key] = value |
| 219 | } |
| 220 | this.appendAttachmentWithAttributes(attributes, this.getTextAttributes(element)) |
| 221 | return this.processedElements.push(element) |
| 222 | case "tr": |
| 223 | if (this.needsTableSeparator(element)) { |
| 224 | return this.appendStringWithAttributes(config.parser.tableRowSeparator) |
| 225 | } |
| 226 | break |
| 227 | case "td": |
| 228 | if (this.needsTableSeparator(element)) { |
| 229 | return this.appendStringWithAttributes(config.parser.tableCellSeparator) |
| 230 | } |
| 231 | break |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | // Document construction |
| 237 |
no test coverage detected