1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

TextEditor+Browser: Enable HTML syntax highlighting on HTML documents

This commit is contained in:
Ali Mohammad Pur 2021-05-20 23:17:30 +04:30 committed by Andreas Kling
parent 97a230e4ef
commit dc388297eb
3 changed files with 13 additions and 0 deletions

View file

@ -25,6 +25,7 @@
#include <LibGUI/ToolbarContainer.h>
#include <LibGUI/Window.h>
#include <LibJS/Interpreter.h>
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
#include <LibWeb/InProcessWebView.h>
#include <LibWeb/Layout/BlockBox.h>
#include <LibWeb/Layout/InitialContainingBlockBox.h>
@ -69,6 +70,7 @@ void Tab::view_source(const URL& url, const String& source)
auto& editor = window->set_main_widget<GUI::TextEditor>();
editor.set_text(source);
editor.set_mode(GUI::TextEditor::ReadOnly);
editor.set_syntax_highlighter(make<Web::HTML::SyntaxHighlighter>());
editor.set_ruler_visible(true);
window->resize(640, 480);
window->set_title(url.to_string());