diff --git a/packages/editor/src/classes/default-widget-manager/index.ts b/packages/editor/src/classes/default-widget-manager/index.ts
index f2dcb67f..8288b2f5 100644
--- a/packages/editor/src/classes/default-widget-manager/index.ts
+++ b/packages/editor/src/classes/default-widget-manager/index.ts
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useRef, useState } from 'react';
import {
WidgetManager,
Topic,
@@ -7,7 +7,7 @@ import {
NoteModel,
NoteIcon,
} from '@wisemapping/mindplot';
-import { linkContent, noteContent } from '../../components/menu/contents';
+import { linkContent, noteContent } from '../../components/toolbar/contents';
export class DefaultWidgetManager extends WidgetManager {
private editorOpen: boolean;
@@ -63,6 +63,14 @@ export class DefaultWidgetManager extends WidgetManager {
this.setPopoverOpen(true);
topic.closeEditors();
}
+
+ static create(): [boolean, Element | undefined, DefaultWidgetManager] {
+ const [popoverOpen, setPopoverOpen] = useState(false);
+ const [popoverTarget, setPopoverTarget] = useState(undefined);
+ const widgetManager = useRef(new DefaultWidgetManager(setPopoverOpen, setPopoverTarget));
+
+ return [popoverOpen, popoverTarget, widgetManager.current];
+ }
}
export default DefaultWidgetManager;
diff --git a/packages/editor/src/components/header/index.tsx b/packages/editor/src/components/header/index.tsx
deleted file mode 100644
index b797a149..00000000
--- a/packages/editor/src/components/header/index.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react';
-import ActionConfig from '../../classes/action-config';
-import MaterialToolbar from '@mui/material/Toolbar';
-import AppBar from '@mui/material/AppBar';
-import { ToolbarMenuItem } from '../toolbar/Toolbar';
-
-/**
- * App bar
- * @param props.configurations the configurations array
- * @returns toolbar wich contains an entry for each configuration in the array
- */
-const Header = (props: { configurations: ActionConfig[] }) => {
- return (
-
-
- {props.configurations.map((c, i) => {
- return ;
- })}
-
-
- );
-};
-
-export default Header;
diff --git a/packages/editor/src/components/menu/contents.tsx b/packages/editor/src/components/menu/contents.tsx
deleted file mode 100644
index 3373bb65..00000000
--- a/packages/editor/src/components/menu/contents.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import { NoteForm, UrlForm } from '../toolbar/toolbarCustomComponents';
-
-function linkContent(linkModel, closeModal): React.ReactElement {
- return ;
-}
-
-function noteContent(noteModel, closeModal): React.ReactElement {
- return ;
-}
-
-export { linkContent, noteContent };
diff --git a/packages/editor/src/components/menu/useMuiWidgetManager.ts b/packages/editor/src/components/menu/useMuiWidgetManager.ts
deleted file mode 100644
index 42db5fab..00000000
--- a/packages/editor/src/components/menu/useMuiWidgetManager.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { useState, useRef } from 'react';
-import DefaultWidgetManager from '../../classes/default-widget-manager';
-
-export const useMuiWidgetManager = (): [boolean, Element | undefined, DefaultWidgetManager] => {
- const [popoverOpen, setPopoverOpen] = useState(false);
- const [popoverTarget, setPopoverTarget] = useState(undefined);
- const widgetManager = useRef(new DefaultWidgetManager(setPopoverOpen, setPopoverTarget));
-
- return [popoverOpen, popoverTarget, widgetManager.current];
-};
diff --git a/packages/editor/src/components/toolbar/contents.tsx b/packages/editor/src/components/toolbar/contents.tsx
index 45e57425..4f1f928c 100644
--- a/packages/editor/src/components/toolbar/contents.tsx
+++ b/packages/editor/src/components/toolbar/contents.tsx
@@ -1,12 +1,12 @@
import React from 'react';
import { NoteForm, UrlForm } from './toolbarCustomComponents';
-function linkContent(linkModel, closeModal): React.ReactElement {
+const linkContent = (linkModel, closeModal): React.ReactElement => {
return ;
-}
+};
-function noteContent(noteModel, closeModal): React.ReactElement {
+const noteContent = (noteModel, closeModal): React.ReactElement => {
return ;
-}
+};
export { linkContent, noteContent };
diff --git a/packages/editor/src/components/toolbar/useMuiWidgetManager.ts b/packages/editor/src/components/toolbar/useMuiWidgetManager.ts
deleted file mode 100644
index 42db5fab..00000000
--- a/packages/editor/src/components/toolbar/useMuiWidgetManager.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { useState, useRef } from 'react';
-import DefaultWidgetManager from '../../classes/default-widget-manager';
-
-export const useMuiWidgetManager = (): [boolean, Element | undefined, DefaultWidgetManager] => {
- const [popoverOpen, setPopoverOpen] = useState(false);
- const [popoverTarget, setPopoverTarget] = useState(undefined);
- const widgetManager = useRef(new DefaultWidgetManager(setPopoverOpen, setPopoverTarget));
-
- return [popoverOpen, popoverTarget, widgetManager.current];
-};
diff --git a/packages/editor/src/index.tsx b/packages/editor/src/index.tsx
index 6b5a573c..783de014 100644
--- a/packages/editor/src/index.tsx
+++ b/packages/editor/src/index.tsx
@@ -24,13 +24,13 @@ import {
} from '@wisemapping/mindplot';
import './global-styled.css';
import I18nMsg from './classes/i18n-msg';
-import { useMuiWidgetManager } from './components/menu/useMuiWidgetManager';
import Toolbar, { horizontalPosition, Appbar, configurationBuilder } from './components/toolbar';
import { theme as defaultEditorTheme } from './theme';
import ThemeProvider from '@mui/material/styles/ThemeProvider';
import { Theme } from '@mui/material/styles';
import { Notifier } from './components/footer/styled';
import Footer from './components/footer';
+import DefaultWidgetManager from './classes/default-widget-manager';
declare global {
// used in mindplot
@@ -112,7 +112,7 @@ const Editor = ({
setMindplotComponent(node);
}, []);
- const [popoverOpen, popoverTarget, widgetManager] = useMuiWidgetManager();
+ const [popoverOpen, popoverTarget, widgetManager] = DefaultWidgetManager.create();
const onNodeBlurHandler = () => {
if (!mindplotComponent.getDesigner().getModel().selectedTopic())
@@ -200,8 +200,8 @@ const Editor = ({
const locale = options.locale;
const msg = I18nMsg.loadLocaleData(locale);
const menubarConfiguration = configurationBuilder.buildEditorAppBarConfiguration(
- options.mapTitle,
mindplotComponent?.getDesigner(),
+ options.mapTitle,
onAction,
() => {
mindplotComponent.save(true);