Remove duplicated code

This commit is contained in:
yflory 2024-03-13 15:27:54 +01:00
parent 4c28fe3413
commit c0be0e4b12
2 changed files with 12 additions and 40 deletions

View File

@ -102,15 +102,7 @@ define([
name: 'authormarks',
icon: 'fa-paint-brush',
}).hide();
var $showAuthorColors = UIElements.createDropdownEntry({
tag: 'a',
attributes: {'class': 'fa fa-paint-brush ' + $showAuthorColorsButton.attr('class')},
content: h('span', $showAuthorColorsButton.text()),
action: function () {
$showAuthorColorsButton.click();
},
}).hide();
var $showAuthorColors = UIElements.getEntryFromButton($showAuthorColorsButton).hide();
$showAuthorColors.find('span').addClass('cp-toolbar-name cp-toolbar-drawer-element');
framework._.toolbar.$theme.append($showAuthorColors);
markers.setButton($showAuthorColors);
@ -123,14 +115,6 @@ define([
window.print();
framework.feedback('PRINT_CODE');
});
// var $print = UIElements.createDropdownEntry({
// tag: 'a',
// attributes: { 'class': $printButton.attr('class') },
// content: h('span', $printButton.text()),
// action: function () {
// $printButton.click();
// }
// });
var $print = UIElements.getEntryFromButton($printButton);
framework._.toolbar.$drawer.append($print);
};
@ -412,15 +396,8 @@ define([
setButton(!markers.getState());
UI.alert(content);
});
var $cba = UIElements.createDropdownEntry({
tag: 'a',
attributes: {'class': 'fa fa-paint-brush ' + $cbaButton.attr('class')},
content: h('span', $cbaButton.text()),
action: function () {
$cbaButton.click();
},
});
framework._.toolbar.$theme.prepend($cba); // Put at the top
var $cba = UIElements.getEntryFromButton($cbaButton);
framework._.toolbar.$theme.prepend($cba);
};
var mkFilePicker = function (framework, editor, evModeChange) {

View File

@ -122,20 +122,15 @@ define([
var mkPrintButton = function (framework, editor, $content, $print) {
var $printButton = framework._.sfCommon.createButton('print', true);
// var $print = UIElements.createDropdownEntry({
// tag: 'a',
// attributes: { 'class': $printButton.attr('class') },
// content: h('span', $printButton.text()),
// action: function () {
// Slide.update(editor.getValue(), true);
// $print.html($content.html());
// window.focus();
// window.print();
// framework.feedback('PRINT_SLIDES');
// }
// });
var $print = UIElements.getEntryFromButton($printButton);
framework._.toolbar.$drawer.append($print);
$printButton.click(function () {
Slide.update(editor.getValue(), true);
$print.html($content.html());
window.focus();
window.print();
framework.feedback('PRINT_SLIDES');
});
var $printEntry = UIElements.getEntryFromButton($printButton);
framework._.toolbar.$drawer.append($printEntry);
};
// Flag to check if a file from the filepicker is a mediatag for the slides or a background image