diff --git a/lib/gollum/frontend/public/gollum/livepreview/images/globe_24.png b/lib/gollum/frontend/public/gollum/livepreview/images/globe_24.png new file mode 100644 index 00000000..8c6ce860 Binary files /dev/null and b/lib/gollum/frontend/public/gollum/livepreview/images/globe_24.png differ diff --git a/lib/gollum/frontend/public/gollum/livepreview/index.html b/lib/gollum/frontend/public/gollum/livepreview/index.html index 301d8943..a7eef1e7 100644 --- a/lib/gollum/frontend/public/gollum/livepreview/index.html +++ b/lib/gollum/frontend/public/gollum/livepreview/index.html @@ -11,6 +11,7 @@
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js b/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
index 1a2f7a1a..0b798f6d 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
@@ -87,6 +87,18 @@ defaultCommitMessage = function() {
// Set comment using the default commit message.
commentEditorSession.setValue( defaultCommitMessage() );
+$.preview = function( previewWindow ) {
+ jQuery.ajax( {
+ type: 'POST',
+ url: baseUrl + '/preview',
+ data: { page: 'Preview: ' + pageName, format: 'markdown', content: editorSession.getValue() },
+ success: function( html ) {
+ previewWindow.document.write( html );
+ previewWindow.focus();
+ }
+ });
+}
+
$.save = function( commitMessage ) {
win.onbeforeunload = null;
@@ -377,8 +389,16 @@ var applyTimeout = function () {
});
}
+ $( '#preview' ).click( function() {
+ $(this).target = "_blank";
+ // pass window into preview
+ $.preview( window.open() );
+ return false;
+ });
+
$( '#save' ).click( function() {
$.save();
+ return false;
});
// Hide dimmer, comment tool panel, and comment.
diff --git a/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt b/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt
index d70c04de..c43bc1cb 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt
+++ b/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt
@@ -15,7 +15,10 @@ CC BY-SA 3.0 Unported
http://blog.twg.ca/2010/11/retina-display-icon-set/
http://creativecommons.org/licenses/by-sa/3.0/legalcode.txt
+ lib/gollum/frontend/public/images/savecomment_24.png
+ lib/gollum/frontend/public/images/cancel_24.png
lib/gollum/frontend/public/images/save_24.png
+ lib/gollum/frontend/public/images/globe_24.png
---