Fix clean up code.

This commit is contained in:
Paulo Gustavo Veiga 2022-03-09 11:39:02 -08:00
parent 1d7db72ae5
commit d8cdb50558
2 changed files with 290 additions and 296 deletions

View File

@ -38,7 +38,18 @@ class Menu extends IMenu {
const widgetsBaseUrl = `${baseUrl}css/widget`; const widgetsBaseUrl = `${baseUrl}css/widget`;
// Create panels ... // Create panels ...
const designerModel = designer.getModel(); const designerModel = designer.getModel();
const backTolist = $('#backToList');
backTolist.bind('click', (event) => {
event.stopPropagation();
window.location.href = '/c/maps/';
return false;
});
Menu._registerTooltip('backToList', $msg('BACK_TO_MAP_LIST'));
if (!readOnly) {
const fontFamilyModel = { const fontFamilyModel = {
getValue() { getValue() {
const nodes = designerModel.filterSelectedTopics(); const nodes = designerModel.filterSelectedTopics();
@ -179,25 +190,6 @@ class Menu extends IMenu {
this._toolbarElems.push(new ColorPalettePanel('fontColor', fontColorModel, baseUrl)); this._toolbarElems.push(new ColorPalettePanel('fontColor', fontColorModel, baseUrl));
Menu._registerTooltip('fontColor', $msg('FONT_COLOR')); Menu._registerTooltip('fontColor', $msg('FONT_COLOR'));
Menu._registerTooltip('export', $msg('EXPORT'));
Menu._registerTooltip('print', $msg('PRINT'));
this._addButton('zoom-plus', false, false, () => {
designer.zoomIn();
});
Menu._registerTooltip('zoom-plus', $msg('ZOOM_IN'));
this._addButton('zoom-minus', false, false, () => {
designer.zoomOut();
});
Menu._registerTooltip('zoom-minus', $msg('ZOOM_OUT'));
this._addButton('position', false, false, () => {
designer.zoomToFit();
});
Menu._registerTooltip('position', $msg('CENTER_POSITION'));
const undoButton = this._addButton('undoEdition', false, false, () => { const undoButton = this._addButton('undoEdition', false, false, () => {
designer.undo(); designer.undo();
}); });
@ -264,6 +256,7 @@ class Menu extends IMenu {
}); });
Menu._registerTooltip('fontItalic', $msg('FONT_ITALIC'), 'meta+I'); Menu._registerTooltip('fontItalic', $msg('FONT_ITALIC'), 'meta+I');
if (saveElem) { if (saveElem) {
this._addButton('save', false, false, this._addButton('save', false, false,
() => { () => {
@ -289,6 +282,11 @@ class Menu extends IMenu {
); );
} }
} }
}
Menu._registerTooltip('export', $msg('EXPORT'));
Menu._registerTooltip('print', $msg('PRINT'));
const shareElem = $('#shareIt'); const shareElem = $('#shareIt');
if (shareElem.length !== 0) { if (shareElem.length !== 0) {
@ -316,14 +314,6 @@ class Menu extends IMenu {
Menu._registerTooltip('keyboardShortcuts', $msg('KEYBOARD_SHOTCUTS')); Menu._registerTooltip('keyboardShortcuts', $msg('KEYBOARD_SHOTCUTS'));
} }
const backTolist = $('#backToList');
backTolist.bind('click', (event) => {
event.stopPropagation();
window.location.href = '/c/maps/';
return false;
});
Menu._registerTooltip('backToList', $msg('BACK_TO_MAP_LIST'));
// Account dialog ... // Account dialog ...
const accountSettings = $('#account'); const accountSettings = $('#account');
if (accountSettings.length !== 0) { if (accountSettings.length !== 0) {

View File

@ -55,6 +55,8 @@ export default function Toolbar({
</ToolbarButton> </ToolbarButton>
</div> </div>
)} )}
{(editorMode === 'edition-editor' || editorMode === 'edition-owner' || editorMode === 'showcase') && (
<>
<div id="edit" className="buttonContainer"> <div id="edit" className="buttonContainer">
<ToolbarButton id="undoEdition" className="buttonOn"> <ToolbarButton id="undoEdition" className="buttonOn">
<img src={UndoSvg} /> <img src={UndoSvg} />
@ -112,6 +114,8 @@ export default function Toolbar({
</ToolbarButton> </ToolbarButton>
</div> </div>
<div id="separator" className="buttonContainer"></div> <div id="separator" className="buttonContainer"></div>
</>
)}
<ToolbarRightContainer> <ToolbarRightContainer>
<ToolbarButton <ToolbarButton
id="export" id="export"