define([ 'jquery', 'json.sortify', '/bower_components/nthen/index.js', '/common/sframe-common.js', '/slide/slide.js', '/common/sframe-app-framework.js', '/common/sframe-common-codemirror.js', '/common/common-util.js', '/common/common-hash.js', '/common/common-interface.js', '/common/diffMarked.js', '/customize/messages.js', 'cm/lib/codemirror', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/customize/src/less2/main.less', 'css!cm/lib/codemirror.css', 'css!cm/addon/dialog/dialog.css', 'css!cm/addon/fold/foldgutter.css', 'cm/mode/markdown/markdown', 'cm/addon/mode/loadmode', 'cm/mode/meta', 'cm/addon/mode/overlay', 'cm/addon/mode/multiplex', 'cm/addon/mode/simple', 'cm/addon/edit/closebrackets', 'cm/addon/edit/matchbrackets', 'cm/addon/edit/trailingspace', 'cm/addon/selection/active-line', 'cm/addon/search/search', 'cm/addon/search/match-highlighter', 'cm/addon/search/searchcursor', 'cm/addon/dialog/dialog', 'cm/addon/fold/foldcode', 'cm/addon/fold/foldgutter', 'cm/addon/fold/brace-fold', 'cm/addon/fold/xml-fold', 'cm/addon/fold/markdown-fold', 'cm/addon/fold/comment-fold', 'cm/addon/display/placeholder', ], function ( $, JSONSortify, nThen, SFCommon, Slide, Framework, SFCodeMirror, Util, Hash, UI, DiffMd, Messages, CMeditor) { window.CodeMirror = CMeditor; var SLIDE_BACKCOLOR_ID = "cp-app-slide-toolbar-backcolor"; var SLIDE_COLOR_ID = "cp-app-slide-toolbar-color"; var mkLess = function (less) { return ( '#cp-app-slide-print .cp-app-slide-frame, ' + '#cp-app-slide-modal #cp-app-slide-modal-content .cp-app-slide-frame {\r\n' + less + '\r\n}' ); }; var mkSlidePreviewPane = function (framework, $contentContainer) { var $previewButton = framework._.sfCommon.createButton('preview', true); $previewButton.click(function () { var $c = $contentContainer; if ($c.hasClass('cp-app-slide-preview')) { framework._.sfCommon.setPadAttribute('previewMode', false, function (e) { if (e) { return console.log(e); } }); $previewButton.removeClass('cp-toolbar-button-active'); return void $c.removeClass('cp-app-slide-preview'); } framework._.sfCommon.setPadAttribute('previewMode', true, function (e) { if (e) { return console.log(e); } }); $c.addClass('cp-app-slide-preview'); $previewButton.addClass('cp-toolbar-button-active'); Slide.updateFontSize(); }); framework._.toolbar.$rightside.append($previewButton); framework._.sfCommon.getPadAttribute('previewMode', function (e, data) { if (e) { return void console.error(e); } if (data !== false && $previewButton) { $previewButton.click(); } }); }; var mkPrintButton = function (framework, editor, $content, $print) { var $printButton = framework._.sfCommon.createButton('print', true); $printButton.click(function () { Slide.update(editor.getValue(), true); $print.html($content.html()); window.focus(); window.print(); framework.feedback('PRINT_SLIDES'); }); framework._.toolbar.$drawer.append($printButton); }; // Flag to check if a file from the filepicker is a mediatag for the slides or a background image var Background = { isBackground: false }; var mkSlideOptionsButton = function (framework, slideOptions) { var metadataMgr = framework._.cpNfInner.metadataMgr; var updateSlideOptions = function (newOpt) { if (JSONSortify(newOpt) !== JSONSortify(slideOptions)) { $.extend(true, slideOptions, newOpt); // TODO: manage realtime + cursor in the "options" modal ?? Slide.updateOptions(); } }; var updateLocalOptions = function (newOpt) { updateSlideOptions(newOpt); var metadata = JSON.parse(JSON.stringify(metadataMgr.getMetadata())); metadata.slideOptions = slideOptions; metadataMgr.updateMetadata(metadata); framework.localChange(); }; var common = framework._.sfCommon; var createPrintDialog = function (invalidStyle) { var slideOptionsTmp = { title: false, slide: false, date: false, background: false, transition: true, style: '', styleLess: '' }; $.extend(true, slideOptionsTmp, slideOptions); var $container = $('
', {'class': 'msg'}).appendTo($div);
$('').text(Messages.printOptions).appendTo($p);
$p.append($('
'));
// Slide number
$('', {
type: 'checkbox',
id: 'cp-app-slide-options-number',
checked: slideOptionsTmp.slide
}).on('change', function () {
var c = this.checked;
slideOptionsTmp.slide = c;
}).appendTo($p).css('width', 'auto');
$('