@ -21,6 +21,7 @@ var IPython = (function (IPython) {
this . next _prompt _number = 1 ;
this . kernel = null ;
this . clipboard = null ;
this . paste _enabled = false ;
this . dirty = false ;
this . msg _cell _map = { } ;
this . metadata = { } ;
@ -583,23 +584,30 @@ var IPython = (function (IPython) {
Notebook . prototype . enable _paste = function ( ) {
var that = this ;
$ ( '#paste_cell' ) . removeClass ( 'ui-state-disabled' )
. on ( 'click' , function ( ) { that . paste _cell ( ) ; } ) ;
$ ( '#paste_cell_above' ) . removeClass ( 'ui-state-disabled' )
. on ( 'click' , function ( ) { that . paste _cell _above ( ) ; } ) ;
$ ( '#paste_cell_below' ) . removeClass ( 'ui-state-disabled' )
. on ( 'click' , function ( ) { that . paste _cell _below ( ) ; } ) ;
if ( ! this . paste _enabled ) {
$ ( '#paste_cell' ) . removeClass ( 'ui-state-disabled' )
. on ( 'click' , function ( ) { that . paste _cell ( ) ; } ) ;
$ ( '#paste_cell_above' ) . removeClass ( 'ui-state-disabled' )
. on ( 'click' , function ( ) { that . paste _cell _above ( ) ; } ) ;
$ ( '#paste_cell_below' ) . removeClass ( 'ui-state-disabled' )
. on ( 'click' , function ( ) { that . paste _cell _below ( ) ; } ) ;
this . paste _enabled = true ;
} ;
} ;
Notebook . prototype . disable _paste = function ( ) {
$ ( '#paste_cell' ) . addClass ( 'ui-state-disabled' ) . off ( 'click' ) ;
$ ( '#paste_cell_above' ) . addClass ( 'ui-state-disabled' ) . off ( 'click' ) ;
$ ( '#paste_cell_below' ) . addClass ( 'ui-state-disabled' ) . off ( 'click' ) ;
if ( this . paste _enabled ) {
$ ( '#paste_cell' ) . addClass ( 'ui-state-disabled' ) . off ( 'click' ) ;
$ ( '#paste_cell_above' ) . addClass ( 'ui-state-disabled' ) . off ( 'click' ) ;
$ ( '#paste_cell_below' ) . addClass ( 'ui-state-disabled' ) . off ( 'click' ) ;
this . paste _enabled = false ;
} ;
} ;
Notebook . prototype . cut _cell = function ( ) {
console . log ( 'cut_cell' ) ;
this . copy _cell ( ) ;
this . delete _cell ( ) ;
}
@ -612,7 +620,8 @@ var IPython = (function (IPython) {
Notebook . prototype . paste _cell = function ( ) {
if ( this . clipboard !== null ) {
console . log ( 'paste_cell' ) ;
if ( this . clipboard !== null && this . paste _enabled ) {
var cell _data = this . clipboard ;
if ( cell _data . cell _type == 'code' ) {
new _cell = this . insert _code _cell _above ( ) ;
@ -624,14 +633,14 @@ var IPython = (function (IPython) {
new _cell = this . insert _markdown _cell _above ( ) ;
new _cell . fromJSON ( cell _data ) ;
} ;
this . select _next ( ) ;
this . delete _cell ( ) ;
} ;
this . select _next ( ) ;
this . delete _cell ( ) ;
} ;
Notebook . prototype . paste _cell _above = function ( ) {
if ( this . clipboard !== null ) {
if ( this . clipboard !== null && this . paste _enabled ) {
var cell _data = this . clipboard ;
if ( cell _data . cell _type == 'code' ) {
new _cell = this . insert _code _cell _above ( ) ;
@ -648,16 +657,16 @@ var IPython = (function (IPython) {
Notebook . prototype . paste _cell _below = function ( ) {
if ( this . clipboard !== null ) {
if ( this . clipboard !== null && this . paste _enabled ) {
var cell _data = this . clipboard ;
if ( cell _data . cell _type == 'code' ) {
new _cell = this . insert _code _cell _ a bov e( ) ;
new _cell = this . insert _code _cell _ below ( ) ;
new _cell . fromJSON ( cell _data ) ;
} else if ( cell _data . cell _type === 'html' ) {
new _cell = this . insert _html _cell _ a bov e( ) ;
new _cell = this . insert _html _cell _ below ( ) ;
new _cell . fromJSON ( cell _data ) ;
} else if ( cell _data . cell _type === 'markdown' ) {
new _cell = this . insert _markdown _cell _ a bov e( ) ;
new _cell = this . insert _markdown _cell _ below ( ) ;
new _cell . fromJSON ( cell _data ) ;
} ;
} ;