()
| 54 | } |
| 55 | |
| 56 | render() { |
| 57 | const { block, selectionState, isInvalidBlamed } = this.props |
| 58 | const isSelected = selectionState !== NodeSelectionState.UNSELECTED |
| 59 | const leftPos = block.x + block.marginLeft |
| 60 | const topPos = block.y + block.marginTop |
| 61 | |
| 62 | const isValid = (block.isValid || block.invalidChildsetID) && !isInvalidBlamed |
| 63 | const className = 'svgsplootnode stringnode' + (isSelected ? ' selected' : '') + (isValid ? '' : ' invalid') |
| 64 | |
| 65 | const internalWidth = block.blockWidth - STRING_CAP_WIDTH * 2 |
| 66 | |
| 67 | const rectangle = ( |
| 68 | <rect |
| 69 | ref={this.shapeRef} |
| 70 | tabIndex={0} |
| 71 | className={isSelected ? 'string-node-selected-background' : 'string-node-background'} |
| 72 | x={leftPos + STRING_CAP_WIDTH - 4} |
| 73 | y={topPos} |
| 74 | width={internalWidth + 8} |
| 75 | height={block.rowHeight} |
| 76 | /> |
| 77 | ) |
| 78 | |
| 79 | const startCap = getLeftCapShape(className, leftPos, topPos, block.rowHeight) |
| 80 | const endCap = getRightCapShape(className, leftPos + STRING_CAP_WIDTH + internalWidth + 3, topPos, block.rowHeight) |
| 81 | |
| 82 | const textContent = block.node.getProperty('value') |
| 83 | |
| 84 | return ( |
| 85 | <> |
| 86 | {rectangle} |
| 87 | {startCap} |
| 88 | <foreignObject x={leftPos + STRING_CAP_WIDTH + 1} y={topPos} width={internalWidth} height={block.rowHeight}> |
| 89 | <pre tabIndex={0} className="string-node"> |
| 90 | {textContent} |
| 91 | </pre> |
| 92 | </foreignObject> |
| 93 | {endCap} |
| 94 | </> |
| 95 | ) |
| 96 | } |
| 97 | |
| 98 | componentDidMount(): void { |
| 99 | if (this.props.selectionState === NodeSelectionState.SELECTED) { |
nothing calls this directly
no test coverage detected