# 시험결과분석 54, 66

This commit is contained in:
leejinho 2020-02-12 13:00:43 +09:00
parent 74ba71ceb9
commit dc2c254639

View File

@ -185,10 +185,17 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
img.setAttribute('style', 'max-height:250px; max-width:250px;'); img.setAttribute('style', 'max-height:250px; max-width:250px;');
img[ATTR_FILE] = file; img[ATTR_FILE] = file;
self.insertNode(img); self.insertNode(img);
const empty = document.createElement('div');
empty.innerHTML = '&nbsp;<br/>';
self.insertNode(empty, true);
} }
self.fileInput.nativeElement.value = ''; self.fileInput.nativeElement.value = '';
this.fileInput.nativeElement.onchange = undefined; self.fileInput.nativeElement.onchange = undefined;
self.checkContentLength();
self.changeDetectorRef.detectChanges();
}; };
} }
@ -564,6 +571,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
private insertNode(node: Node, removeSelected: boolean = false) { private insertNode(node: Node, removeSelected: boolean = false) {
const selection: Selection = document.getSelection(); const selection: Selection = document.getSelection();
if (!!selection && !!selection.anchorNode) {
const range: Range = selection.getRangeAt(0); const range: Range = selection.getRangeAt(0);
let inEditor = false; let inEditor = false;
@ -580,7 +589,9 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
} else { } else {
this.editor.nativeElement.appendChild(node); this.editor.nativeElement.appendChild(node);
} }
selection.empty(); } else {
this.editor.nativeElement.appendChild(node);
}
} }
private inEditor(el) { private inEditor(el) {