Merged in bugfix/add-hook-to-webapp (pull request #76)

fix: add custom hook useEditor to webapp package

* fix: add custom hook useEditor to webapp package
This commit is contained in:
Clément CREUSAT 2023-11-24 18:39:11 +00:00 committed by Paulo Veiga
parent 7434277373
commit 7a4b5212d9

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
import React, { useEffect } from 'react';
import Editor, { EditorOptions } from '@wisemapping/editor';
import Editor, { useEditor, EditorOptions } from '@wisemapping/editor';
import {
EditorRenderMode,
PersistenceManager,
@ -173,6 +173,12 @@ const EditorPage = ({ isTryMode }: EditorPropsType): React.ReactElement => {
}
}, [mapInfo?.getTitle()]);
const editor = useEditor({
mapInfo,
options,
persistenceManager: persistence,
});
return loadCompleted ? (
<IntlProvider
locale={userLocale.code}
@ -181,10 +187,8 @@ const EditorPage = ({ isTryMode }: EditorPropsType): React.ReactElement => {
>
<ClientHealthSentinel />
<Editor
editor={editor}
onAction={setActiveDialog}
options={options}
persistenceManager={persistence}
mapInfo={mapInfo}
theme={theme}
accountConfiguration={
// Prevent load on non-authenticated.