diff --git a/customize.dist/src/less2/include/app-print.less b/customize.dist/src/less2/include/app-print.less index 1625ff874..6ff8964eb 100644 --- a/customize.dist/src/less2/include/app-print.less +++ b/customize.dist/src/less2/include/app-print.less @@ -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; + } + } + } + } } } } diff --git a/www/code/app-code.less b/www/code/app-code.less index b2b3a1a64..26ae64bf2 100644 --- a/www/code/app-code.less +++ b/www/code/app-code.less @@ -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); + } } diff --git a/www/code/inner.html b/www/code/inner.html index f80e13c9c..a4ea56206 100644 --- a/www/code/inner.html +++ b/www/code/inner.html @@ -1,5 +1,5 @@ - + @@ -17,6 +17,7 @@
+
diff --git a/www/code/inner.js b/www/code/inner.js index e37d21c72..36137a6f3 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -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(); diff --git a/www/common/translations/messages.js b/www/common/translations/messages.js index f0461aa3b..d5ce92dcf 100644 --- a/www/common/translations/messages.js +++ b/www/common/translations/messages.js @@ -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";