From 3314d31f6f3fb9cdf53a3f5e2c9655fde7455874 2014-11-20 19:51:30 From: Thomas Kluyver Date: 2014-11-20 19:51:30 Subject: [PATCH] Basic infrastructure for new texteditor component --- diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py index 028de8b..58639bb 100644 --- a/IPython/html/notebookapp.py +++ b/IPython/html/notebookapp.py @@ -199,6 +199,7 @@ class NotebookWebApplication(web.Application): handlers.extend(load_handlers('notebook.handlers')) handlers.extend(load_handlers('nbconvert.handlers')) handlers.extend(load_handlers('kernelspecs.handlers')) + handlers.extend(load_handlers('texteditor.handlers')) handlers.extend(load_handlers('services.config.handlers')) handlers.extend(load_handlers('services.kernels.handlers')) handlers.extend(load_handlers('services.contents.handlers')) diff --git a/IPython/html/static/texteditor/js/main.js b/IPython/html/static/texteditor/js/main.js new file mode 100644 index 0000000..b630eeb --- /dev/null +++ b/IPython/html/static/texteditor/js/main.js @@ -0,0 +1,23 @@ +// Copyright (c) IPython Development Team. +// Distributed under the terms of the Modified BSD License. + +require([ + 'jquery', + 'base/js/utils', + 'base/js/page', + 'codemirror/lib/codemirror', + 'custom/custom', +], function( + $, + utils, + page, + CodeMirror + ){ + page = new page.Page(); + + var base_url = utils.get_body_data('baseUrl'); + var cm_instance = CodeMirror($('#texteditor-container')[0]); + + page.show(); + +}); diff --git a/IPython/html/templates/texteditor.html b/IPython/html/templates/texteditor.html new file mode 100644 index 0000000..6112181 --- /dev/null +++ b/IPython/html/templates/texteditor.html @@ -0,0 +1,23 @@ +{% extends "page.html" %} + +{% block title %}{{page_title}}{% endblock %} + +{% block params %} + +data-base-url="{{base_url}}" + +{% endblock %} + + +{% block site %} + +
+ +{% endblock %} + +{% block script %} + + {{super()}} + + +{% endblock %} diff --git a/IPython/html/texteditor/__init__.py b/IPython/html/texteditor/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/IPython/html/texteditor/__init__.py diff --git a/IPython/html/texteditor/handlers.py b/IPython/html/texteditor/handlers.py new file mode 100644 index 0000000..26b22bc --- /dev/null +++ b/IPython/html/texteditor/handlers.py @@ -0,0 +1,18 @@ +#encoding: utf-8 +"""Tornado handlers for the terminal emulator.""" + +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. + +from tornado import web +from ..base.handlers import IPythonHandler, file_path_regex + +class EditorHandler(IPythonHandler): + """Render the terminal interface.""" + @web.authenticated + def get(self, path, name): + self.write(self.render_template('texteditor.html')) + +default_handlers = [ + (r"/texteditor%s" % file_path_regex, EditorHandler), +] \ No newline at end of file