Merge branch 'staging' of github.com:joldie/cryptpad into print-code

pull/1/head
ansuz 6 years ago
commit 8affe4053c

@ -46,6 +46,38 @@
display: block; display: block;
} }
} }
// Code app
body.cp-app-code {
display: block;
* {
visibility: hidden;
height: auto;
max-height: none;
}
#cme_toolbox {
display: none;
}
#cp-app-code-editor {
display: block;
#cp-app-code-container {
display: none;
}
#cp-app-code-preview {
display: block;
#cp-app-code-print {
display: block;
overflow: visible !important;
width: 100%;
visibility: visible;
* { visibility: visible; }
pre { border: none; }
}
#cp-app-code-preview-content {
display: none !important;
}
}
}
}
} }
} }
} }

@ -124,5 +124,12 @@
display: none !important; display: none !important;
} }
} }
#cp-app-code-print {
position: relative;
display: none;
margin: 1em auto;
.markdown_preformatted-code;
.markdown_gfm-table(black);
}
} }

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="cp-app-noscroll"> <html class="cp-app-noscroll cp-app-print">
<head> <head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script async data-bootload="/code/inner.js" data-main="/common/sframe-boot.js?ver=1.6" src="/bower_components/requirejs/require.js?ver=2.3.5"></script> <script async data-bootload="/code/inner.js" data-main="/common/sframe-boot.js?ver=1.6" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
@ -17,6 +17,7 @@
</div> </div>
<div id="cp-app-code-preview"> <div id="cp-app-code-preview">
<div id="cp-app-code-preview-content"></div> <div id="cp-app-code-preview-content"></div>
<div id="cp-app-code-print"></div>
</div> </div>
</div> </div>
</body> </body>

@ -70,6 +70,16 @@ define([
'xml', 'xml',
]); ]);
var mkPrintButton = function (framework, $content, $print) {
var $printButton = framework._.sfCommon.createButton('print', true);
$printButton.click(function () {
$print.html($content.html());
window.focus();
window.print();
framework.feedback('PRINT_CODE');
});
framework._.toolbar.$drawer.append($printButton);
};
var mkMarkdownTb = function (editor, framework) { var mkMarkdownTb = function (editor, framework) {
var $codeMirrorContainer = $('#cp-app-code-container'); var $codeMirrorContainer = $('#cp-app-code-container');
var markdownTb = framework._.sfCommon.createMarkdownToolbar(editor); var markdownTb = framework._.sfCommon.createMarkdownToolbar(editor);
@ -265,6 +275,11 @@ define([
var previewPane = mkPreviewPane(editor, CodeMirror, framework, isPresentMode); var previewPane = mkPreviewPane(editor, CodeMirror, framework, isPresentMode);
var markdownTb = mkMarkdownTb(editor, framework); var markdownTb = mkMarkdownTb(editor, framework);
var $print = $('#cp-app-code-print');
var $content = $('#cp-app-code-preview-content');
mkPrintButton(framework, $content, $print);
mkHelpMenu(framework); mkHelpMenu(framework);
var evModeChange = Util.mkEvent(); var evModeChange = Util.mkEvent();

@ -172,7 +172,7 @@ define(function () {
out.printText = "Print"; out.printText = "Print";
out.printButton = "Print (enter)"; out.printButton = "Print (enter)";
out.printButtonTitle = "Print your slides or export them as a PDF file"; out.printButtonTitle = "Print your document or export it as a PDF file";
out.printOptions = "Layout options"; out.printOptions = "Layout options";
out.printSlideNumber = "Display the slide number"; out.printSlideNumber = "Display the slide number";
out.printDate = "Display the date"; out.printDate = "Display the date";

Loading…
Cancel
Save