@@ -34,7 +34,7 @@ function MDM( inputElement ) {
34
34
35
35
this . activateControls = function ( controlsElement ) {
36
36
var _self = this ;
37
- [ "bold" , "italic" , "link" , "title" , "list" , "quote" , "code" , "img" , "strike" , "gist" ] . forEach ( function ( actionName ) {
37
+ [ "bold" , "italic" , "link" , "title" , "list" , "quote" , "code" , "multilineCode" , " img", "strike" , "gist" ] . forEach ( function ( actionName ) {
38
38
$ ( controlsElement ) . find ( ".mdm-" + actionName ) . click ( function ( event ) { _self . action ( actionName , event ) } ) ;
39
39
} ) ;
40
40
} ;
@@ -152,6 +152,12 @@ MDM.Actions = {
152
152
$ ( inputElement ) . replaceSelection ( "`" + selection . text + "`" ) ;
153
153
} ,
154
154
155
+ multilineCode : function ( inputElement ) {
156
+ var selection = $ ( inputElement ) . getSelection ( ) ;
157
+ //TODO: cut all empty lines from selection.text
158
+ $ ( inputElement ) . replaceSelection ( "[code]\n" + selection . text + "\n[/code]" ) ;
159
+ } ,
160
+
155
161
img : function ( inputElement ) {
156
162
var link = prompt ( "Image URL" , "http://" ) ;
157
163
if ( link ) {
@@ -232,6 +238,7 @@ MDM.Utils = {
232
238
" <li class=\"mdm-title\"><a tabindex=\"-1\" title=\"height\" class=\"icon-text-height\" href=\"#mdm-title\"><span>T</span></a></li>" +
233
239
" <li class=\"mdm-quote\"><a tabindex=\"-1\" title=\"blockquote\" class=\"icon-comment-alt\" href=\"#mdm-quote\"><span>Q</span></a></li>" +
234
240
" <li class=\"mdm-code\"><a tabindex=\"-1\" title=\"code\" class=\"icon-code\" href=\"#mdm-code\"><span>C</span></a></li>" +
241
+ " <li class=\"mdm-multilineCode\"><a tabindex=\"-1\" title=\"multiline-code\" class=\"icon-terminal\" href=\"#mdm-multilineCode\"><span>MLC</span></a></li>" +
235
242
" <li class=\"mdm-list\"><a tabindex=\"-1\" title=\"list\" class=\"icon-list-ul\" href=\"#mdm-list\"><span>l</span></a></li>" +
236
243
" <li class=\"mdm-link\"><a tabindex=\"-1\" title=\"link\" class=\"icon-link\" href=\"#mdm-link\"><span>a</span></a></li>" +
237
244
" <li class=\"mdm-img\"><a tabindex=\"-1\" title=\"img\" class=\"icon-picture\" href=\"#mdm-img\"><span>Img</span></a></li>" +
0 commit comments