mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
Add Ace editing mode for code cells.
This commit is contained in:
parent
d369606683
commit
f04e31b80c
@ -31,6 +31,11 @@ span#notebook_name {
|
||||
font-size: 146.5%;
|
||||
}
|
||||
|
||||
#menubar {
|
||||
/* Initially hidden to prevent FLOUC */
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ui-menubar-item .ui-button .ui-button-text {
|
||||
padding: 0.4em 1.0em;
|
||||
font-size: 100%;
|
||||
@ -50,6 +55,22 @@ span#notebook_name {
|
||||
margin: 0.3em 0;
|
||||
}
|
||||
|
||||
#fulledit_widget {
|
||||
/* Initially hidden to prevent FLOUC */
|
||||
display: none;
|
||||
width: 920px;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
#fulledit_editor {
|
||||
height: 577px;
|
||||
width: 920px;
|
||||
}
|
||||
|
||||
#fulledit_header {
|
||||
width: 920px;
|
||||
}
|
||||
|
||||
span#quick_help_area {
|
||||
position: static;
|
||||
padding: 5px 0px;
|
||||
|
@ -106,6 +106,9 @@ var IPython = (function (IPython) {
|
||||
IPython.notebook.insert_code_cell_below();
|
||||
});
|
||||
// Cell
|
||||
this.element.find('#full_edit_cell').click(function () {
|
||||
IPython.fulledit_widget.open();
|
||||
});
|
||||
this.element.find('#run_cell').click(function () {
|
||||
IPython.notebook.execute_selected_cell();
|
||||
});
|
||||
|
@ -178,6 +178,11 @@ var IPython = (function (IPython) {
|
||||
IPython.quick_help.show_keyboard_shortcuts();
|
||||
that.control_key_active = false;
|
||||
return false;
|
||||
} else if (event.which === 69 && that.control_key_active) {
|
||||
// Edit in Ace = e
|
||||
IPython.fulledit_widget.toggle();
|
||||
that.control_key_active = false;
|
||||
return false;
|
||||
} else if (that.control_key_active) {
|
||||
that.control_key_active = false;
|
||||
return true;
|
||||
|
@ -71,7 +71,8 @@ $(document).ready(function () {
|
||||
}else{
|
||||
// No MathJax, but none expected. No dialog.
|
||||
}
|
||||
|
||||
|
||||
|
||||
IPython.markdown_converter = new Markdown.Converter();
|
||||
IPython.read_only = $('meta[name=read_only]').attr("content") == 'True';
|
||||
|
||||
@ -88,6 +89,7 @@ $(document).ready(function () {
|
||||
IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status');
|
||||
IPython.menubar = new IPython.MenuBar('#menubar')
|
||||
IPython.kernel_status_widget.status_idle();
|
||||
IPython.fulledit_widget = new IPython.FullEditWidget('#fulledit_widget');
|
||||
|
||||
IPython.layout_manager.do_resize();
|
||||
|
||||
@ -104,6 +106,7 @@ $(document).ready(function () {
|
||||
$('#notebook_name').attr('disabled','disabled')
|
||||
}
|
||||
|
||||
$('div#menubar').css('display','block');
|
||||
$('div#main_app').css('display','block');
|
||||
|
||||
// Perform these actions after the notebook has been loaded.
|
||||
|
@ -32,6 +32,7 @@ var IPython = (function (IPython) {
|
||||
{key: 'Ctrl-m c', help: 'copy cell'},
|
||||
{key: 'Ctrl-m v', help: 'paste cell'},
|
||||
{key: 'Ctrl-m d', help: 'delete cell'},
|
||||
{key: 'Ctrl-m e', help: 'toggle edit cell in Ace'},
|
||||
{key: 'Ctrl-m a', help: 'insert cell above'},
|
||||
{key: 'Ctrl-m b', help: 'insert cell below'},
|
||||
{key: 'Ctrl-m t', help: 'toggle output'},
|
||||
|
@ -110,6 +110,8 @@
|
||||
</li>
|
||||
<li><a href="#">Cell</a>
|
||||
<ul>
|
||||
<li id="full_edit_cell"><a href="#">Edit in Ace</a></li>
|
||||
<hr/>
|
||||
<li id="run_cell"><a href="#">Run</a></li>
|
||||
<li id="run_cell_in_place"><a href="#">Run in Place</a></li>
|
||||
<li id="run_all_cells"><a href="#">Run All</a></li>
|
||||
@ -154,6 +156,13 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div id="fulledit_widget" >
|
||||
<div id="fulledit_header">
|
||||
<button id="close_fulledit">Close</button>
|
||||
</div>
|
||||
<div id="fulledit_editor">some text</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/jquery/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/jquery/js/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
@ -166,6 +175,10 @@
|
||||
<script src="/static/codemirror/mode/rst/rst.js" charset="utf-8"></script>
|
||||
<script src="/static/codemirror/mode/markdown/markdown.js" charset="utf-8"></script>
|
||||
|
||||
<script src="/static/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/ace/mode-python.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/ace/theme-textmate.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script src="/static/pagedown/Markdown.Converter.js" charset="utf-8"></script>
|
||||
|
||||
<script src="/static/prettify/prettify.js" charset="utf-8"></script>
|
||||
@ -186,6 +199,7 @@
|
||||
<script src="/static/js/menubar.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/js/notebook.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/js/notebookmain.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/js/fulleditwidget.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user