Extract IEditorState from Editor.tsx to a new file
This commit is contained in:
parent
4d17249818
commit
715e2e2b2e
7 changed files with 14 additions and 11 deletions
|
@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react';
|
|||
import './App.scss';
|
||||
import { MainMenu } from '../MainMenu/MainMenu';
|
||||
import { ContainerModel } from '../../Interfaces/IContainerModel';
|
||||
import Editor, { IEditorState } from '../Editor/Editor';
|
||||
import Editor from '../Editor/Editor';
|
||||
import { IEditorState } from '../../Interfaces/IEditorState';
|
||||
import { LoadState } from './Load';
|
||||
import { LoadEditor, NewEditor } from './MenuActions';
|
||||
import { DEFAULT_CONFIG, DEFAULT_MAINCONTAINER_PROPS } from '../../utils/default';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Dispatch, SetStateAction } from 'react';
|
||||
import { Revive } from '../../utils/saveload';
|
||||
import { IEditorState } from '../Editor/Editor';
|
||||
import { IEditorState } from '../../Interfaces/IEditorState';
|
||||
|
||||
export function LoadState(
|
||||
editorState: IEditorState,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Dispatch, SetStateAction } from 'react';
|
|||
import { IConfiguration } from '../../Interfaces/IConfiguration';
|
||||
import { ContainerModel } from '../../Interfaces/IContainerModel';
|
||||
import { fetchConfiguration } from '../API/api';
|
||||
import { IEditorState } from '../Editor/Editor';
|
||||
import { IEditorState } from "../../Interfaces/IEditorState";
|
||||
import { LoadState } from './Load';
|
||||
|
||||
export function NewEditor(
|
||||
|
|
|
@ -15,12 +15,6 @@ interface IEditorProps {
|
|||
historyCurrentStep: number
|
||||
}
|
||||
|
||||
export interface IEditorState {
|
||||
history: IHistoryState[]
|
||||
historyCurrentStep: number
|
||||
configuration: IConfiguration
|
||||
}
|
||||
|
||||
export const getCurrentHistory = (history: IHistoryState[], historyCurrentStep: number): IHistoryState[] => history.slice(0, historyCurrentStep + 1);
|
||||
export const getCurrentHistoryState = (history: IHistoryState[], historyCurrentStep: number): IHistoryState => history[historyCurrentStep];
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { IHistoryState } from '../../Interfaces/IHistoryState';
|
|||
import { IConfiguration } from '../../Interfaces/IConfiguration';
|
||||
import { getCircularReplacer } from '../../utils/saveload';
|
||||
import { ID } from '../SVG/SVG';
|
||||
import { IEditorState } from './Editor';
|
||||
import { IEditorState } from '../../Interfaces/IEditorState';
|
||||
|
||||
export function SaveEditorAsJSON(
|
||||
history: IHistoryState[],
|
||||
|
|
8
src/Interfaces/IEditorState.tsx
Normal file
8
src/Interfaces/IEditorState.tsx
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { IConfiguration } from './IConfiguration';
|
||||
import { IHistoryState } from './IHistoryState';
|
||||
|
||||
export interface IEditorState {
|
||||
history: IHistoryState[]
|
||||
historyCurrentStep: number
|
||||
configuration: IConfiguration
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import { findContainerById, MakeIterator } from './itertools';
|
||||
import { IEditorState } from '../Components/Editor/Editor';
|
||||
import { IEditorState } from '../Interfaces/IEditorState';
|
||||
|
||||
/**
|
||||
* Revive the Editor state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue