Remove dead code
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Garrett Mills 2020-10-14 09:25:29 -05:00
parent 8b28109ab0
commit d6611d9c82
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -22,16 +22,6 @@ export class HostComponent implements OnInit {
constructor() { } constructor() { }
ngOnInit() { 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) { onRecordChange($event) {
@ -39,39 +29,6 @@ export class HostComponent implements OnInit {
} }
onKeyUp($event) { 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) { onUlKeyDown($event, index) {
@ -181,25 +138,9 @@ export class HostComponent implements OnInit {
} }
onHostDblClick() { onHostDblClick() {
if ( this.record.type === 'click_link' ) {
window.open(this.record.value.trim(), '_blank');
}
} }
takeFocus(fromTop = true) { 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 // TODO return an observable here, probably