changeset 466:c78c6e007e61

Upgrading to markitup version 1.1.11. This fixes #226.
author Brian Neal <bgneal@gmail.com>
date Sun, 24 Jul 2011 02:35:17 +0000
parents 79d454ff2de0
children b910cc1460c8
files static/js/markitup/jquery.markitup.js static/js/markitup/jquery.markitup.pack.js static/js/markitup/sets/default/images/list-bullet.png static/js/markitup/sets/default/images/list-numeric.png static/js/markitup/sets/default/set.js static/js/markitup/sets/default/style.css static/js/markitup/skins/markitup/style.css static/js/markitup/skins/simple/style.css
diffstat 8 files changed, 72 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/static/js/markitup/jquery.markitup.js	Sat Jul 09 02:28:33 2011 +0000
+++ b/static/js/markitup/jquery.markitup.js	Sun Jul 24 02:35:17 2011 +0000
@@ -1,9 +1,9 @@
 // ----------------------------------------------------------------------------
 // markItUp! Universal MarkUp Engine, JQuery plugin
-// v 1.1.x
+// v 1.1.11
 // Dual licensed under the MIT and GPL licenses.
 // ----------------------------------------------------------------------------
-// Copyright (C) 2007-2010 Jay Salvat
+// Copyright (C) 2007-2011 Jay Salvat
 // http://markitup.jaysalvat.com/
 // ----------------------------------------------------------------------------
 // Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -36,6 +36,7 @@
 					previewAutoRefresh:		true,
 					previewPosition:		'after',
 					previewTemplatePath:	'~/templates/preview.html',
+					previewParser:			false,
 					previewParserPath:		'',
 					previewParserVar:		'data',
 					resizeHandle:			true,
