Add preview button to live preview
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 630 B |
@@ -11,6 +11,7 @@
|
|||||||
<div id='previewframe'><div id='contentframe' class='markdown-body'></div></div>
|
<div id='previewframe'><div id='contentframe' class='markdown-body'></div></div>
|
||||||
<!-- tool panel from notepage.es. save & savecomment icons from Retina Display Icon Set. -->
|
<!-- tool panel from notepage.es. save & savecomment icons from Retina Display Icon Set. -->
|
||||||
<div id='toolpanel' class='toolpanel edit' style='width: 500px; right: 0px; visibility: hidden;'>
|
<div id='toolpanel' class='toolpanel edit' style='width: 500px; right: 0px; visibility: hidden;'>
|
||||||
|
<a id='preview' class='edit'><img src='images/globe_24.png' alt='Preview' title='Preview'></a>
|
||||||
<a id='save' class='edit'><img src='images/save_24.png' alt='Save' title='Save'></a>
|
<a id='save' class='edit'><img src='images/save_24.png' alt='Save' title='Save'></a>
|
||||||
<a id='savecomment' class='edit'><img src='images/savecomment_24.png' alt='Save with comment' title='Save with comment'></a>
|
<a id='savecomment' class='edit'><img src='images/savecomment_24.png' alt='Save with comment' title='Save with comment'></a>
|
||||||
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Toggle left to right' title='Toggle left to right'></a>
|
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Toggle left to right' title='Toggle left to right'></a>
|
||||||
|
|||||||
@@ -87,6 +87,18 @@ defaultCommitMessage = function() {
|
|||||||
// Set comment using the default commit message.
|
// Set comment using the default commit message.
|
||||||
commentEditorSession.setValue( defaultCommitMessage() );
|
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 ) {
|
$.save = function( commitMessage ) {
|
||||||
win.onbeforeunload = null;
|
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' ).click( function() {
|
||||||
$.save();
|
$.save();
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hide dimmer, comment tool panel, and comment.
|
// Hide dimmer, comment tool panel, and comment.
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ CC BY-SA 3.0 Unported
|
|||||||
http://blog.twg.ca/2010/11/retina-display-icon-set/
|
http://blog.twg.ca/2010/11/retina-display-icon-set/
|
||||||
http://creativecommons.org/licenses/by-sa/3.0/legalcode.txt
|
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/save_24.png
|
||||||
|
lib/gollum/frontend/public/images/globe_24.png
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user