()
| 562 | } |
| 563 | |
| 564 | public updatePlaceholder() { |
| 565 | // Adapted from https://stackoverflow.com/questions/26695708/how-can-i-add-placeholder-text-when-the-editor-is-empty |
| 566 | |
| 567 | const editor = this.editor; |
| 568 | const { placeholder } = this.props; |
| 569 | |
| 570 | const showPlaceholder = !editor.session.getValue().length; |
| 571 | let node = editor.renderer.placeholderNode; |
| 572 | |
| 573 | if (!showPlaceholder && node) { |
| 574 | editor.renderer.scroller.removeChild(editor.renderer.placeholderNode); |
| 575 | editor.renderer.placeholderNode = null; |
| 576 | } else if (showPlaceholder && !node) { |
| 577 | node = editor.renderer.placeholderNode = document.createElement("div"); |
| 578 | node.textContent = placeholder || ""; |
| 579 | node.className = "ace_comment ace_placeholder"; |
| 580 | node.style.padding = "0 9px"; |
| 581 | node.style.position = "absolute"; |
| 582 | node.style.zIndex = "3"; |
| 583 | editor.renderer.scroller.appendChild(node); |
| 584 | } else if (showPlaceholder && node) { |
| 585 | node.textContent = placeholder; |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | public updateRef(item: HTMLElement) { |
| 590 | this.refEditor = item; |
no outgoing calls
no test coverage detected