...
|
...
|
@@ -148,6 +148,9 @@ Second line.</code></pre>
|
148
|
148
|
</div>
|
149
|
149
|
</div>
|
150
|
150
|
<a href="#" id="downloadMD"><img src="img/md.png" width="24px" height="24px"></img></a>
|
|
151
|
+ <div style="display: inline;position: absolute;margin-top: 1px;margin-right: 2px;margin-left: 2px;">output prefix</div>
|
|
152
|
+ <textarea id="filename" rows="1" columns="32" style="resize: none;display: inline;position: absolute;margin-left: 82px;">myfile</textarea>
|
|
153
|
+ <hr>
|
151
|
154
|
<textarea id="markdown" class="full-height" placeholder="Write Markdown"># Minimalist Online Markdown Editor
|
152
|
155
|
|
153
|
156
|
This is the **simplest** and **slickest** online Markdown editor.
|
...
|
...
|
@@ -188,6 +191,7 @@ Just start typing in the left panel.
|
188
|
191
|
</div>
|
189
|
192
|
<a href="#" id="downloadHTML"><img src="img/html5.png" width="24px" height="24px"></img></a>
|
190
|
193
|
<a href="#" id="downloadPDF" style="display: inline"><img src="img/pdf.png" width="24px" height="24px"></a>
|
|
194
|
+ <hr>
|
191
|
195
|
<textarea id="html" class="full-height"></textarea>
|
192
|
196
|
<div id="preview" class="full-height"></div>
|
193
|
197
|
</div>
|
...
|
...
|
@@ -218,23 +222,28 @@ Just start typing in the left panel.
|
218
|
222
|
link.click();
|
219
|
223
|
}
|
220
|
224
|
|
221
|
|
- var fileNameMD = 'myfile.md';
|
|
225
|
+ //var fileNameMD = 'myfile.md';
|
222
|
226
|
$('#downloadMD').click(function(){
|
223
|
|
- downloadInnerHtml(fileNameMD, 'markdown','text/html');
|
|
227
|
+ var filename = document.getElementById("filename").innerHTML+".md";
|
|
228
|
+ downloadInnerHtml(filename, 'preview','text/html');
|
|
229
|
+ //downloadInnerHtml(fileNameMD, 'markdown','text/html');
|
224
|
230
|
});
|
225
|
|
- var fileNameHTML = 'myfile.html';
|
|
231
|
+ //var fileNameHTML = 'myfile.html';
|
226
|
232
|
$('#downloadHTML').click(function(){
|
227
|
|
- downloadInnerHtml(fileNameHTML, 'preview','text/html');
|
|
233
|
+ var filename = document.getElementById("filename").innerHTML+".html";
|
|
234
|
+ downloadInnerHtml(filename, 'preview','text/html');
|
|
235
|
+ //downloadInnerHtml(fileNameHTML, 'preview','text/html');
|
228
|
236
|
});
|
229
|
237
|
|
230
|
|
- //jsPDF test
|
231
|
|
- var fileNamePDF = 'myfile.pdf';
|
|
238
|
+ //jsPDF
|
|
239
|
+ //var fileNamePDF = 'myfile.pdf';
|
232
|
240
|
function printPDF() {
|
233
|
241
|
var printDoc = new jsPDF();
|
234
|
242
|
printDoc.fromHTML($('#preview').get(0), 10, 10, {'width': 180});
|
235
|
|
- printDoc.output("dataurlnewwindow"); // this opens a new popup, after this the PDF opens the print window view but there are browser inconsistencies with how this is handled
|
236
|
|
- //printDoc.autoPrint()
|
237
|
|
- printDoc.save(fileNamePDF)
|
|
243
|
+ //printDoc.output("dataurlnewwindow"); // this opens a new popup, after this the PDF opens the print window view but there are browser inconsistencies with how this is handled
|
|
244
|
+ var filename = document.getElementById("filename").innerHTML+".pdf";
|
|
245
|
+ printDoc.save(filename);
|
|
246
|
+ //printDoc.save(fileNamePDF)
|
238
|
247
|
}
|
239
|
248
|
$('#downloadPDF').click(function(){
|
240
|
249
|
printPDF();
|