Show More
@@ -993,15 +993,15 define([ | |||||
993 | Notebook.prototype.to_code = function (index) { |
|
993 | Notebook.prototype.to_code = function (index) { | |
994 | var i = this.index_or_selected(index); |
|
994 | var i = this.index_or_selected(index); | |
995 | if (this.is_valid_cell_index(i)) { |
|
995 | if (this.is_valid_cell_index(i)) { | |
996 |
|
|
996 | var source_cell = this.get_cell(i); | |
997 | if (!(source_cell instanceof codecell.CodeCell)) { |
|
997 | if (!(source_cell instanceof codecell.CodeCell)) { | |
998 | var target_cell = this.insert_cell_below('code',i); |
|
998 | var target_cell = this.insert_cell_below('code',i); | |
999 | var text = source_cell.get_text(); |
|
999 | var text = source_cell.get_text(); | |
1000 | if (text === source_cell.placeholder) { |
|
1000 | if (text === source_cell.placeholder) { | |
1001 | text = ''; |
|
1001 | text = ''; | |
1002 | } |
|
1002 | } | |
1003 | //metadata |
|
1003 | //metadata | |
1004 |
|
|
1004 | target_cell.metadata = source_cell.metadata; | |
1005 |
|
1005 | |||
1006 | target_cell.set_text(text); |
|
1006 | target_cell.set_text(text); | |
1007 | // make this value the starting point, so that we can only undo |
|
1007 | // make this value the starting point, so that we can only undo | |
@@ -1025,7 +1025,7 define([ | |||||
1025 | Notebook.prototype.to_markdown = function (index) { |
|
1025 | Notebook.prototype.to_markdown = function (index) { | |
1026 | var i = this.index_or_selected(index); |
|
1026 | var i = this.index_or_selected(index); | |
1027 | if (this.is_valid_cell_index(i)) { |
|
1027 | if (this.is_valid_cell_index(i)) { | |
1028 |
|
|
1028 | var source_cell = this.get_cell(i); | |
1029 |
|
1029 | |||
1030 | if (!(source_cell instanceof textcell.MarkdownCell)) { |
|
1030 | if (!(source_cell instanceof textcell.MarkdownCell)) { | |
1031 | var target_cell = this.insert_cell_below('markdown',i); |
|
1031 | var target_cell = this.insert_cell_below('markdown',i); | |
@@ -1034,8 +1034,8 define([ | |||||
1034 | if (text === source_cell.placeholder) { |
|
1034 | if (text === source_cell.placeholder) { | |
1035 | text = ''; |
|
1035 | text = ''; | |
1036 | } |
|
1036 | } | |
1037 | // metadata |
|
1037 | // metadata | |
1038 |
|
|
1038 | target_cell.metadata = source_cell.metadata | |
1039 | // We must show the editor before setting its contents |
|
1039 | // We must show the editor before setting its contents | |
1040 | target_cell.unrender(); |
|
1040 | target_cell.unrender(); | |
1041 | target_cell.set_text(text); |
|
1041 | target_cell.set_text(text); | |
@@ -1064,7 +1064,7 define([ | |||||
1064 | var i = this.index_or_selected(index); |
|
1064 | var i = this.index_or_selected(index); | |
1065 | if (this.is_valid_cell_index(i)) { |
|
1065 | if (this.is_valid_cell_index(i)) { | |
1066 | var target_cell = null; |
|
1066 | var target_cell = null; | |
1067 |
|
|
1067 | var source_cell = this.get_cell(i); | |
1068 |
|
1068 | |||
1069 | if (!(source_cell instanceof textcell.RawCell)) { |
|
1069 | if (!(source_cell instanceof textcell.RawCell)) { | |
1070 | target_cell = this.insert_cell_below('raw',i); |
|
1070 | target_cell = this.insert_cell_below('raw',i); | |
@@ -1072,8 +1072,8 define([ | |||||
1072 | if (text === source_cell.placeholder) { |
|
1072 | if (text === source_cell.placeholder) { | |
1073 | text = ''; |
|
1073 | text = ''; | |
1074 | } |
|
1074 | } | |
1075 | //metadata |
|
1075 | //metadata | |
1076 |
|
|
1076 | target_cell.metadata = source_cell.metadata; | |
1077 | // We must show the editor before setting its contents |
|
1077 | // We must show the editor before setting its contents | |
1078 | target_cell.unrender(); |
|
1078 | target_cell.unrender(); | |
1079 | target_cell.set_text(text); |
|
1079 | target_cell.set_text(text); | |
@@ -1100,9 +1100,8 define([ | |||||
1100 | level = level || 1; |
|
1100 | level = level || 1; | |
1101 | var i = this.index_or_selected(index); |
|
1101 | var i = this.index_or_selected(index); | |
1102 | if (this.is_valid_cell_index(i)) { |
|
1102 | if (this.is_valid_cell_index(i)) { | |
1103 |
|
|
1103 | var source_cell = this.get_cell(i); | |
1104 | var target_cell = null; |
|
1104 | var target_cell = null; | |
1105 |
|
||||
1106 | if (source_cell instanceof textcell.HeadingCell) { |
|
1105 | if (source_cell instanceof textcell.HeadingCell) { | |
1107 | source_cell.set_level(level); |
|
1106 | source_cell.set_level(level); | |
1108 | } else { |
|
1107 | } else { | |
@@ -1111,8 +1110,8 define([ | |||||
1111 | if (text === source_cell.placeholder) { |
|
1110 | if (text === source_cell.placeholder) { | |
1112 | text = ''; |
|
1111 | text = ''; | |
1113 | } |
|
1112 | } | |
1114 | //metadata |
|
1113 | //metadata | |
1115 |
|
|
1114 | target_cell.metadata = source_cell.metadata; | |
1116 | // We must show the editor before setting its contents |
|
1115 | // We must show the editor before setting its contents | |
1117 | target_cell.set_level(level); |
|
1116 | target_cell.set_level(level); | |
1118 | target_cell.unrender(); |
|
1117 | target_cell.unrender(); |
General Comments 0
You need to be logged in to leave comments.
Login now