I want to integrate the JS based code editor named “Code Mirror” into a Vaadin based UI
There is already an addon which integrates a much older version of Code Mirror into Vaadin- Code Mirror v0.8 is integrated into Vaadin in that addon- Can someone tell me how to go about integrating Code Mirror (a JS library) into a vaadin app? I want to integrate the latest version of code mirror into a vaadin app.
Hi Arvend,
you just have to create your own servlet which extends AbstractApplicationServlet and override the writeAjaxPageHtmlHeader method.
here’s an example:
protected void writeAjaxPageHtmlHeader(BufferedWriter page, String title, String themeUri,
HttpServletRequest request) throws IOException {
page.append("<script type=\"text/JavaScript\" src=\"[here you put the path to code mirror lib]
\"></script>");
String javascript =
"<script type=\"text/JavaScript\">"+
[here you put the javascript you want to add]
"</script>";
page.append(javascript);
super.writeAjaxPageHtmlHeader(page, title, themeUri, request);
}