Basic infrastructure for new texteditor component

This commit is contained in:
Thomas Kluyver 2014-11-05 14:49:31 -08:00
parent b6d0016a1d
commit e6935d47c0
4 changed files with 65 additions and 0 deletions

View File

@ -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'))

View File

@ -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();
});

View File

@ -0,0 +1,23 @@
{% extends "page.html" %}
{% block title %}{{page_title}}{% endblock %}
{% block params %}
data-base-url="{{base_url}}"
{% endblock %}
{% block site %}
<div id="texteditor-container"></div>
{% endblock %}
{% block script %}
{{super()}}
<script src="{{ static_url("texteditor/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
{% endblock %}

View File

@ -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),
]