@@ -162,9 +163,9 @@
 							return false;
 						}).click(function() {
 							return false;
-						}).focusin(function(){
+						}).bind("focusin", function(){
                             $$.focus();
-						}).mousedown(function() {
+						}).mouseup(function() {
 							if (button.call) {
 								eval(button.call)();
 							}
@@ -233,17 +234,39 @@
 
 			// build block to insert
 			function build(string) {
-				openWith 	= prepare(clicked.openWith);
-				placeHolder = prepare(clicked.placeHolder);
-				replaceWith = prepare(clicked.replaceWith);
-				closeWith 	= prepare(clicked.closeWith);
+				var openWith 			= prepare(clicked.openWith);
+				var placeHolder 		= prepare(clicked.placeHolder);
+				var replaceWith 		= prepare(clicked.replaceWith);
+				var closeWith 			= prepare(clicked.closeWith);
+				var openBlockWith 		= prepare(clicked.openBlockWith);
+				var closeBlockWith 		= prepare(clicked.closeBlockWith);
+				var multiline 			= clicked.multiline;
+				
 				if (replaceWith !== "") {
 					block = openWith + replaceWith + closeWith;
 				} else if (selection === '' && placeHolder !== '') {
 					block = openWith + placeHolder + closeWith;
 				} else {
-					block = openWith + (string||selection) + closeWith;
+					string = string || selection;
+
+					var lines = selection.split(/\r?\n/), blocks = [];
+					for (var l=0; l < lines.length; l++) {
+						line = lines[l];
+						if ($.trim(line) == '') {
+							continue;
+						}
+						if (line.match(/ +$/)) {
+							blocks.push(openWith + line.replace(/ $/, '') + closeWith + ' ');
+						} else {
+							blocks.push(openWith + line + closeWith);
+						}
+					}
+					
+					block = blocks.join("\n");
 				}
+
+				block = openBlockWith + block + closeBlockWith;
+
 				return {	block:block, 
 							openWith:openWith, 
 							replaceWith:replaceWith, 
@@ -257,7 +280,6 @@
 				var len, j, n, i;
 				hash = clicked = button;
 				get();
-
 				$.extend(hash, {	line:"", 
 						 			root:options.root,
 									textarea:textarea, 
@@ -271,12 +293,12 @@
 				// callbacks before insertion
 				prepare(options.beforeInsert);
 				prepare(clicked.beforeInsert);
-				if (ctrlKey === true && shiftKey === true) {
+				if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
 					prepare(clicked.beforeMultiInsert);
 				}			
 				$.extend(hash, { line:1 });
-				
-				if (ctrlKey === true && shiftKey === true) {
+
+				if ((ctrlKey === true && shiftKey === true)) {
 					lines = selection.split(/\r?\n/);
 					for (j = 0, n = lines.length, i = 0; i < n; i++) {
 						if ($.trim(lines[i]) !== '') {
@@ -293,6 +315,7 @@
 					string = build(selection);
 					start = caretPosition + string.openWith.length;
 					len = string.block.length - string.openWith.length - string.closeWith.length;
+					len = len - (string.block.match(/ $/) ? 1 : 0);
 					len -= fixIeBug(string.block);
 				} else if (shiftKey === true) {
 					string = build(selection);
@@ -327,7 +350,7 @@
 				$.extend(hash, { line:'', selection:selection });
 
 				// callbacks after insertion
-				if (ctrlKey === true && shiftKey === true) {
+				if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
 					prepare(clicked.afterMultiInsert);
 				}
 				prepare(clicked.afterInsert);
@@ -406,6 +429,7 @@
 					}
 				} else { // gecko & webkit
 					caretPosition = textarea.selectionStart;
+
 					selection = textarea.value.substring(caretPosition, textarea.selectionEnd);
 				} 
 				return selection;
@@ -451,23 +475,30 @@
 
 			function renderPreview() {		
 				var phtml;
-				if (options.previewParserPath !== '') {
-					$.ajax( {
+				if (options.previewParser && typeof options.previewParser === 'function') {
+					var data = options.previewParser( $$.val() );
+					writeInPreview( localize(data, 1) ); 
+				} else if (options.previewParserPath !== '') {
+					$.ajax({
 						type: 'POST',
+						dataType: 'text',
+						global: false,
 						url: options.previewParserPath,
 						data: options.previewParserVar+'='+encodeURIComponent($$.val()),
 						success: function(data) {
 							writeInPreview( localize(data, 1) ); 
 						}
-					} );
+					});
 				} else {
 					if (!template) {
-						$.ajax( {
+						$.ajax({
 							url: options.previewTemplatePath,
+							dataType: 'text',
+							global: false,
 							success: function(data) {
 								writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
 							}
-						} );
+						});
 					}
 				}
 				return false;
@@ -491,15 +522,15 @@
 			function keyPressed(e) { 
 				shiftKey = e.shiftKey;
 				altKey = e.altKey;
-				ctrlKey = (!(e.altKey && e.ctrlKey)) ? e.ctrlKey : false;
+				ctrlKey = (!(e.altKey && e.ctrlKey)) ? (e.ctrlKey || e.metaKey) : false;
 
 				if (e.type === 'keydown') {
 					if (ctrlKey === true) {
-						li = $("a[accesskey="+String.fromCharCode(e.keyCode)+"]", header).parent('li');
+						li = $('a[accesskey="'+String.fromCharCode(e.keyCode)+'"]', header).parent('li');
 						if (li.length !== 0) {
 							ctrlKey = false;
 							setTimeout(function() {
-								li.triggerHandler('mousedown');
+								li.triggerHandler('mouseup');
 							},1);
 							return false;
 						}
--- a/static/js/markitup/jquery.markitup.pack.js	Sat Jul 09 02:28:33 2011 +0000
+++ b/static/js/markitup/jquery.markitup.pack.js	Sun Jul 24 02:35:17 2011 +0000
@@ -1,2 +1,1 @@
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(3($){$.2O.X=3(14,28){z 4,q,w,J;q=w=J=k;4={E:\'\',18:\'\',W:\'\',1n:\'\',1D:f,2E:\'2B\',1r:\'~/36/1C.1M\',1i:\'\',2M:\'K\',1w:f,1H:\'\',1W:\'\',1J:{},1K:{},1L:{},1P:{},1t:[{}]};$.Y(4,14,28);2(!4.W){$(\'33\').1g(3(a,2k){1Z=$(2k).1c(0).30.2X(/(.*)2Z\\.3a(\\.3o)?\\.3k$/);2(1Z!==2o){4.W=1Z[1]}})}7 L.1g(3(){z $$,c,19,15,o,H,M,Q,1a,1u,u,2L,N,1b;$$=$(L);c=L;19=[];1b=k;15=o=0;H=-1;4.1i=1j(4.1i);4.1r=1j(4.1r);3 1j(K,2i){2(2i){7 K.Z(/("|\')~\\//g,"$1"+4.W)}7 K.Z(/^~\\//,4.W)}3 2C(){E=\'\';18=\'\';2(4.E){E=\'E="\'+4.E+\'"\'}d 2($$.1S("E")){E=\'E="X\'+($$.1S("E").2h(0,1).3n())+($$.1S("E").2h(1))+\'"\'}2(4.18){18=\'P="\'+4.18+\'"\'}$$.1N(\'<v \'+18+\'></v>\');$$.1N(\'<v \'+E+\' P="X"></v>\');$$.1N(\'<v P="3g"></v>\');$$.2a("2S");1a=$(\'<v P="3h"></v>\').2A($$);$(1T(4.1t)).23(1a);1u=$(\'<v P="3i"></v>\').1G($$);2(4.1w===f&&$.12.3f!==f){1w=$(\'<v P="3e"></v>\').1G($$).1h("1U",3(e){z h=$$.2j(),y=e.2g,1v,1x;1v=3(e){$$.2d("2j",3b.3q(20,e.2g+h-y)+"3r");7 k};1x=3(e){$("1M").1O("2f",1v).1O("2b",1x);7 k};$("1M").1h("2f",1v).1h("2b",1x)});1u.2q(1w)}$$.2z(24).3s(24);$$.1h("1R",3(e,14){2(14.1m!==k){1c()}2(c===$.X.2c){11(14)}});$$.16(3(){$.X.2c=L})}3 1T(1t){z D=$(\'<D></D>\'),i=0;$(\'B:2t > D\',D).2d(\'32\',\'m\');$.1g(1t,3(){z p=L,t=\'\',1q,B,j;1q=(p.17)?(p.1I||\'\')+\' [31+\'+p.17+\']\':(p.1I||\'\');17=(p.17)?\'2y="\'+p.17+\'"\':\'\';2(p.2e){B=$(\'<B P="2Y">\'+(p.2e||\'\')+\'</B>\').23(D)}d{i++;2v(j=19.8-1;j>=0;j--){t+=19[j]+"-"}B=$(\'<B P="2l 2l\'+t+(i)+\' \'+(p.38||\'\')+\'"><a 37="" \'+17+\' 1q="\'+1q+\'">\'+(p.1I||\'\')+\'</a></B>\').1h("3c",3(){7 k}).2u(3(){7 k}).3C(3(){$$.16()}).1U(3(){2(p.2s){3Q(p.2s)()}2x(3(){11(p)},1);7 k}).2t(3(){$(\'> D\',L).3P();$(C).3O(\'2u\',3(){$(\'D D\',1a).2r()})},3(){$(\'> D\',L).2r()}).23(D);2(p.2m){19.3M(i);$(B).2a(\'3T\').2q(1T(p.2m))}}});19.3X();7 D}3 2p(6){2(6){6=6.3U();6=6.Z(/\\(\\!\\(([\\s\\S]*?)\\)\\!\\)/g,3(x,a){z b=a.1E(\'|!|\');2(J===f){7(b[1]!==2n)?b[1]:b[0]}d{7(b[1]===2n)?"":b[0]}});6=6.Z(/\\[\\!\\[([\\s\\S]*?)\\]\\!\\]/g,3(x,a){z b=a.1E(\':!:\');2(1b===f){7 k}V=3y(b[0],(b[1])?b[1]:\'\');2(V===2o){1b=f}7 V});7 6}7""}3 F(1k){2($.3J(1k)){1k=1k(Q)}7 2p(1k)}3 1l(6){I=F(M.I);1e=F(M.1e);R=F(M.R);O=F(M.O);2(R!==""){m=I+R+O}d 2(l===\'\'&&1e!==\'\'){m=I+1e+O}d{m=I+(6||l)+O}7{m:m,I:I,R:R,1e:1e,O:O}}3 11(p){z A,j,n,i;Q=M=p;1c();$.Y(Q,{1o:"",W:4.W,c:c,l:(l||\'\'),o:o,q:q,w:w,J:J});F(4.1H);F(M.1H);2(q===f&&w===f){F(M.3E)}$.Y(Q,{1o:1});2(q===f&&w===f){T=l.1E(/\\r?\\n/);2v(j=0,n=T.8,i=0;i<n;i++){2($.40(T[i])!==\'\'){$.Y(Q,{1o:++j,l:T[i]});T[i]=1l(T[i]).m}d{T[i]=""}}6={m:T.3z(\'\\n\')};G=o;A=6.m.8+(($.12.1V)?n-1:0)}d 2(q===f){6=1l(l);G=o+6.I.8;A=6.m.8-6.I.8-6.O.8;A-=1A(6.m)}d 2(w===f){6=1l(l);G=o;A=6.m.8;A-=1A(6.m)}d{6=1l(l);G=o+6.m.8;A=0;G-=1A(6.m)}2((l===\'\'&&6.R===\'\')){H+=22(6.m);G=o+6.I.8;A=6.m.8-6.I.8-6.O.8;H=$$.1d().1f(o,$$.1d().8).8;H-=22($$.1d().1f(0,o))}$.Y(Q,{o:o,15:15});2(6.m!==l&&1b===k){27(6.m);1Q(G,A)}d{H=-1}1c();$.Y(Q,{1o:\'\',l:l});2(q===f&&w===f){F(M.3w)}F(M.1W);F(4.1W);2(u&&4.1D){1F()}w=J=q=1b=k}3 22(6){2($.12.1V){7 6.8-6.Z(/\\n*/g,\'\').8}7 0}3 1A(6){2($.12.2R){7 6.8-6.Z(/\\r*/g,\'\').8}7 0}3 27(m){2(C.l){z 29=C.l.1X();29.2w=m}d{c.V=c.V.1f(0,o)+m+c.V.1f(o+l.8,c.V.8)}}3 1Q(G,A){2(c.2U){2($.12.1V&&$.12.3R>=9.5&&A==0){7 k}U=c.2U();U.3V(f);U.2T(\'1Y\',G);U.3K(\'1Y\',A);U.3A()}d 2(c.2W){c.2W(G,G+A)}c.1z=15;c.16()}3 1c(){c.16();15=c.1z;2(C.l){l=C.l.1X().2w;2($.12.2R){z U=C.l.1X(),1y=U.3u();1y.3B(c);o=-1;3I(1y.3G(U)){1y.2T(\'1Y\');o++}}d{o=c.2V}}d{o=c.2V;l=c.V.1f(o,c.3N)}7 l}3 1C(){2(!u||u.3F){2(4.1n){u=2D.2I(\'\',\'1C\',4.1n);$(2D).3D(3(){u.21()})}d{N=$(\'<2P P="3H"></2P>\');2(4.2E==\'2B\'){N.1G(1u)}d{N.2A(1a)}u=N[N.8-1].3v||3L[N.8-1]}}d 2(J===f){2(N){N.3W()}d{u.21()}u=N=k}2(!4.1D){1F()}2(4.1n){u.16()}}3 1F(){2G()}3 2G(){z 3Z;2(4.1i!==\'\'){$.2K({2F:\'3Y\',2H:4.1i,K:4.2M+\'=\'+3S($$.1d()),2J:3(K){26(1j(K,1))}})}d{2(!2L){$.2K({2H:4.1r,2J:3(K){26(1j(K,1).Z(/<!-- 3t -->/g,$$.1d()))}})}}7 k}3 26(K){2(u.C){35{25=u.C.2N.1z}34(e){25=0}u.C.2I();u.C.39(K);u.C.21();u.C.2N.1z=25}}3 24(e){w=e.w;J=e.J;q=(!(e.J&&e.q))?e.q:k;2(e.2F===\'2z\'){2(q===f){B=$("a[2y="+3m.3l(e.1s)+"]",1a).1B(\'B\');2(B.8!==0){q=k;2x(3(){B.3p(\'1U\')},1);7 k}}2(e.1s===13||e.1s===10){2(q===f){q=k;11(4.1L);7 4.1L.1p}d 2(w===f){w=k;11(4.1K);7 4.1K.1p}d{11(4.1J);7 4.1J.1p}}2(e.1s===9){2(w==f||q==f||J==f){7 k}2(H!==-1){1c();H=$$.1d().8-H;1Q(H,0);H=-1;7 k}d{11(4.1P);7 4.1P.1p}}}}2C()})};$.2O.3d=3(){7 L.1g(3(){z $$=$(L).1O().3j(\'2S\');$$.1B(\'v\').1B(\'v.X\').1B(\'v\').R($$)})};$.X=3(14){z 4={1m:k};$.Y(4,14);2(4.1m){7 $(4.1m).1g(3(){$(L).16();$(L).2Q(\'1R\',[4])})}d{$(\'c\').2Q(\'1R\',[4])}}})(3x);',62,249,'||if|function|options||string|return|length||||textarea|else||true|||||false|selection|block||caretPosition|button|ctrlKey||||previewWindow|div|shiftKey|||var|len|li|document|ul|id|prepare|start|caretOffset|openWith|altKey|data|this|clicked|iFrame|closeWith|class|hash|replaceWith||lines|range|value|root|markItUp|extend|replace||markup|browser||settings|scrollPosition|focus|key|nameSpace|levels|header|abort|get|val|placeHolder|substring|each|bind|previewParserPath|localize|action|build|target|previewInWindow|line|keepDefault|title|previewTemplatePath|keyCode|markupSet|footer|mouseMove|resizeHandle|mouseUp|rangeCopy|scrollTop|fixIeBug|parent|preview|previewAutoRefresh|split|refreshPreview|insertAfter|beforeInsert|name|onEnter|onShiftEnter|onCtrlEnter|html|wrap|unbind|onTab|set|insertion|attr|dropMenus|mousedown|opera|afterInsert|createRange|character|miuScript||close|fixOperaBug|appendTo|keyPressed|sp|writeInPreview|insert|extraSettings|newSelection|addClass|mouseup|focused|css|separator|mousemove|clientY|substr|inText|height|tag|markItUpButton|dropMenu|undefined|null|magicMarkups|append|hide|call|hover|click|for|text|setTimeout|accesskey|keydown|insertBefore|after|init|window|previewPosition|type|renderPreview|url|open|success|ajax|template|previewParserVar|documentElement|fn|iframe|trigger|msie|markItUpEditor|moveStart|createTextRange|selectionStart|setSelectionRange|match|markItUpSeparator|jquery|src|Ctrl|display|script|catch|try|templates|href|className|write|markitup|Math|contextmenu|markItUpRemove|markItUpResizeHandle|safari|markItUpContainer|markItUpHeader|markItUpFooter|removeClass|js|fromCharCode|String|toUpperCase|pack|triggerHandler|max|px|keyup|content|duplicate|contentWindow|afterMultiInsert|jQuery|prompt|join|select|moveToElementText|focusin|unload|beforeMultiInsert|closed|inRange|markItUpPreviewFrame|while|isFunction|moveEnd|frame|push|selectionEnd|one|show|eval|version|encodeURIComponent|markItUpDropMenu|toString|collapse|remove|pop|POST|phtml|trim'.split('|'),0,{}))
-
+(function($){$.fn.markItUp=function(settings,extraSettings){var options,ctrlKey,shiftKey,altKey;ctrlKey=shiftKey=altKey=false;options={id:'',nameSpace:'',root:'',previewInWindow:'',previewAutoRefresh:true,previewPosition:'after',previewTemplatePath:'~/templates/preview.html',previewParser:false,previewParserPath:'',previewParserVar:'data',resizeHandle:true,beforeInsert:'',afterInsert:'',onEnter:{},onShiftEnter:{},onCtrlEnter:{},onTab:{},markupSet:[{}]};$.extend(options,settings,extraSettings);if(!options.root){$('script').each(function(a,tag){miuScript=$(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);if(miuScript!==null){options.root=miuScript[1]}})}return this.each(function(){var $$,textarea,levels,scrollPosition,caretPosition,caretOffset,clicked,hash,header,footer,previewWindow,template,iFrame,abort;$$=$(this);textarea=this;levels=[];abort=false;scrollPosition=caretPosition=0;caretOffset=-1;options.previewParserPath=localize(options.previewParserPath);options.previewTemplatePath=localize(options.previewTemplatePath);function localize(data,inText){if(inText){return data.replace(/("|')~\//g,"$1"+options.root)}return data.replace(/^~\//,options.root)}function init(){id='';nameSpace='';if(options.id){id='id="'+options.id+'"'}else if($$.attr("id")){id='id="markItUp'+($$.attr("id").substr(0,1).toUpperCase())+($$.attr("id").substr(1))+'"'}if(options.nameSpace){nameSpace='class="'+options.nameSpace+'"'}$$.wrap('<div '+nameSpace+'></div>');$$.wrap('<div '+id+' class="markItUp"></div>');$$.wrap('<div class="markItUpContainer"></div>');$$.addClass("markItUpEditor");header=$('<div class="markItUpHeader"></div>').insertBefore($$);$(dropMenus(options.markupSet)).appendTo(header);footer=$('<div class="markItUpFooter"></div>').insertAfter($$);if(options.resizeHandle===true&&$.browser.safari!==true){resizeHandle=$('<div class="markItUpResizeHandle"></div>').insertAfter($$).bind("mousedown",function(e){var h=$$.height(),y=e.clientY,mouseMove,mouseUp;mouseMove=function(e){$$.css("height",Math.max(20,e.clientY+h-y)+"px");return false};mouseUp=function(e){$("html").unbind("mousemove",mouseMove).unbind("mouseup",mouseUp);return false};$("html").bind("mousemove",mouseMove).bind("mouseup",mouseUp)});footer.append(resizeHandle)}$$.keydown(keyPressed).keyup(keyPressed);$$.bind("insertion",function(e,settings){if(settings.target!==false){get()}if(textarea===$.markItUp.focused){markup(settings)}});$$.focus(function(){$.markItUp.focused=this})}function dropMenus(markupSet){var ul=$('<ul></ul>'),i=0;$('li:hover > ul',ul).css('display','block');$.each(markupSet,function(){var button=this,t='',title,li,j;title=(button.key)?(button.name||'')+' [Ctrl+'+button.key+']':(button.name||'');key=(button.key)?'accesskey="'+button.key+'"':'';if(button.separator){li=$('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul)}else{i++;for(j=levels.length-1;j>=0;j--){t+=levels[j]+"-"}li=$('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>').bind("contextmenu",function(){return false}).click(function(){return false}).bind("focusin",function(){$$.focus()}).mouseup(function(){if(button.call){eval(button.call)()}setTimeout(function(){markup(button)},1);return false}).hover(function(){$('> ul',this).show();$(document).one('click',function(){$('ul ul',header).hide()})},function(){$('> ul',this).hide()}).appendTo(ul);if(button.dropMenu){levels.push(i);$(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu))}}});levels.pop();return ul}function magicMarkups(string){if(string){string=string.toString();string=string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,function(x,a){var b=a.split('|!|');if(altKey===true){return(b[1]!==undefined)?b[1]:b[0]}else{return(b[1]===undefined)?"":b[0]}});string=string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,function(x,a){var b=a.split(':!:');if(abort===true){return false}value=prompt(b[0],(b[1])?b[1]:'');if(value===null){abort=true}return value});return string}return""}function prepare(action){if($.isFunction(action)){action=action(hash)}return magicMarkups(action)}function build(string){var openWith=prepare(clicked.openWith);var placeHolder=prepare(clicked.placeHolder);var replaceWith=prepare(clicked.replaceWith);var closeWith=prepare(clicked.closeWith);var openBlockWith=prepare(clicked.openBlockWith);var closeBlockWith=prepare(clicked.closeBlockWith);var multiline=clicked.multiline;if(replaceWith!==""){block=openWith+replaceWith+closeWith}else if(selection===''&&placeHolder!==''){block=openWith+placeHolder+closeWith}else{string=string||selection;var lines=selection.split(/\r?\n/),blocks=[];for(var l=0;l<lines.length;l++){line=lines[l];if($.trim(line)==''){continue}if(line.match(/ +$/)){blocks.push(openWith+line.replace(/ $/,'')+closeWith+' ')}else{blocks.push(openWith+line+closeWith)}}block=blocks.join("\n")}block=openBlockWith+block+closeBlockWith;return{block:block,openWith:openWith,replaceWith:replaceWith,placeHolder:placeHolder,closeWith:closeWith}}function markup(button){var len,j,n,i;hash=clicked=button;get();$.extend(hash,{line:"",root:options.root,textarea:textarea,selection:(selection||''),caretPosition:caretPosition,ctrlKey:ctrlKey,shiftKey:shiftKey,altKey:altKey});prepare(options.beforeInsert);prepare(clicked.beforeInsert);if((ctrlKey===true&&shiftKey===true)||button.multiline===true){prepare(clicked.beforeMultiInsert)}$.extend(hash,{line:1});if((ctrlKey===true&&shiftKey===true)){lines=selection.split(/\r?\n/);for(j=0,n=lines.length,i=0;i<n;i++){if($.trim(lines[i])!==''){$.extend(hash,{line:++j,selection:lines[i]});lines[i]=build(lines[i]).block}else{lines[i]=""}}string={block:lines.join('\n')};start=caretPosition;len=string.block.length+(($.browser.opera)?n-1:0)}else if(ctrlKey===true){string=build(selection);start=caretPosition+string.openWith.length;len=string.block.length-string.openWith.length-string.closeWith.length;len=len-(string.block.match(/ $/)?1:0);len-=fixIeBug(string.block)}else if(shiftKey===true){string=build(selection);start=caretPosition;len=string.block.length;len-=fixIeBug(string.block)}else{string=build(selection);start=caretPosition+string.block.length;len=0;start-=fixIeBug(string.block)}if((selection===''&&string.replaceWith==='')){caretOffset+=fixOperaBug(string.block);start=caretPosition+string.openWith.length;len=string.block.length-string.openWith.length-string.closeWith.length;caretOffset=$$.val().substring(caretPosition,$$.val().length).length;caretOffset-=fixOperaBug($$.val().substring(0,caretPosition))}$.extend(hash,{caretPosition:caretPosition,scrollPosition:scrollPosition});if(string.block!==selection&&abort===false){insert(string.block);set(start,len)}else{caretOffset=-1}get();$.extend(hash,{line:'',selection:selection});if((ctrlKey===true&&shiftKey===true)||button.multiline===true){prepare(clicked.afterMultiInsert)}prepare(clicked.afterInsert);prepare(options.afterInsert);if(previewWindow&&options.previewAutoRefresh){refreshPreview()}shiftKey=altKey=ctrlKey=abort=false}function fixOperaBug(string){if($.browser.opera){return string.length-string.replace(/\n*/g,'').length}return 0}function fixIeBug(string){if($.browser.msie){return string.length-string.replace(/\r*/g,'').length}return 0}function insert(block){if(document.selection){var newSelection=document.selection.createRange();newSelection.text=block}else{textarea.value=textarea.value.substring(0,caretPosition)+block+textarea.value.substring(caretPosition+selection.length,textarea.value.length)}}function set(start,len){if(textarea.createTextRange){if($.browser.opera&&$.browser.version>=9.5&&len==0){return false}range=textarea.createTextRange();range.collapse(true);range.moveStart('character',start);range.moveEnd('character',len);range.select()}else if(textarea.setSelectionRange){textarea.setSelectionRange(start,start+len)}textarea.scrollTop=scrollPosition;textarea.focus()}function get(){textarea.focus();scrollPosition=textarea.scrollTop;if(document.selection){selection=document.selection.createRange().text;if($.browser.msie){var range=document.selection.createRange(),rangeCopy=range.duplicate();rangeCopy.moveToElementText(textarea);caretPosition=-1;while(rangeCopy.inRange(range)){rangeCopy.moveStart('character');caretPosition++}}else{caretPosition=textarea.selectionStart}}else{caretPosition=textarea.selectionStart;selection=textarea.value.substring(caretPosition,textarea.selectionEnd)}return selection}function preview(){if(!previewWindow||previewWindow.closed){if(options.previewInWindow){previewWindow=window.open('','preview',options.previewInWindow);$(window).unload(function(){previewWindow.close()})}else{iFrame=$('<iframe class="markItUpPreviewFrame"></iframe>');if(options.previewPosition=='after'){iFrame.insertAfter(footer)}else{iFrame.insertBefore(header)}previewWindow=iFrame[iFrame.length-1].contentWindow||frame[iFrame.length-1]}}else if(altKey===true){if(iFrame){iFrame.remove()}else{previewWindow.close()}previewWindow=iFrame=false}if(!options.previewAutoRefresh){refreshPreview()}if(options.previewInWindow){previewWindow.focus()}}function refreshPreview(){renderPreview()}function renderPreview(){var phtml;if(options.previewParser&&typeof options.previewParser==='function'){var data=options.previewParser($$.val());writeInPreview(localize(data,1))}else if(options.previewParserPath!==''){$.ajax({type:'POST',dataType:'text',global:false,url:options.previewParserPath,data:options.previewParserVar+'='+encodeURIComponent($$.val()),success:function(data){writeInPreview(localize(data,1))}})}else{if(!template){$.ajax({url:options.previewTemplatePath,dataType:'text',global:false,success:function(data){writeInPreview(localize(data,1).replace(/<!-- content -->/g,$$.val()))}})}}return false}function writeInPreview(data){if(previewWindow.document){try{sp=previewWindow.document.documentElement.scrollTop}catch(e){sp=0}previewWindow.document.open();previewWindow.document.write(data);previewWindow.document.close();previewWindow.document.documentElement.scrollTop=sp}}function keyPressed(e){shiftKey=e.shiftKey;altKey=e.altKey;ctrlKey=(!(e.altKey&&e.ctrlKey))?(e.ctrlKey||e.metaKey):false;if(e.type==='keydown'){if(ctrlKey===true){li=$('a[accesskey="'+String.fromCharCode(e.keyCode)+'"]',header).parent('li');if(li.length!==0){ctrlKey=false;setTimeout(function(){li.triggerHandler('mouseup')},1);return false}}if(e.keyCode===13||e.keyCode===10){if(ctrlKey===true){ctrlKey=false;markup(options.onCtrlEnter);return options.onCtrlEnter.keepDefault}else if(shiftKey===true){shiftKey=false;markup(options.onShiftEnter);return options.onShiftEnter.keepDefault}else{markup(options.onEnter);return options.onEnter.keepDefault}}if(e.keyCode===9){if(shiftKey==true||ctrlKey==true||altKey==true){return false}if(caretOffset!==-1){get();caretOffset=$$.val().length-caretOffset;set(caretOffset,0);caretOffset=-1;return false}else{markup(options.onTab);return options.onTab.keepDefault}}}}init()})};$.fn.markItUpRemove=function(){return this.each(function(){var $$=$(this).unbind().removeClass('markItUpEditor');$$.parent('div').parent('div.markItUp').parent('div').replaceWith($$)})};$.markItUp=function(settings){var options={target:false};$.extend(options,settings);if(options.target){return $(options.target).each(function(){$(this).focus();$(this).trigger('insertion',[options])})}else{$('textarea').trigger('insertion',[options])}}})(jQuery);
Binary file static/js/markitup/sets/default/images/list-bullet.png has changed
Binary file static/js/markitup/sets/default/images/list-numeric.png has changed
--- a/static/js/markitup/sets/default/set.js	Sat Jul 09 02:28:33 2011 +0000
+++ b/static/js/markitup/sets/default/set.js	Sun Jul 24 02:35:17 2011 +0000
@@ -1,7 +1,7 @@
 // ----------------------------------------------------------------------------
 // markItUp!
 // ----------------------------------------------------------------------------
-// Copyright (C) 2008 Jay Salvat
+// Copyright (C) 2011 Jay Salvat
 // http://markitup.jaysalvat.com/
 // ----------------------------------------------------------------------------
 // Html tags
@@ -9,7 +9,7 @@
 // ----------------------------------------------------------------------------
 // Basic set. Feel free to add more tags
 // ----------------------------------------------------------------------------
-mySettings = {	
+var mySettings = {
 	onShiftEnter:  	{keepDefault:false, replaceWith:'<br />\n'},
 	onCtrlEnter:  	{keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
 	onTab:    		{keepDefault:false, replaceWith:'    '},
@@ -18,10 +18,13 @@
 		{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)'  },
 		{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
 		{separator:'---------------' },
+		{name:'Bulleted List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
+		{name:'Numeric List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
+		{separator:'---------------' },
 		{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
 		{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
 		{separator:'---------------' },
 		{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },		
 		{name:'Preview', className:'preview',  call:'preview'}
 	]
-}
\ No newline at end of file
+}
--- a/static/js/markitup/sets/default/style.css	Sat Jul 09 02:28:33 2011 +0000
+++ b/static/js/markitup/sets/default/style.css	Sun Jul 24 02:35:17 2011 +0000
@@ -13,15 +13,22 @@
 }
 
 .markItUp .markItUpButton4 a {
+	background-image:url(images/list-bullet.png); 
+}
+.markItUp .markItUpButton5 a {
+	background-image:url(images/list-numeric.png);
+}
+
+.markItUp .markItUpButton6 a {
 	background-image:url(images/picture.png); 
 }
-.markItUp .markItUpButton5 a {
+.markItUp .markItUpButton7 a {
 	background-image:url(images/link.png);
 }
 
-.markItUp .markItUpButton6 a {
+.markItUp .markItUpButton8 a {
 	background-image:url(images/clean.png);
 }
 .markItUp .preview a {
 	background-image:url(images/preview.png);
-}
\ No newline at end of file
+}
--- a/static/js/markitup/skins/markitup/style.css	Sat Jul 09 02:28:33 2011 +0000
+++ b/static/js/markitup/skins/markitup/style.css	Sun Jul 24 02:35:17 2011 +0000
@@ -29,7 +29,7 @@
 	width:543px;
 	height:160px;
 	background:#FFF url(images/bg-editor.png) no-repeat;
-	clear:both; display:block;
+	clear:both;
 	line-height:18px;
 	overflow:auto;
 }
--- a/static/js/markitup/skins/simple/style.css	Sat Jul 09 02:28:33 2011 +0000
+++ b/static/js/markitup/skins/simple/style.css	Sun Jul 24 02:35:17 2011 +0000
@@ -23,7 +23,7 @@
 	padding:5px;
 	width:690px;
 	height:320px;
-	clear:both; display:block;
+	clear:both;
 	line-height:18px;
 	overflow:auto;
 }