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

View File

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