Commits

Anonymous committed 8a0d2e9

upgrade to jQuery 1.4 and MarkItUp! 1.1.6

  • Participants
  • Parent commits 0561e2f

Comments (0)

Files changed (4)

 tip (unreleased)
 ----------------
 
+- update to jQuery 1.4 and MarkItUp! 1.1.6
+
 - Ajax preview view now uses RequestContext, and additionally passes
   ``MARKITUP_MEDIA_URL`` into the template context. (Previously,
   ``MARKITUP_MEDIA_URL`` was passed as ``MEDIA_URL`` and RequestContext was
 
 * add support for .save_markup method (with selection of markup type)
 
+* link to live demo?

File markitup/media/markitup/jquery.markitup.js

 // ----------------------------------------------------------------------------
 // markItUp! Universal MarkUp Engine, JQuery plugin
-// v 1.1.5
+// v 1.1.6
 // Dual licensed under the MIT and GPL licenses.
 // ----------------------------------------------------------------------------
-// Copyright (C) 2007-2008 Jay Salvat
+// Copyright (C) 2007-2009 Jay Salvat
 // http://markitup.jaysalvat.com/
 // ----------------------------------------------------------------------------
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 						} else {
 							iFrame.insertBefore(header);
 						}	
-						previewWindow = iFrame[iFrame.length-1].contentWindow || frame[iFrame.length-1];
+						previewWindow = iFrame[iFrame.length - 1].contentWindow || frame[iFrame.length - 1];
 					}
 				} else if (altKey === true) {
+					// Thx Stephen M. Redd for the IE8 fix
 					if (iFrame) {
 						iFrame.remove();
+					} else {
+						previewWindow.close();
 					}
-					previewWindow.close();
 					previewWindow = iFrame = false;
 				}
 				if (!options.previewAutoRefresh) {
 
 			// refresh Preview window
 			function refreshPreview() {
+ 				renderPreview();
+			}
+
+			function renderPreview() {		
+				var phtml;
+				if (options.previewParserPath !== '') {
+					$.ajax( {
+						type: 'POST',
+						url: options.previewParserPath,
+						data: options.previewParserVar+'='+encodeURIComponent($$.val()),
+						success: function(data) {
+							writeInPreview( localize(data, 1) ); 
+						}
+					} );
+				} else {
+					if (!template) {
+						$.ajax( {
+							url: options.previewTemplatePath,
+							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;
-					}					
+					}	
+					var h = "test";
 					previewWindow.document.open();
-					previewWindow.document.write(renderPreview());
+					previewWindow.document.write(data);
 					previewWindow.document.close();
 					previewWindow.document.documentElement.scrollTop = sp;
 				}
 					previewWindow.focus();
 				}
 			}
-
-			function renderPreview() {				
-				if (options.previewParserPath !== '') {
-					$.ajax( {
-						type: 'POST',
-						async: false,
-						url: options.previewParserPath,
-						data: options.previewParserVar+'='+encodeURIComponent($$.val()),
-						success: function(data) {
-							phtml = localize(data, 1); 
-						}
-					} );
-				} else {
-					if (!template) {
-						$.ajax( {
-							async: false,
-							url: options.previewTemplatePath,
-							success: function(data) {
-								template = localize(data, 1); 
-							}
-						} );
-					}
-					phtml = template.replace(/<!-- content -->/g, $$.val());
-				}
-				return phtml;
-			}
 			
 			// set keys pressed
 			function keyPressed(e) { 
 					}
 					if (e.keyCode === 13 || e.keyCode === 10) { // Enter key
 						if (ctrlKey === true) {  // Enter + Ctrl
+							console.log("onCtrlEnter");
 							ctrlKey = false;
 							markup(options.onCtrlEnter);
 							return options.onCtrlEnter.keepDefault;
 						} else if (shiftKey === true) { // Enter + Shift
+							console.log("onShiftEnter");
 							shiftKey = false;
 							markup(options.onShiftEnter);
 							return options.onShiftEnter.keepDefault;

File markitup/settings.py

 MARKITUP_SKIN = getattr(settings, 'MARKITUP_SKIN', 'markitup/skins/simple')
 JQUERY_URL = getattr(
     settings, 'JQUERY_URL',
-    'http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js')
+    'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js')