Remove toolbar on view mode

This commit is contained in:
Paulo Gustavo Veiga 2022-02-25 17:55:26 -08:00
parent e44bbe11e0
commit e2083befa9
2 changed files with 16 additions and 10 deletions

View File

@ -64,7 +64,7 @@ const Editor = ({
designer.loadMap(mindmap); designer.loadMap(mindmap);
if (options.locked) { if (options.locked) {
$notify(options.lockedMsg); $notify(options.lockedMsg, false);
} }
}, []); }, []);
@ -96,6 +96,7 @@ const Editor = ({
const locale = options.locale; const locale = options.locale;
const msg = I18nMsg.loadLocaleData(locale); const msg = I18nMsg.loadLocaleData(locale);
const mindplotStyle = (options.mode === 'viewonly') ? { top: 0 } : { top: 'inherit' };
return ( return (
<IntlProvider locale={locale} messages={msg}> <IntlProvider locale={locale} messages={msg}>
{(options.mode !== 'viewonly') && {(options.mode !== 'viewonly') &&
@ -104,9 +105,9 @@ const Editor = ({
onAction={onAction} onAction={onAction}
/> />
} }
<div id="mindplot"></div> <div id="mindplot" style={mindplotStyle}></div>
<Footer editorMode={options.mode} /> <Footer editorMode={options.mode} />
</IntlProvider> </IntlProvider >
); );
} }
export default Editor; export default Editor;

View File

@ -20,16 +20,17 @@ import { $assert } from '@wisemapping/core-js';
import $ from 'jquery'; import $ from 'jquery';
class ToolbarNotifier { class ToolbarNotifier {
get container() { static get container() {
return $('#headerNotifier'); return $('#headerNotifier');
} }
hide() { static hide() {
this.container.hide(); this.container.hide();
} }
logMessage(msg) { static show(msg: string, fade: boolean) {
$assert(msg, 'msg can not be null'); $assert(msg, 'msg can not be null');
// In case of print,embedded no message is displayed .... // In case of print,embedded no message is displayed ....
if (this.container && this.container.length && !this.container.data('transitioning')) { if (this.container && this.container.length && !this.container.data('transitioning')) {
this.container.data('transitioning', true); this.container.data('transitioning', true);
@ -37,15 +38,19 @@ class ToolbarNotifier {
this.container.css({ this.container.css({
left: ($(window).width() - this.container.width()) / 2 - 9, left: ($(window).width() - this.container.width()) / 2 - 9,
}); });
this.container.show().fadeOut(5000);
if (fade) {
this.container.show().fadeOut(5000);
} else {
this.container.show();
}
} }
this.container.data('transitioning', false); this.container.data('transitioning', false);
} }
} }
const toolbarNotifier = new ToolbarNotifier(); const $notify = (msg: string, fade = true) => {
const $notify = (msg) => { ToolbarNotifier.show(msg, fade);
toolbarNotifier.logMessage(msg);
}; };
export { $notify }; export { $notify };