| 34 | } |
| 35 | |
| 36 | init(pgpRange) { |
| 37 | this.pgpRange = pgpRange; |
| 38 | // check if wrapper element already exists |
| 39 | if (this.pgpRange.commonAncestorContainer.classList.contains('m-extract-wrapper')) { |
| 40 | this.pgpElement = this.pgpRange.commonAncestorContainer; |
| 41 | } else { |
| 42 | // create container element |
| 43 | this.pgpElement = document.createElement('div'); |
| 44 | this.pgpElement.classList.add('m-extract-wrapper'); |
| 45 | this.pgpElement.style.display = 'inline-block'; |
| 46 | this.pgpElement.style.position = 'relative'; |
| 47 | this.pgpElement.append(this.pgpRange.extractContents()); |
| 48 | this.pgpRange.insertNode(this.pgpElement); |
| 49 | this.pgpRange.selectNodeContents(this.pgpElement); |
| 50 | } |
| 51 | // set status to attached |
| 52 | this.pgpElement.dataset[FRAME_STATUS] = FRAME_ATTACHED; |
| 53 | } |
| 54 | |
| 55 | establishConnection() { |
| 56 | this.port = EventHandler.connect(this.ctrlName, this); |