mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-30 06:45:47 -04:00
Added support of export to HTML, and changed the navbar menu for consistency
This commit is contained in:
parent
60414febee
commit
5f82df7eb2
6 changed files with 253 additions and 12 deletions
|
@ -27,20 +27,22 @@
|
|||
<li role="presentation"><a role="menuitem" class="ui-publish" tabindex="-1" href="#" target="_blank"><i class="fa fa-print fa-fw"></i> Publish</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Save</li>
|
||||
<li class="dropdown-header">Export</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Download</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-download-markdown" tabindex="-1" href="#" target="_self"><i class="fa fa-file-text fa-fw"></i> Markdown</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Import</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-import-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
|
||||
</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Download</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-download-markdown" tabindex="-1" href="#" target="_self"><i class="fa fa-file-text fa-fw"></i> Markdown</a>
|
||||
</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-download-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> HTML</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="https://www.facebook.com/messages/866415986748945" class="ui-feedback" title="Feedback" target="_blank"><i class="fa fa-bullhorn fa-fw"></i> Feedback</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -94,17 +96,21 @@
|
|||
Menu <i class="fa fa-caret-down"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="menu">
|
||||
<li class="dropdown-header">Save</li>
|
||||
<li class="dropdown-header">Export</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
|
||||
</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-download-markdown" tabindex="-1" href="#" target="_self"><i class="fa fa-file-text fa-fw"></i> Markdown</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Import</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-import-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
|
||||
</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Download</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-download-markdown" tabindex="-1" href="#" target="_self"><i class="fa fa-file-text fa-fw"></i> Markdown</a>
|
||||
</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-download-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> HTML</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
166
public/views/html.hbs
Normal file
166
public/views/html.hbs
Normal file
|
@ -0,0 +1,166 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<title>
|
||||
{{title}}
|
||||
</title>
|
||||
<link rel="icon" type="image/png" href="https://hackmd.io/favicon.png">
|
||||
<link rel="apple-touch-icon" href="https://hackmd.io/apple-touch-icon.png">
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/8.8.0/styles/github-gist.min.css">
|
||||
<style>
|
||||
{{{css}}}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{{html}}}
|
||||
<div class="ui-toc dropup unselectable hidden-print" style="display:none;">
|
||||
<div class="pull-right dropdown">
|
||||
<a id="tocLabel" class="ui-toc-label btn btn-default" data-target="#" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" title="Table of content">
|
||||
<i class="fa fa-bars"></i>
|
||||
</a>
|
||||
<ul id="toc" class="ui-toc-dropdown dropdown-menu" aria-labelledby="tocLabel">
|
||||
{{{toc}}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toc-affix" class="ui-affix-toc ui-toc-dropdown unselectable hidden-print" data-spy="affix" style="top:17px;display:none;">
|
||||
{{{toc-affix}}}
|
||||
</div>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" defer></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.2/gist-embed.min.js" defer></script>
|
||||
<script>
|
||||
var markdown = $(".markdown-body");
|
||||
//smooth all hash trigger scrolling
|
||||
function smoothHashScroll() {
|
||||
var hashElements = $("a[href^='#']").toArray();
|
||||
for (var i = 0; i < hashElements.length; i++) {
|
||||
var element = hashElements[i];
|
||||
var $element = $(element);
|
||||
var hash = element.hash;
|
||||
if (hash) {
|
||||
$element.on('click', function (e) {
|
||||
// store hash
|
||||
var hash = this.hash;
|
||||
if ($(hash).length <= 0) return;
|
||||
// prevent default anchor click behavior
|
||||
e.preventDefault();
|
||||
// animate
|
||||
$('body, html').stop(true, true).animate({
|
||||
scrollTop: $(hash).offset().top
|
||||
}, 100, "linear", function () {
|
||||
// when done, add hash to url
|
||||
// (default click behaviour)
|
||||
window.location.hash = hash;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
smoothHashScroll();
|
||||
var toc = $('.ui-toc');
|
||||
var tocAffix = $('.ui-affix-toc');
|
||||
var tocDropdown = $('.ui-toc-dropdown');
|
||||
//toc
|
||||
tocDropdown.click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
var enoughForAffixToc = true;
|
||||
|
||||
function generateScrollspy() {
|
||||
$(document.body).scrollspy({
|
||||
target: ''
|
||||
});
|
||||
$(document.body).scrollspy('refresh');
|
||||
if (enoughForAffixToc) {
|
||||
toc.hide();
|
||||
tocAffix.show();
|
||||
} else {
|
||||
tocAffix.hide();
|
||||
toc.show();
|
||||
}
|
||||
$(document.body).scroll();
|
||||
}
|
||||
|
||||
function windowResize() {
|
||||
//toc right
|
||||
var paddingRight = parseFloat(markdown.css('padding-right'));
|
||||
var right = ($(window).width() - (markdown.offset().left + markdown.outerWidth() - paddingRight));
|
||||
toc.css('right', right + 'px');
|
||||
//affix toc left
|
||||
var newbool;
|
||||
var rightMargin = (markdown.parent().outerWidth() - markdown.outerWidth()) / 2;
|
||||
//for ipad or wider device
|
||||
if (rightMargin >= 133) {
|
||||
newbool = true;
|
||||
var affixLeftMargin = (tocAffix.outerWidth() - tocAffix.width()) / 2;
|
||||
var left = markdown.offset().left + markdown.outerWidth() - affixLeftMargin;
|
||||
tocAffix.css('left', left + 'px');
|
||||
} else {
|
||||
newbool = false;
|
||||
}
|
||||
if (newbool != enoughForAffixToc) {
|
||||
enoughForAffixToc = newbool;
|
||||
generateScrollspy();
|
||||
}
|
||||
}
|
||||
$(window).resize(function () {
|
||||
windowResize();
|
||||
});
|
||||
$(document).ready(function () {
|
||||
windowResize();
|
||||
generateScrollspy();
|
||||
});
|
||||
|
||||
//remove hash
|
||||
function removeHash() {
|
||||
window.location.hash = '';
|
||||
}
|
||||
|
||||
var backtotop = $('.back-to-top');
|
||||
var gotobottom = $('.go-to-bottom');
|
||||
|
||||
backtotop.click(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (scrollToTop)
|
||||
scrollToTop();
|
||||
removeHash();
|
||||
});
|
||||
gotobottom.click(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (scrollToBottom)
|
||||
scrollToBottom();
|
||||
removeHash();
|
||||
});
|
||||
|
||||
function scrollToTop() {
|
||||
$('body, html').stop(true, true).animate({
|
||||
scrollTop: 0
|
||||
}, 100, "linear");
|
||||
}
|
||||
|
||||
function scrollToBottom() {
|
||||
$('body, html').stop(true, true).animate({
|
||||
scrollTop: $(document.body)[0].scrollHeight
|
||||
}, 100, "linear");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue