|
|
@ -9,6 +9,7 @@ define([
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-interface.js',
|
|
|
|
'/common/common-interface.js',
|
|
|
|
|
|
|
|
'/common/hyperscript.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'cm/lib/codemirror',
|
|
|
|
'cm/lib/codemirror',
|
|
|
|
|
|
|
|
|
|
|
@ -53,6 +54,7 @@ define([
|
|
|
|
Util,
|
|
|
|
Util,
|
|
|
|
Hash,
|
|
|
|
Hash,
|
|
|
|
UI,
|
|
|
|
UI,
|
|
|
|
|
|
|
|
h,
|
|
|
|
Messages,
|
|
|
|
Messages,
|
|
|
|
CMeditor)
|
|
|
|
CMeditor)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -88,7 +90,7 @@ define([
|
|
|
|
$previewButton.addClass('cp-toolbar-button-active');
|
|
|
|
$previewButton.addClass('cp-toolbar-button-active');
|
|
|
|
Slide.updateFontSize();
|
|
|
|
Slide.updateFontSize();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
framework._.toolbar.$rightside.append($previewButton);
|
|
|
|
framework._.toolbar.$bottomM.append($previewButton);
|
|
|
|
|
|
|
|
|
|
|
|
framework._.sfCommon.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
framework._.sfCommon.getPadAttribute('previewMode', function (e, data) {
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
@ -98,6 +100,39 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mkThemeButton = function (framework) {
|
|
|
|
|
|
|
|
Messages.toolbar_theme = "Theme";
|
|
|
|
|
|
|
|
var $theme = $(h('button', [
|
|
|
|
|
|
|
|
h('i.cptools.cptools-palette'),
|
|
|
|
|
|
|
|
h('span.cp-button-name', Messages.toolbar_theme)
|
|
|
|
|
|
|
|
]));
|
|
|
|
|
|
|
|
var $content = $(h('div.cp-toolbar-drawer-content', {
|
|
|
|
|
|
|
|
tabindex: 1
|
|
|
|
|
|
|
|
})).hide();
|
|
|
|
|
|
|
|
$theme.click(function () {
|
|
|
|
|
|
|
|
$content.toggle();
|
|
|
|
|
|
|
|
$theme.removeClass('cp-toolbar-button-active');
|
|
|
|
|
|
|
|
if ($content.is(':visible')) {
|
|
|
|
|
|
|
|
$theme.addClass('cp-toolbar-button-active');
|
|
|
|
|
|
|
|
$content.focus();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var onBlur = function (e) {
|
|
|
|
|
|
|
|
if (e.relatedTarget) {
|
|
|
|
|
|
|
|
if ($(e.relatedTarget).is('.cp-toolbar-drawer-button')) { return; }
|
|
|
|
|
|
|
|
if ($(e.relatedTarget).parents('.cp-toolbar-drawer-content').length) {
|
|
|
|
|
|
|
|
$(e.relatedTarget).blur(onBlur);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$theme.removeClass('cp-toolbar-button-active');
|
|
|
|
|
|
|
|
$content.hide();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$content.blur(onBlur).appendTo($theme);
|
|
|
|
|
|
|
|
framework._.toolbar.$theme = $content;
|
|
|
|
|
|
|
|
framework._.toolbar.$bottomL.append($theme);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var mkPrintButton = function (framework, editor, $content, $print) {
|
|
|
|
var mkPrintButton = function (framework, editor, $content, $print) {
|
|
|
|
var $printButton = framework._.sfCommon.createButton('print', true);
|
|
|
|
var $printButton = framework._.sfCommon.createButton('print', true);
|
|
|
|
$printButton.click(function () {
|
|
|
|
$printButton.click(function () {
|
|
|
@ -302,7 +337,7 @@ define([
|
|
|
|
$optionsButton.click(function () {
|
|
|
|
$optionsButton.click(function () {
|
|
|
|
$('body').append(createPrintDialog());
|
|
|
|
$('body').append(createPrintDialog());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
framework._.toolbar.$drawer.append($optionsButton);
|
|
|
|
framework._.toolbar.$theme.append($optionsButton);
|
|
|
|
|
|
|
|
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
@ -322,12 +357,12 @@ define([
|
|
|
|
textColor = text;
|
|
|
|
textColor = text;
|
|
|
|
$modal.css('color', text);
|
|
|
|
$modal.css('color', text);
|
|
|
|
$modal.css('border-color', text);
|
|
|
|
$modal.css('border-color', text);
|
|
|
|
$('#' + SLIDE_COLOR_ID).css('color', text);
|
|
|
|
$('#' + SLIDE_COLOR_ID).find('i').css('color', text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (back) {
|
|
|
|
if (back) {
|
|
|
|
backColor = back;
|
|
|
|
backColor = back;
|
|
|
|
$modal.css('background-color', back);
|
|
|
|
$modal.css('background-color', back);
|
|
|
|
$('#' + SLIDE_BACKCOLOR_ID).css('color', back);
|
|
|
|
$('#' + SLIDE_BACKCOLOR_ID).find('i').css('color', back);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var updateLocalColors = function (text, back) {
|
|
|
|
var updateLocalColors = function (text, back) {
|
|
|
@ -339,20 +374,22 @@ define([
|
|
|
|
framework.localChange();
|
|
|
|
framework.localChange();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Messages.slide_backCol = "Background color"; // XXX
|
|
|
|
var $back = framework._.sfCommon.createButton(null, true, {
|
|
|
|
var $back = framework._.sfCommon.createButton(null, true, {
|
|
|
|
icon: 'fa-square',
|
|
|
|
icon: 'fa-square',
|
|
|
|
|
|
|
|
text: Messages.slide_backCol,
|
|
|
|
title: Messages.backgroundButtonTitle,
|
|
|
|
title: Messages.backgroundButtonTitle,
|
|
|
|
hiddenReadOnly: true,
|
|
|
|
hiddenReadOnly: true,
|
|
|
|
name: 'background',
|
|
|
|
name: 'background',
|
|
|
|
style: 'color: #000;',
|
|
|
|
|
|
|
|
id: SLIDE_BACKCOLOR_ID
|
|
|
|
id: SLIDE_BACKCOLOR_ID
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
Messages.slide_textCol = "Text color"; // XXX
|
|
|
|
var $text = framework._.sfCommon.createButton(null, true, {
|
|
|
|
var $text = framework._.sfCommon.createButton(null, true, {
|
|
|
|
icon: 'fa-i-cursor',
|
|
|
|
icon: 'fa-i-cursor',
|
|
|
|
|
|
|
|
text: Messages.slide_textCol,
|
|
|
|
title: Messages.colorButtonTitle,
|
|
|
|
title: Messages.colorButtonTitle,
|
|
|
|
hiddenReadOnly: true,
|
|
|
|
hiddenReadOnly: true,
|
|
|
|
name: 'color',
|
|
|
|
name: 'color',
|
|
|
|
style: 'font-weight: bold; color: #FFF;',
|
|
|
|
|
|
|
|
id: SLIDE_COLOR_ID
|
|
|
|
id: SLIDE_COLOR_ID
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var $testColor = $('<input>', { type: 'color', value: '!' });
|
|
|
|
var $testColor = $('<input>', { type: 'color', value: '!' });
|
|
|
@ -377,7 +414,7 @@ define([
|
|
|
|
$foregroundPicker.click();
|
|
|
|
$foregroundPicker.click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
framework._.toolbar.$rightside.append($text).append($back);
|
|
|
|
framework._.toolbar.$theme.append($text).append($back);
|
|
|
|
|
|
|
|
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
@ -405,7 +442,7 @@ define([
|
|
|
|
var $codeMirrorContainer = $('#cp-app-slide-editor-container');
|
|
|
|
var $codeMirrorContainer = $('#cp-app-slide-editor-container');
|
|
|
|
var markdownTb = framework._.sfCommon.createMarkdownToolbar(editor);
|
|
|
|
var markdownTb = framework._.sfCommon.createMarkdownToolbar(editor);
|
|
|
|
$codeMirrorContainer.prepend(markdownTb.toolbar);
|
|
|
|
$codeMirrorContainer.prepend(markdownTb.toolbar);
|
|
|
|
framework._.toolbar.$rightside.append(markdownTb.button);
|
|
|
|
framework._.toolbar.$bottomL.append(markdownTb.button);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var mkHelpMenu = function (framework) {
|
|
|
|
var mkHelpMenu = function (framework) {
|
|
|
@ -451,6 +488,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
activateLinks($content, framework);
|
|
|
|
activateLinks($content, framework);
|
|
|
|
Slide.setModal(framework._.sfCommon, $modal, $content, slideOptions, Messages.slideInitialState);
|
|
|
|
Slide.setModal(framework._.sfCommon, $modal, $content, slideOptions, Messages.slideInitialState);
|
|
|
|
|
|
|
|
mkThemeButton(framework);
|
|
|
|
mkPrintButton(framework, editor, $content, $print);
|
|
|
|
mkPrintButton(framework, editor, $content, $print);
|
|
|
|
mkSlideOptionsButton(framework, slideOptions, $toolbarDrawer);
|
|
|
|
mkSlideOptionsButton(framework, slideOptions, $toolbarDrawer);
|
|
|
|
mkColorConfiguration(framework, $modal);
|
|
|
|
mkColorConfiguration(framework, $modal);
|
|
|
@ -534,7 +572,7 @@ define([
|
|
|
|
Slide.setTitle(framework._.title);
|
|
|
|
Slide.setTitle(framework._.title);
|
|
|
|
|
|
|
|
|
|
|
|
var enterPresentationMode = function () { Slide.show(true, editor.getValue()); };
|
|
|
|
var enterPresentationMode = function () { Slide.show(true, editor.getValue()); };
|
|
|
|
framework._.toolbar.$rightside.append(
|
|
|
|
framework._.toolbar.$bottomM.append(
|
|
|
|
framework._.sfCommon.createButton('present', true).click(enterPresentationMode)
|
|
|
|
framework._.sfCommon.createButton('present', true).click(enterPresentationMode)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (isPresentMode) { enterPresentationMode(); }
|
|
|
|
if (isPresentMode) { enterPresentationMode(); }
|
|
|
|