# 시험결과분석 54, 66
This commit is contained in:
parent
74ba71ceb9
commit
dc2c254639
|
@ -185,10 +185,17 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
img.setAttribute('style', 'max-height:250px; max-width:250px;');
|
||||
img[ATTR_FILE] = file;
|
||||
self.insertNode(img);
|
||||
|
||||
const empty = document.createElement('div');
|
||||
empty.innerHTML = ' <br/>';
|
||||
self.insertNode(empty, true);
|
||||
}
|
||||
|
||||
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) {
|
||||
const selection: Selection = document.getSelection();
|
||||
|
||||
if (!!selection && !!selection.anchorNode) {
|
||||
const range: Range = selection.getRangeAt(0);
|
||||
|
||||
let inEditor = false;
|
||||
|
@ -580,7 +589,9 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
} else {
|
||||
this.editor.nativeElement.appendChild(node);
|
||||
}
|
||||
selection.empty();
|
||||
} else {
|
||||
this.editor.nativeElement.appendChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
private inEditor(el) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user