mirror of https://github.com/xwiki-labs/cryptpad
Add missing handler for menu entries
This commit is contained in:
parent
c0be0e4b12
commit
62b4f901db
|
@ -68,7 +68,6 @@ define([
|
|||
CMeditor,
|
||||
UIElements)
|
||||
{
|
||||
var Common;
|
||||
window.CodeMirror = CMeditor;
|
||||
|
||||
var MEDIA_TAG_MODES = Object.freeze([
|
||||
|
@ -88,7 +87,7 @@ define([
|
|||
const $drawer = UIElements.createDropdown({
|
||||
text: Messages.toolbar_theme,
|
||||
options: [],
|
||||
common: Common,
|
||||
common: framework._.sfCommon,
|
||||
iconCls: 'cptools cptools-palette'
|
||||
});
|
||||
framework._.toolbar.$theme = $drawer.find('ul.cp-dropdown-content');
|
||||
|
|
|
@ -25,7 +25,7 @@ define([
|
|||
|
||||
var debug = function () {};
|
||||
|
||||
var MARK_OPACITY = 0.5;
|
||||
var MARK_OPACITY = 0.2;
|
||||
var DEFAULT = {
|
||||
authors: {},
|
||||
marks: [[-1, 0, 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER]]
|
||||
|
@ -624,11 +624,9 @@ define([
|
|||
if (Env.opacity) {
|
||||
Env.opacity = 0;
|
||||
$button.find('.cp-toolbar-drawer-element').text(Messages.cba_show);
|
||||
//$button.removeClass("cp-toolbar-button-active");
|
||||
} else {
|
||||
Env.opacity = MARK_OPACITY;
|
||||
$button.find('.cp-toolbar-drawer-element').text(Messages.cba_hide);
|
||||
//$button.addClass("cp-toolbar-button-active");
|
||||
}
|
||||
};
|
||||
toggle();
|
||||
|
|
|
@ -577,6 +577,7 @@ define([
|
|||
};
|
||||
|
||||
UIElements.getEntryFromButton = function ($button) {
|
||||
if (!$button || !$button.length) { return; }
|
||||
let $icon = $button.find('> i');
|
||||
|
||||
let attributes = {};
|
||||
|
@ -882,6 +883,7 @@ define([
|
|||
h('i.fa.fa-file-image-o'),
|
||||
h('span.cp-toolbar-name.cp-toolbar-drawer-element', Messages.toolbar_savetodrive)
|
||||
])).click(common.prepareFeedback(type));
|
||||
if (callback) { button.click(callback); }
|
||||
break;
|
||||
case 'storeindrive':
|
||||
button = $(h('button.cp-toolbar-storeindrive.fa.fa-hdd-o', {
|
||||
|
|
|
@ -2764,9 +2764,9 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
toolbar.$drawer.append($snapshot);
|
||||
|
||||
// Import template
|
||||
var $templateButton = common.createButton('importtemplate', true, {}, openTemplatePicker);
|
||||
if ($templateButton && typeof($templateButton.appendTo) === 'function') {
|
||||
var $template = UIElements.getEntryFromButton($templateButton);
|
||||
var $importTemplateButton = common.createButton('importtemplate', true, {}, openTemplatePicker);
|
||||
if ($importTemplateButton && $importTemplateButton.length) {
|
||||
let $template = UIElements.getEntryFromButton($importTemplateButton);
|
||||
$template.appendTo(toolbar.$drawer);
|
||||
}
|
||||
|
||||
|
@ -2789,8 +2789,8 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
APP.FM.handleFile(blob, data);
|
||||
}
|
||||
};
|
||||
var $templateButton = common.createButton('template', true, templateObj);
|
||||
var $template = UIElements.getEntryFromButton($templateButton);
|
||||
let $templateButton = common.createButton('template', true, templateObj);
|
||||
let $template = UIElements.getEntryFromButton($templateButton);
|
||||
toolbar.$drawer.append($template);
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -626,6 +626,16 @@ define([
|
|||
|
||||
var mkPrintButton = function (framework, editor) {
|
||||
var $printButton = framework._.sfCommon.createButton('print', true);
|
||||
$printButton.click(function () {
|
||||
/*
|
||||
// NOTE: alternative print system in case we keep having more issues on Firefox
|
||||
var $iframe = $('html').find('iframe');
|
||||
var iframe = $iframe[0].contentWindow;
|
||||
iframe.print();
|
||||
*/
|
||||
editor.execCommand('print');
|
||||
framework.feedback('PRINT_PAD');
|
||||
});
|
||||
var $print = UIElements.getEntryFromButton($printButton);
|
||||
framework._.toolbar.$drawer.append($print);
|
||||
};
|
||||
|
|
|
@ -65,7 +65,6 @@ define([
|
|||
CMeditor,
|
||||
UIElements)
|
||||
{
|
||||
var Common;
|
||||
window.CodeMirror = CMeditor;
|
||||
|
||||
var SLIDE_BACKCOLOR_ID = "cp-app-slide-toolbar-backcolor";
|
||||
|
@ -112,7 +111,7 @@ define([
|
|||
const $drawer = UIElements.createDropdown({
|
||||
text: Messages.toolbar_theme,
|
||||
options: [],
|
||||
common: Common,
|
||||
common: framework._.sfCommon,
|
||||
iconCls: 'cptools cptools-palette'
|
||||
});
|
||||
framework._.toolbar.$theme = $drawer.find('ul.cp-dropdown-content');
|
||||
|
|
|
@ -435,7 +435,16 @@ define([
|
|||
});
|
||||
|
||||
// Export to drive as PNG
|
||||
var $saveToDriveButton = framework._.sfCommon.createButton('savetodrive', true, {});
|
||||
var $saveToDriveButton = framework._.sfCommon.createButton('savetodrive', true, {
|
||||
callback: function () {
|
||||
var defaultName = framework._.title.getTitle()
|
||||
|| framework._.title.defaultTitle;
|
||||
UI.prompt(Messages.exportPrompt, defaultName + '.png', function (name) {
|
||||
if (name === null || !name.trim()) { return; }
|
||||
APP.upload(name);
|
||||
});
|
||||
}
|
||||
});
|
||||
var $saveToDrive = UIElements.getEntryFromButton($saveToDriveButton);
|
||||
$saveToDrive.appendTo($drawer);
|
||||
|
||||
|
|
Loading…
Reference in New Issue