(element)
| 286 | // Attribute parsing |
| 287 | |
| 288 | getTextAttributes(element) { |
| 289 | let value |
| 290 | const attributes = {} |
| 291 | for (const attribute in config.textAttributes) { |
| 292 | const configAttr = config.textAttributes[attribute] |
| 293 | if ( |
| 294 | configAttr.tagName && |
| 295 | findClosestElementFromNode(element, { |
| 296 | matchingSelector: configAttr.tagName, |
| 297 | untilNode: this.containerElement, |
| 298 | }) |
| 299 | ) { |
| 300 | attributes[attribute] = true |
| 301 | } else if (configAttr.parser) { |
| 302 | value = configAttr.parser(element) |
| 303 | if (value) { |
| 304 | let attributeInheritedFromBlock = false |
| 305 | for (const blockElement of this.findBlockElementAncestors(element)) { |
| 306 | if (configAttr.parser(blockElement) === value) { |
| 307 | attributeInheritedFromBlock = true |
| 308 | break |
| 309 | } |
| 310 | } |
| 311 | if (!attributeInheritedFromBlock) { |
| 312 | attributes[attribute] = value |
| 313 | } |
| 314 | } |
| 315 | } else if (configAttr.styleProperty) { |
| 316 | value = element.style[configAttr.styleProperty] |
| 317 | if (value) { |
| 318 | attributes[attribute] = value |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | if (nodeIsAttachmentElement(element)) { |
| 324 | const object = parseTrixDataAttribute(element, "attributes") |
| 325 | for (const key in object) { |
| 326 | value = object[key] |
| 327 | attributes[key] = value |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | return attributes |
| 332 | } |
| 333 | |
| 334 | getBlockAttributes(element) { |
| 335 | const attributes = [] |
no test coverage detected