mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Basic infrastructure for new texteditor component
This commit is contained in:
parent
b6d0016a1d
commit
e6935d47c0
@ -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'))
|
||||
|
23
IPython/html/static/texteditor/js/main.js
Normal file
23
IPython/html/static/texteditor/js/main.js
Normal 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();
|
||||
|
||||
});
|
23
IPython/html/templates/texteditor.html
Normal file
23
IPython/html/templates/texteditor.html
Normal 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 %}
|
18
IPython/html/texteditor/handlers.py
Normal file
18
IPython/html/texteditor/handlers.py
Normal 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),
|
||||
]
|
Loading…
Reference in New Issue
Block a user