Fix MarkdownPresenterImpl Kotlin errors
This commit is contained in:
parent
b002881dc3
commit
91a0e729db
1 changed files with 3 additions and 5 deletions
|
@ -53,7 +53,7 @@ constructor(private val errorHandler: ErrorHandler) : MarkdownPresenter {
|
||||||
listener: MarkdownPresenter.FileLoadedListener?,
|
listener: MarkdownPresenter.FileLoadedListener?,
|
||||||
replaceCurrentFile: Boolean
|
replaceCurrentFile: Boolean
|
||||||
) {
|
) {
|
||||||
val fileLoader = {
|
fileHandler.post {
|
||||||
val tmpFile = MarkdownFile()
|
val tmpFile = MarkdownFile()
|
||||||
if (tmpFile.load(fileName, `in`)) {
|
if (tmpFile.load(fileName, `in`)) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
@ -76,7 +76,6 @@ constructor(private val errorHandler: ErrorHandler) : MarkdownPresenter {
|
||||||
listener?.onError()
|
listener?.onError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fileHandler.post(fileLoader)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun newFile(newName: String) {
|
override fun newFile(newName: String) {
|
||||||
|
@ -119,12 +118,11 @@ constructor(private val errorHandler: ErrorHandler) : MarkdownPresenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMarkdownEdited(markdown: String?) {
|
override fun onMarkdownEdited(markdown: String?) {
|
||||||
markdown = markdown
|
this.markdown = markdown ?: file?.content ?: ""
|
||||||
val generateMarkdown = {
|
fileHandler.post {
|
||||||
val currentPreviewView = previewView
|
val currentPreviewView = previewView
|
||||||
currentPreviewView?.updatePreview(generateHTML(null))
|
currentPreviewView?.updatePreview(generateHTML(null))
|
||||||
}
|
}
|
||||||
fileHandler.post(generateMarkdown)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun generateHTML(markdown: String?): String {
|
override fun generateHTML(markdown: String?): String {
|
||||||
|
|
Loading…
Reference in a new issue