Skip to content
This repository was archived by the owner on May 7, 2021. It is now read-only.

fix(markdown): close click event emitter added #145

Merged
merged 1 commit into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/markdown/examples/markdown-example.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
[rawText]="rawText"
[renderedText]="renderedText | safe: 'html'"
(onSaveClick)="onSaveOrPreview($event)"
(showPreview)="onSaveOrPreview($event)">
(showPreview)="onSaveOrPreview($event)"
(onCloseClick)="closeClicked()">
</f8-markdown>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/app/markdown/examples/markdown-example.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,8 @@ export class MarkdownExampleComponent {
}, 2000);
}

closeClicked() {
console.log('Close clicked event works');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This log is needed for example

}

}
2 changes: 2 additions & 0 deletions src/app/markdown/markdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class MarkdownComponent implements OnChanges, OnInit, AfterViewChecked {
@Output() onActiveEditor = new EventEmitter();
@Output() onSaveClick = new EventEmitter();
@Output() showPreview = new EventEmitter();
@Output() onCloseClick = new EventEmitter();

@ViewChild('editorInput') editorInput: ElementRef;
@ViewChild('editorBox') editorBox: ElementRef;
Expand Down Expand Up @@ -267,6 +268,7 @@ export class MarkdownComponent implements OnChanges, OnInit, AfterViewChecked {
this.rawText = this.previousRawText;
this.renderedText = this.previousRenderedText;
this.deactivateEditor();
this.onCloseClick.emit();
}

renderPreview(rawText: string, renderedText: string) {
Expand Down