From 9ad0479cfaa2bd2dda245570dd1456bb72f76665 Mon Sep 17 00:00:00 2001 From: Sam Kenyon Date: Sat, 3 Feb 2024 10:16:22 -0800 Subject: [PATCH] fix re-enable markdown preview --- gui/mainwindow.cpp | 8 +++++++- gui/mainwindow.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 61a1ed4..6293aac 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -252,13 +252,18 @@ void MainWindow::on_actionOpen_triggered() } -void MainWindow::on_textEdit_textChanged() +void MainWindow::markdownUpdate() { if (m_docIsMarkdown) { ui->textEditRich->setMarkdown(ui->textEdit->toPlainText()); } } +void MainWindow::on_textEdit_textChanged() +{ + markdownUpdate(); +} + void MainWindow::on_hidePreviewButton_clicked() { ui->textEditRich->setVisible(false); @@ -268,6 +273,7 @@ void MainWindow::on_hidePreviewButton_clicked() void MainWindow::on_actionMarkdown_Preview_triggered() { + markdownUpdate(); ui->textEditRich->setVisible(true); ui->hidePreviewButton->setVisible(true); } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 4749d1d..14a41fa 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -41,6 +41,7 @@ private slots: private: void contextMenuEvent(QContextMenuEvent* event); void setupShortcuts(); + void markdownUpdate(); static const int STATUS_MILLISECONDS = 2000; static const int MIN_BORDER = 50;