From d6611d9c829c88651b35a36983af280e418c5a50 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Wed, 14 Oct 2020 09:25:29 -0500 Subject: [PATCH] Remove dead code --- .../components/editor/host/host.component.ts | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/src/app/components/editor/host/host.component.ts b/src/app/components/editor/host/host.component.ts index cd75c6d..27b44fe 100644 --- a/src/app/components/editor/host/host.component.ts +++ b/src/app/components/editor/host/host.component.ts @@ -22,16 +22,6 @@ export class HostComponent implements OnInit { constructor() { } ngOnInit() { - if ( this.record.type === 'ul' ) { - const values = JSON.parse(this.record.value); - values.forEach(group => this.listLines.push(group.value)); - setTimeout(() => { - values.forEach((group, i) => { - const el = this.liItems.toArray()[i].nativeElement; - el.className += ` node-indentation-level-num-${group.indentationLevel}`; - }); - }, 0); - } } onRecordChange($event) { @@ -39,39 +29,6 @@ export class HostComponent implements OnInit { } onKeyUp($event) { - const innerText = this.hostContainer.nativeElement.innerText.trim() - if ( $event.code === 'Enter' && this.record.isNorm() && !$event.shiftKey - && ( this.record.type !== 'block_code' - || (innerText.endsWith('```') && (innerText.match(/`/g) || []).length >= 6) // TODO don't add new if cursor in block - ) - ) { - this.hostContainer.nativeElement.innerText = this.hostContainer.nativeElement.innerText.trim(); - this.newHostRequested.emit(this); - } else if ( $event.code === 'Backspace' && !this.hostContainer.nativeElement.innerText.trim() ) { - this.destroyHostRequested.emit(this); - } - - if ( innerText.startsWith('# ') ) { - this.record.type = 'header1'; - } else if ( innerText.startsWith('## ') ) { - this.record.type = 'header2'; - } else if ( innerText.startsWith('### ') ) { - this.record.type = 'header3'; - } else if ( innerText.startsWith('#### ') ) { - this.record.type = 'header4'; - } else if ( innerText.startsWith('```') ) { - this.record.type = 'block_code'; - } else if ( innerText.startsWith('http') ) { - this.record.type = 'click_link'; - } else if ( innerText === '===' ) { - this.record.type = 'page_sep'; - } else if ( innerText.startsWith('-') || innerText.startsWith(' -') ) { - this.record.type = 'ul'; - this.listLines = [this.record.value]; - setTimeout(() => { - this.focusStart(this.liItems.toArray()[0].nativeElement); - }, 0); - } } onUlKeyDown($event, index) { @@ -181,25 +138,9 @@ export class HostComponent implements OnInit { } onHostDblClick() { - if ( this.record.type === 'click_link' ) { - window.open(this.record.value.trim(), '_blank'); - } } takeFocus(fromTop = true) { - if ( this.record.type === 'ul' ) { - if ( fromTop ) { - this.focusStart(this.liItems.toArray()[0].nativeElement); - } else { - this.focusEnd(this.liItems.toArray().reverse()[0].nativeElement); - } - } else { - if ( fromTop ) { - this.focusStart(this.hostContainer.nativeElement); - } else { - this.focusEnd(this.hostContainer.nativeElement); - } - } } // TODO return an observable here, probably