1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:38:10 +00:00

TextEditor: Allow turning off the preview mode

This patch adds a PreviewMode enum with the following values:

- None
- Markdown
- HTML

This makes it a bit more logical to implement exclusive behavior.
This commit is contained in:
Andreas Kling 2020-07-04 21:19:01 +02:00
parent a378500b45
commit efc335c457
2 changed files with 54 additions and 28 deletions

View file

@ -44,13 +44,19 @@ public:
GUI::TextEditor& editor() { return *m_editor; }
void set_markdown_preview_enabled(bool);
void set_html_preview_enabled(bool);
enum class PreviewMode {
None,
Markdown,
HTML,
};
void set_preview_mode(PreviewMode);
private:
TextEditorWidget();
void set_path(const LexicalPath& file);
void update_title();
void update_preview();
void update_markdown_preview();
void update_html_preview();
@ -74,6 +80,7 @@ private:
RefPtr<GUI::Action> m_replace_all_action;
GUI::ActionGroup m_preview_actions;
RefPtr<GUI::Action> m_no_preview_action;
RefPtr<GUI::Action> m_markdown_preview_action;
RefPtr<GUI::Action> m_html_preview_action;
@ -100,6 +107,6 @@ private:
bool m_document_dirty { false };
bool m_document_opening { false };
bool m_markdown_preview_enabled { false };
bool m_html_preview_enabled { false };
PreviewMode m_preview_mode { PreviewMode::None };
};