Added print button to code pad page.

pull/1/head
joldie 6 years ago
parent c81b4d77e8
commit 35c39fae5d

@ -46,6 +46,38 @@
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,17 @@
display: none !important;
}
}
@media print {
#cp-app-code-container {
display: none;
}
}
#cp-app-code-print {
position: relative;
display: none;
margin: 1em auto;
.markdown_preformatted-code;
.markdown_gfm-table(black);
}
}

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="cp-app-noscroll">
<html class="cp-app-noscroll cp-app-print">
<head>
<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>
@ -17,6 +17,7 @@
</div>
<div id="cp-app-code-preview">
<div id="cp-app-code-preview-content"></div>
<div id="cp-app-code-print"></div>
</div>
</div>
</body>

@ -70,6 +70,16 @@ define([
'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 $codeMirrorContainer = $('#cp-app-code-container');
var markdownTb = framework._.sfCommon.createMarkdownToolbar(editor);
@ -265,6 +275,11 @@ define([
var previewPane = mkPreviewPane(editor, CodeMirror, framework, isPresentMode);
var markdownTb = mkMarkdownTb(editor, framework);
var $print = $('#cp-app-code-print');
var $content = $('#cp-app-code-preview-content');
mkPrintButton(framework, $content, $print);
mkHelpMenu(framework);
var evModeChange = Util.mkEvent();

@ -172,7 +172,7 @@ define(function () {
out.printText = "Print";
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.printSlideNumber = "Display the slide number";
out.printDate = "Display the date";

Loading…
Cancel
Save