I know, that GNOME3 UI uses HTML and CSS elements for creating menus and windows. How can I write simple web-based application like some text-editor with own document-format and formatting tools written in JS? HTML widget, that saves documents to the file-system.

Main reason of this question - to create Text editor, with Markdown support...

GTK File Menu:

  • Open
  • Save as...

WebKit content:

<link rel="stylesheet"...>
<script src="..."></script>
<content>{opened file}</content>
  • Try with bluefish :) if you really dont want to stick to Webkit – bebojoor Apr 25 '12 at 9:21

It doesn't use HTML. It uses GTK, which itself uses a styling language based on CSS. However, you can use WebKit to provide the functionality you're after. For instance, the following program will give you a WebKit-based AskUbuntu-browser.

I wrote this in Python, but you can use JavaScript as well if you like. That's the great thing about GObject Introspection, from which we're importing GTK and WebKit. It works with most languages and the code will be very similar in JavaScript. And of course, just replace http://askubuntu.com with the location of your HTML-application.

#!/usr/bin/env python
from gi.repository import Gtk, WebKit

win = Gtk.Window()
web = WebKit.WebView()
scroller = Gtk.ScrolledWindow()
win.connect("destroy", Gtk.main_quit)
  • Ok, but how to open/save documents on file-system using this widget? – iegik Apr 25 '12 at 9:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.