mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 08:56:17 -04:00
Add ability to export specific pad revisions
This commit is contained in:
parent
ddf1cd345c
commit
2a86d57e46
10 changed files with 96 additions and 29 deletions
|
@ -195,6 +195,11 @@ float:right;
|
|||
color: #222;
|
||||
}
|
||||
|
||||
#importexport{
|
||||
top:103px;
|
||||
width:185px;
|
||||
}
|
||||
|
||||
ul { margin-left: 1.5em; }
|
||||
ul ul { margin-left: 0 !important; }
|
||||
ul.list-bullet1 { margin-left: 1.5em; }
|
||||
|
|
|
@ -156,7 +156,7 @@ var padeditbar = (function()
|
|||
}, cmd, true);
|
||||
}
|
||||
}
|
||||
padeditor.ace.focus();
|
||||
if(padeditor.ace) padeditor.ace.focus();
|
||||
},
|
||||
toogleDropDown: function(moduleName)
|
||||
{
|
||||
|
|
|
@ -236,11 +236,16 @@ var padimpexp = (function()
|
|||
var self = {
|
||||
init: function()
|
||||
{
|
||||
//get /p/padname
|
||||
var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname)
|
||||
//get http://example.com/p/padname
|
||||
var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path)
|
||||
|
||||
// build the export links
|
||||
$("#exporthtmla").attr("href", document.location.pathname + "/export/html");
|
||||
$("#exportplaina").attr("href", document.location.pathname + "/export/txt");
|
||||
$("#exportwordlea").attr("href", document.location.pathname + "/export/wordle");
|
||||
$("#exportdokuwikia").attr("href", document.location.pathname + "/export/dokuwiki");
|
||||
$("#exporthtmla").attr("href", pad_root_path + "/export/html");
|
||||
$("#exportplaina").attr("href", pad_root_path + "/export/txt");
|
||||
$("#exportwordlea").attr("href", pad_root_path + "/export/wordle");
|
||||
$("#exportdokuwikia").attr("href", pad_root_path + "/export/dokuwiki");
|
||||
|
||||
//hide stuff thats not avaible if abiword is disabled
|
||||
if(clientVars.abiwordAvailable == "no")
|
||||
|
@ -256,21 +261,21 @@ var padimpexp = (function()
|
|||
{
|
||||
$("#exportpdfa").remove();
|
||||
|
||||
$("#exportworda").attr("href", document.location.pathname + "/export/doc");
|
||||
$("#exportopena").attr("href", document.location.pathname + "/export/odt");
|
||||
$("#exportworda").attr("href", pad_root_path + "/export/doc");
|
||||
$("#exportopena").attr("href", pad_root_path + "/export/odt");
|
||||
|
||||
$("#importexport").css({"height":"142px"});
|
||||
$("#importexportline").css({"height":"142px"});
|
||||
|
||||
$("#importform").get(0).setAttribute('action', document.location.href + "/import");
|
||||
$("#importform").attr('action', pad_root_url + "/import");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#exportworda").attr("href", document.location.pathname + "/export/doc");
|
||||
$("#exportpdfa").attr("href", document.location.pathname + "/export/pdf");
|
||||
$("#exportopena").attr("href", document.location.pathname + "/export/odt");
|
||||
$("#exportworda").attr("href", pad_root_path + "/export/doc");
|
||||
$("#exportpdfa").attr("href", pad_root_path + "/export/pdf");
|
||||
$("#exportopena").attr("href", pad_root_path + "/export/odt");
|
||||
|
||||
$("#importform").get(0).setAttribute('action', document.location.pathname + "/import");
|
||||
$("#importform").attr('action', pad_root_path + "/import");
|
||||
}
|
||||
|
||||
$("#impexp-close").click(function()
|
||||
|
@ -308,7 +313,7 @@ var padimpexp = (function()
|
|||
},
|
||||
export2Wordle: function()
|
||||
{
|
||||
var padUrl = document.location.href + "/export/txt";
|
||||
var padUrl = $('#exportwordlea').attr('href').replace(/\/wordle$/, '/txt')
|
||||
|
||||
$.get(padUrl, function(data)
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
return "t." + randomstring;
|
||||
}
|
||||
|
||||
var socket, token, padId;
|
||||
var socket, token, padId, export_links;
|
||||
|
||||
$(document).ready(function ()
|
||||
{
|
||||
|
@ -110,6 +110,9 @@
|
|||
$("body").html("<h2>You have no permission to access this pad</h2>")
|
||||
}
|
||||
});
|
||||
|
||||
//get all the export links
|
||||
export_links = $('#export > .exportlink')
|
||||
});
|
||||
|
||||
//sends a message over the socket
|
||||
|
@ -141,6 +144,19 @@
|
|||
loadBroadcastSliderJS();
|
||||
loadBroadcastRevisionsJS();
|
||||
loadBroadcastJS();
|
||||
|
||||
//initialize export ui
|
||||
padimpexp.init();
|
||||
|
||||
//change export urls when the slider moves
|
||||
var export_rev_regex = /(\/\d+)?\/export/
|
||||
BroadcastSlider.onSlider(function(revno)
|
||||
{
|
||||
export_links.each(function()
|
||||
{
|
||||
this.setAttribute('href', this.href.replace(export_rev_regex, '/' + revno + '/export'));
|
||||
});
|
||||
});
|
||||
|
||||
//fire all start functions of these scripts, formerly fired with window.load
|
||||
for(var i=0;i < fireWhenAllScriptsAreLoaded.length;i++)
|
||||
|
@ -269,6 +285,13 @@
|
|||
|
||||
<div id="editbarright" class="editbarright">
|
||||
<!-- termporary place holder-->
|
||||
<ul>
|
||||
<li onClick="window.padeditbar.toolbarClick('import_export');return false;">
|
||||
<a id="exportlink" title="Export to different document formats">
|
||||
<div class="buttonicon" style="background-position:0px -68px"></div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a id = "returnbutton">Return to pad</a>
|
||||
<script>
|
||||
if(document.referrer.length > 0 && document.referrer.substring(document.referrer.lastIndexOf("/")-1,document.referrer.lastIndexOf("/")) === "p") {
|
||||
|
@ -320,6 +343,24 @@
|
|||
</div>
|
||||
|
||||
<div id="mainmodals"></div>
|
||||
|
||||
<!-- export code -->
|
||||
<div id="importexport">
|
||||
|
||||
<div id="export">
|
||||
Export current version as:
|
||||
<a id="exporthtmla" target="_blank" class="exportlink"><div class="exporttype" id="exporthtml">HTML</div></a>
|
||||
<a id="exportplaina" target="_blank" class="exportlink"><div class="exporttype" id="exportplain">Plain text</div></a>
|
||||
<a id="exportworda" target="_blank" class="exportlink"><div class="exporttype" id="exportword">Microsoft Word</div></a>
|
||||
<a id="exportpdfa" target="_blank" class="exportlink"><div class="exporttype" id="exportpdf">PDF</div></a>
|
||||
<a id="exportopena" target="_blank" class="exportlink"><div class="exporttype" id="exportopen">OpenDocument</div></a>
|
||||
<a id="exportdokuwikia" target="_blank" class="exportlink"><div class="exporttype" id="exportdokuwiki">DokuWiki text</div></a>
|
||||
<a id="exportwordlea" target="_blank" onClick="padimpexp.export2Wordle();return false;" class="exportlink"><div class="exporttype" id="exportwordle">Wordle</div></a>
|
||||
<form id="wordlepost" name="wall" action="http://wordle.net/advanced" method="POST" style="margin-left:0px;">
|
||||
<div id="hidetext" style=""><textarea id="text" name="text" id="text" style="display:none;">Coming soon!</textarea></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue