Implemtation in progress, UIX working , replacing in ContainerOperations.ts working but not properly need fix

This commit is contained in:
Carl Fuchs 2023-02-06 16:45:34 +01:00
parent 62abd3ff03
commit e789300090
9 changed files with 139 additions and 98 deletions

View file

@ -17,6 +17,7 @@ import { BarIcon } from './BarIcon';
import { Text } from '../Text/Text'; import { Text } from '../Text/Text';
interface IBarProps { interface IBarProps {
className: string
isComponentsOpen: boolean isComponentsOpen: boolean
isSymbolsOpen: boolean isSymbolsOpen: boolean
isHistoryOpen: boolean isHistoryOpen: boolean
@ -33,7 +34,7 @@ export const BAR_WIDTH = 64; // 4rem
export function Bar(props: IBarProps): JSX.Element { export function Bar(props: IBarProps): JSX.Element {
return ( return (
<div className='bar'> <div className={`bar ${props.className}`}>
<BarIcon <BarIcon
isActive={props.isComponentsOpen} isActive={props.isComponentsOpen}
title={Text({ textId: '@Components' })} title={Text({ textId: '@Components' })}

View file

@ -1,4 +1,4 @@
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'; import { EyeIcon, EyeSlashIcon, XCircleIcon } from '@heroicons/react/24/outline';
import * as React from 'react'; import * as React from 'react';
import { IAvailableContainer } from '../../Interfaces/IAvailableContainer'; import { IAvailableContainer } from '../../Interfaces/IAvailableContainer';
import { ICategory } from '../../Interfaces/ICategory'; import { ICategory } from '../../Interfaces/ICategory';
@ -6,12 +6,15 @@ import { IContainerModel } from '../../Interfaces/IContainerModel';
import { TruncateString } from '../../utils/stringtools'; import { TruncateString } from '../../utils/stringtools';
import { Category } from '../Category/Category'; import { Category } from '../Category/Category';
import { Text } from '../Text/Text'; import { Text } from '../Text/Text';
import { IReplaceContainer } from '../../Interfaces/IReplaceContainer';
import { Dispatch } from 'react';
interface IComponentsProps { interface IComponentsProps {
selectedContainer: IContainerModel | undefined selectedContainer: IContainerModel | undefined
componentOptions: IAvailableContainer[] componentOptions: IAvailableContainer[]
categories: ICategory[] categories: ICategory[]
replaceableCategoryName: string | undefined replaceContainer: IReplaceContainer
setReplaceContainer: Dispatch<React.SetStateAction<IReplaceContainer>>
buttonOnClick: (type: string) => void buttonOnClick: (type: string) => void
} }
@ -63,7 +66,7 @@ export function Components(props: IComponentsProps): JSX.Element {
disabled = config.Blacklist?.find(type => type === componentOption.Type) !== undefined ?? false; disabled = config.Blacklist?.find(type => type === componentOption.Type) !== undefined ?? false;
} }
if (componentOption.Category !== props.replaceableCategoryName) { if (props.replaceContainer.isReplacing && componentOption.Category !== props.replaceContainer.category) {
disabled = true; disabled = true;
} }
@ -101,6 +104,15 @@ export function Components(props: IComponentsProps): JSX.Element {
return ( return (
<div className='h-full'> <div className='h-full'>
<div className='hover:bg-slate-300 h-7 text-right pr-1 pl-1'> <div className='hover:bg-slate-300 h-7 text-right pr-1 pl-1'>
{props.replaceContainer.isReplacing && <button
onClick={() => {
props.setReplaceContainer({ isReplacing: false, id: undefined, category: undefined });
}}
className='h-full hover:bg-slate-400 rounded-lg p-1'
>
<XCircleIcon className='heroicon'></XCircleIcon>
</button>
}
<button <button
onClick={() => { setHideDisabled(!hideDisabled); }} onClick={() => { setHideDisabled(!hideDisabled); }}
className='h-full hover:bg-slate-400 rounded-lg p-1' className='h-full hover:bg-slate-400 rounded-lg p-1'
@ -122,4 +134,4 @@ export function Components(props: IComponentsProps): JSX.Element {
</div> </div>
</div> </div>
); );
}; }

View file

@ -8,7 +8,8 @@ import Swal from 'sweetalert2';
import { PropertyType } from '../../../Enums/PropertyType'; import { PropertyType } from '../../../Enums/PropertyType';
import { TransformX, TransformY } from '../../../utils/svg'; import { TransformX, TransformY } from '../../../utils/svg';
import { Orientation } from '../../../Enums/Orientation'; import { Orientation } from '../../../Enums/Orientation';
import { AddContainers, AddContainerToSelectedContainer } from './AddContainer'; import { AddContainerToSelectedContainer } from './AddContainer';
import { IConfiguration } from '../../../Interfaces/IConfiguration';
/** /**
* Select a container * Select a container
@ -113,64 +114,44 @@ export function DeleteContainer(
/** /**
* Replace a container * Replace a container
* @param containerId containerId of the container to delete * @param containerId containerId of the container to delete
* @param newContainerId
* @param configuration
* @param fullHistory History of the editor * @param fullHistory History of the editor
* @param historyCurrentStep Current step * @param historyCurrentStep Current step
* @returns New history * @returns New history
*/ */
// export function ReplaceByContainer( export function ReplaceByContainer(
// containerId: string, containerId: string,
// newContainerId: string, newContainerId: string,
// fullHistory: IHistoryState[], configuration: IConfiguration,
// historyCurrentStep: number fullHistory: IHistoryState[],
// ): IHistoryState[] { historyCurrentStep: number
// const history = GetCurrentHistory(fullHistory, historyCurrentStep); ): IHistoryState[] {
// const current = history[history.length - 1]; const history = GetCurrentHistory(fullHistory, historyCurrentStep);
// const current = history[history.length - 1];
//
// const containers = structuredClone(current.containers); const historyDelete = DeleteContainer(containerId, fullHistory, historyCurrentStep);
// const container = FindContainerById(containers, containerId); const currentDelete = historyDelete[historyDelete.length - 1];
// if (container === undefined) { const selectedContainer = FindContainerById(currentDelete.containers, currentDelete.selectedContainerId);
// throw new Error(`[ReplaceContainer] Tried to delete a container that is not present in the main container: ${containerId}`); if (selectedContainer != null) {
// } const historyAdd = AddContainerToSelectedContainer(newContainerId, selectedContainer, configuration, fullHistory, historyCurrentStep);
// ///
// const parent = FindContainerById(containers, container.properties.parentId); const currentAdd = historyAdd[historyAdd.length - 1];
// if (parent === undefined || parent === null) {
// throw new Error('[ReplaceContainer] Cannot replace a container that does not exists'); fullHistory.push({
// } lastAction: `Replace ${containerId} by ${newContainerId}`,
// mainContainer: currentAdd.mainContainer,
// const index = parent.children.indexOf(container.properties.id); containers: currentAdd.containers,
// selectedContainerId: currentAdd.selectedContainerId,
// const newHistoryAfterDelete = DeleteContainer( typeCounters: Object.assign({}, currentAdd.typeCounters),
// container.properties.id, symbols: current.symbols,
// history, selectedSymbolId: current.selectedSymbolId
// historyCurrentStep });
// );
// return fullHistory;
// const newContainer = FindContainerById(containers, container.properties.parentId); }
// return history;
// AddContainerToSelectedContainer( }
// ne,
// selected,
// configuration,
// history,
// historyCurrentStep
// );
//
//
// /// /
//
//
// history.push({
// lastAction: `Replace ${containerId} By InsertnewId`,
// mainContainer: current.mainContainer,
// containers,
// newContainerId,
// typeCounters: Object.assign({}, current.typeCounters),
// symbols: newSymbols,
// selectedSymbolId: current.selectedSymbolId
// });
// return history;
// }
/** /**
* Returns the next container that will be selected * Returns the next container that will be selected
@ -178,7 +159,7 @@ export function DeleteContainer(
* If the selected container is removed, select the sibling after, * If the selected container is removed, select the sibling after,
* If there is no sibling, select the parent, * If there is no sibling, select the parent,
* *
* @param mainContainerClone Main container * @param containers
* @param selectedContainerId Current selected container * @param selectedContainerId Current selected container
* @param parent Parent of the selected/deleted container * @param parent Parent of the selected/deleted container
* @param index Index of the selected/deleted container * @param index Index of the selected/deleted container
@ -190,11 +171,10 @@ function GetSelectedContainerOnDelete(
parent: IContainerModel, parent: IContainerModel,
index: number index: number
): string { ): string {
const newSelectedContainerId = FindContainerById(containers, selectedContainerId)?.properties.id ?? return FindContainerById(containers, selectedContainerId)?.properties.id ??
parent.children.at(index) ?? parent.children.at(index) ??
parent.children.at(index - 1) ?? parent.children.at(index - 1) ??
parent.properties.id; parent.properties.id;
return newSelectedContainerId;
} }
/** /**
@ -223,6 +203,10 @@ function UnlinkContainerFromSymbols(
* Handled the property change event in the properties form * Handled the property change event in the properties form
* @param key Property name * @param key Property name
* @param value New value of the property * @param value New value of the property
* @param type
* @param selected
* @param fullHistory
* @param historyCurrentStep
* @returns void * @returns void
*/ */
export function OnPropertyChange( export function OnPropertyChange(
@ -264,6 +248,7 @@ export function OnPropertyChange(
/** /**
* Sort the parent children by x * Sort the parent children by x
* @param containers
* @param parent The clone used for the sort * @param parent The clone used for the sort
* @returns void * @returns void
*/ */
@ -328,6 +313,7 @@ export function SortChildren(
/** /**
* Set the container with properties and behaviors (mutate) * Set the container with properties and behaviors (mutate)
* @param containers
* @param container Container to update * @param container Container to update
* @param key Key of the property to update * @param key Key of the property to update
* @param value Value of the property to update * @param value Value of the property to update

View file

@ -16,6 +16,7 @@ import { AddContainers } from './AddContainer';
import { DeleteContainer } from './ContainerOperations'; import { DeleteContainer } from './ContainerOperations';
import { DeleteSymbol } from './SymbolOperations'; import { DeleteSymbol } from './SymbolOperations';
import { Text } from '../../Text/Text'; import { Text } from '../../Text/Text';
import { IReplaceContainer } from '../../../Interfaces/IReplaceContainer';
export function InitActions( export function InitActions(
menuActions: Map<string, IMenuAction[]>, menuActions: Map<string, IMenuAction[]>,
@ -23,7 +24,8 @@ export function InitActions(
history: IHistoryState[], history: IHistoryState[],
historyCurrentStep: number, historyCurrentStep: number,
setNewHistory: (newHistory: IHistoryState[]) => void, setNewHistory: (newHistory: IHistoryState[]) => void,
setHistoryCurrentStep: Dispatch<SetStateAction<number>> setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
setIsReplacingContainer: Dispatch<SetStateAction<IReplaceContainer>>
): void { ): void {
menuActions.set( menuActions.set(
'', '',
@ -60,8 +62,14 @@ export function InitActions(
title: Text({ textId: '@ReplaceByContainerTitle' }), title: Text({ textId: '@ReplaceByContainerTitle' }),
shortcut: '<kbd>R</kbd>', shortcut: '<kbd>R</kbd>',
action: (target: HTMLElement) => { action: (target: HTMLElement) => {
const id = target.id; const targetContainer = FindContainerById(history[historyCurrentStep].containers, target.id);
console.log('replace'); const targetAvailableContainer = configuration.AvailableContainers.find((availableContainer) => availableContainer.Type === targetContainer?.properties.type);
if (targetAvailableContainer === undefined) {
return;
}
setIsReplacingContainer({ isReplacing: true, id: target.id, category: targetAvailableContainer.Category });
} }
}, { }, {
text: Text({ textId: '@DeleteContainer' }), text: Text({ textId: '@DeleteContainer' }),

View file

@ -3,7 +3,7 @@ import './Editor.scss';
import { IConfiguration } from '../../Interfaces/IConfiguration'; import { IConfiguration } from '../../Interfaces/IConfiguration';
import { IHistoryState } from '../../Interfaces/IHistoryState'; import { IHistoryState } from '../../Interfaces/IHistoryState';
import { UI } from '../UI/UI'; import { UI } from '../UI/UI';
import { SelectContainer, DeleteContainer, OnPropertyChange } from './Actions/ContainerOperations'; import { SelectContainer, DeleteContainer, OnPropertyChange, ReplaceByContainer } from './Actions/ContainerOperations';
import { SaveEditorAsJSON, SaveEditorAsSVG } from './Actions/Save'; import { SaveEditorAsJSON, SaveEditorAsSVG } from './Actions/Save';
import { OnKey } from './Actions/Shortcuts'; import { OnKey } from './Actions/Shortcuts';
import { UseCustomEvents, UseEditorListener } from '../../Events/EditorEvents'; import { UseCustomEvents, UseEditorListener } from '../../Events/EditorEvents';
@ -13,6 +13,7 @@ import { FindContainerById } from '../../utils/itertools';
import { Menu } from '../Menu/Menu'; import { Menu } from '../Menu/Menu';
import { InitActions } from './Actions/ContextMenuActions'; import { InitActions } from './Actions/ContextMenuActions';
import { AddContainerToSelectedContainer, AddContainer } from './Actions/AddContainer'; import { AddContainerToSelectedContainer, AddContainer } from './Actions/AddContainer';
import { IReplaceContainer } from '../../Interfaces/IReplaceContainer';
interface IEditorProps { interface IEditorProps {
root: Element | Document root: Element | Document
@ -66,6 +67,8 @@ export function Editor(props: IEditorProps): JSX.Element {
// States // States
const [history, setHistory] = React.useState<IHistoryState[]>(structuredClone(props.history)); const [history, setHistory] = React.useState<IHistoryState[]>(structuredClone(props.history));
const [historyCurrentStep, setHistoryCurrentStep] = React.useState<number>(props.historyCurrentStep); const [historyCurrentStep, setHistoryCurrentStep] = React.useState<number>(props.historyCurrentStep);
const [replaceContainer, setReplaceContainer] = React.useState<IReplaceContainer>({ isReplacing: false, id: undefined, category: undefined });
const editorRef = useRef<HTMLDivElement>(null); const editorRef = useRef<HTMLDivElement>(null);
const setNewHistory = UseNewHistoryState(setHistory, setHistoryCurrentStep); const setNewHistory = UseNewHistoryState(setHistory, setHistoryCurrentStep);
@ -104,7 +107,8 @@ export function Editor(props: IEditorProps): JSX.Element {
history, history,
historyCurrentStep, historyCurrentStep,
setNewHistory, setNewHistory,
setHistoryCurrentStep setHistoryCurrentStep,
setReplaceContainer
); );
// Render // Render
@ -113,7 +117,7 @@ export function Editor(props: IEditorProps): JSX.Element {
const selected = FindContainerById(current.containers, current.selectedContainerId); const selected = FindContainerById(current.containers, current.selectedContainerId);
return ( return (
<div ref={editorRef} className="Editor font-sans h-full"> <div ref={editorRef} className="Editor font-sans h-full ">
<UI <UI
editorState={{ editorState={{
configuration: props.configuration, configuration: props.configuration,
@ -139,11 +143,21 @@ export function Editor(props: IEditorProps): JSX.Element {
history, history,
historyCurrentStep historyCurrentStep
))} ))}
addContainer={(type) => { addOrReplaceContainer={(type) => {
if (selected === null || selected === undefined) { if (selected === null || selected === undefined) {
return; return;
} }
if (replaceContainer.isReplacing && replaceContainer.id !== undefined) {
const newHistory = ReplaceByContainer(
replaceContainer.id,
type,
configuration,
history,
historyCurrentStep
);
setReplaceContainer({ isReplacing: false, id: undefined, category: undefined });
setNewHistory(newHistory);
} else {
setNewHistory(AddContainerToSelectedContainer( setNewHistory(AddContainerToSelectedContainer(
type, type,
selected, selected,
@ -151,6 +165,7 @@ export function Editor(props: IEditorProps): JSX.Element {
history, history,
historyCurrentStep historyCurrentStep
)); ));
}
}} }}
addContainerAt={(index, type, parent) => setNewHistory( addContainerAt={(index, type, parent) => setNewHistory(
AddContainer( AddContainer(
@ -194,9 +209,10 @@ export function Editor(props: IEditorProps): JSX.Element {
)} )}
saveEditorAsSVG={() => SaveEditorAsSVG()} saveEditorAsSVG={() => SaveEditorAsSVG()}
loadState={(move) => setHistoryCurrentStep(move)} loadState={(move) => setHistoryCurrentStep(move)}
/> replaceContainer ={replaceContainer} setReplaceContainer={setReplaceContainer}/>
<Menu <Menu
getListener={() => editorRef.current} getListener={() => editorRef.current}
configuration={configuration}
actions={menuActions} actions={menuActions}
className="z-30 transition-opacity rounded bg-slate-200 drop-shadow-xl" className="z-30 transition-opacity rounded bg-slate-200 drop-shadow-xl"
/> />

View file

@ -2,11 +2,13 @@ import useSize from '@react-hook/size';
import * as React from 'react'; import * as React from 'react';
import { IPoint } from '../../Interfaces/IPoint'; import { IPoint } from '../../Interfaces/IPoint';
import { MenuItem } from './MenuItem'; import { MenuItem } from './MenuItem';
import { IConfiguration } from '../../Interfaces/IConfiguration';
interface IMenuProps { interface IMenuProps {
getListener: () => HTMLElement | null getListener: () => HTMLElement | null
actions: Map<string, IMenuAction[]> actions: Map<string, IMenuAction[]>
className?: string className?: string
configuration: IConfiguration
} }
export interface IMenuAction { export interface IMenuAction {
@ -21,6 +23,7 @@ export interface IMenuAction {
/** function to be called on button click */ /** function to be called on button click */
action: (target: HTMLElement) => void action: (target: HTMLElement) => void
} }
function UseMouseEvents( function UseMouseEvents(
@ -139,7 +142,7 @@ function AddClassSpecificActions(
onClick={() => action.action(target)} />); onClick={() => action.action(target)} />);
}); });
children.push(<hr key={`contextmenu-hr-${count}`} className='border-slate-400' />); children.push(<hr key={`contextmenu-hr-${count}`} className='border-slate-400' />);
}; }
return count; return count;
} }

View file

@ -17,13 +17,15 @@ import { FindContainerById } from '../../utils/itertools';
import { IEditorState } from '../../Interfaces/IEditorState'; import { IEditorState } from '../../Interfaces/IEditorState';
import { GetCurrentHistoryState } from '../Editor/Editor'; import { GetCurrentHistoryState } from '../Editor/Editor';
import { Text } from '../Text/Text'; import { Text } from '../Text/Text';
import { IReplaceContainer } from '../../Interfaces/IReplaceContainer';
import { Dispatch } from 'react';
export interface IUIProps { export interface IUIProps {
editorState: IEditorState editorState: IEditorState
selectContainer: (containerId: string) => void selectContainer: (containerId: string) => void
deleteContainer: (containerId: string) => void deleteContainer: (containerId: string) => void
onPropertyChange: (key: string, value: string | number | boolean | number[], type?: PropertyType) => void onPropertyChange: (key: string, value: string | number | boolean | number[], type?: PropertyType) => void
addContainer: (type: string) => void addOrReplaceContainer: (type: string) => void
addContainerAt: (index: number, type: string, parent: string) => void addContainerAt: (index: number, type: string, parent: string) => void
addSymbol: (type: string) => void addSymbol: (type: string) => void
onSymbolPropertyChange: (key: string, value: string | number | boolean) => void onSymbolPropertyChange: (key: string, value: string | number | boolean) => void
@ -32,6 +34,9 @@ export interface IUIProps {
saveEditorAsJSON: () => void saveEditorAsJSON: () => void
saveEditorAsSVG: () => void saveEditorAsSVG: () => void
loadState: (move: number) => void loadState: (move: number) => void
replaceContainer: IReplaceContainer
setReplaceContainer: Dispatch<React.SetStateAction<IReplaceContainer>>
} }
export enum SidebarType { export enum SidebarType {
@ -57,8 +62,9 @@ function UseSetOrToggleSidebar(
}; };
} }
export function UI({ editorState, ...methods }: IUIProps): JSX.Element { export function UI({ editorState, replaceContainer, setReplaceContainer, ...methods }: IUIProps): JSX.Element {
const [selectedSidebar, setSelectedSidebar] = React.useState<SidebarType>(SidebarType.Components); const [selectedSidebar, setSelectedSidebar] = React.useState<SidebarType>(SidebarType.Components);
const [messages, setMessages] = React.useState<IMessage[]>([]); const [messages, setMessages] = React.useState<IMessage[]>([]);
const current = GetCurrentHistoryState(editorState.history, editorState.historyCurrentStep); const current = GetCurrentHistoryState(editorState.history, editorState.historyCurrentStep);
const configuration = editorState.configuration; const configuration = editorState.configuration;
@ -98,15 +104,13 @@ export function UI({ editorState, ...methods }: IUIProps): JSX.Element {
case SidebarType.Components: case SidebarType.Components:
leftSidebarTitle = Text({ textId: '@Components' }); leftSidebarTitle = Text({ textId: '@Components' });
const AllowedReplaceCategory = undefined;
leftChildren = <Components leftChildren = <Components
selectedContainer={selectedContainer} selectedContainer={selectedContainer}
componentOptions={configuration.AvailableContainers} componentOptions={configuration.AvailableContainers}
categories={configuration.Categories} categories={configuration.Categories}
buttonOnClick={methods.addContainer} buttonOnClick={methods.addOrReplaceContainer}
replaceableCategoryName={AllowedReplaceCategory} replaceContainer={replaceContainer}
/>; setReplaceContainer={setReplaceContainer}/>;
rightSidebarTitle = Text({ textId: '@Elements' }); rightSidebarTitle = Text({ textId: '@Elements' });
rightChildren = <ElementsList rightChildren = <ElementsList
containers={current.containers} containers={current.containers}
@ -187,9 +191,12 @@ export function UI({ editorState, ...methods }: IUIProps): JSX.Element {
isLeftSidebarOpenClasses.add('left-sidebar-single'); isLeftSidebarOpenClasses.add('left-sidebar-single');
} }
const clickRestrictionsClasses = replaceContainer.isReplacing ? 'pointer-events-none opacity-50' : '';
return ( return (
<> <>
<Bar <Bar
className={clickRestrictionsClasses}
isComponentsOpen={selectedSidebar === SidebarType.Components} isComponentsOpen={selectedSidebar === SidebarType.Components}
isSymbolsOpen={selectedSidebar === SidebarType.Symbols} isSymbolsOpen={selectedSidebar === SidebarType.Symbols}
isHistoryOpen={selectedSidebar === SidebarType.History} isHistoryOpen={selectedSidebar === SidebarType.History}
@ -218,6 +225,7 @@ export function UI({ editorState, ...methods }: IUIProps): JSX.Element {
{ leftChildren } { leftChildren }
</Sidebar> </Sidebar>
<Viewer <Viewer
className={clickRestrictionsClasses}
isLeftSidebarOpen={isLeftSidebarOpen} isLeftSidebarOpen={isLeftSidebarOpen}
isRightSidebarOpen={isRightSidebarOpen} isRightSidebarOpen={isRightSidebarOpen}
current={current} current={current}
@ -225,7 +233,7 @@ export function UI({ editorState, ...methods }: IUIProps): JSX.Element {
selectContainer={methods.selectContainer} selectContainer={methods.selectContainer}
/> />
<Sidebar <Sidebar
className={`right-sidebar ${isRightSidebarOpenClasses}`} className={`right-sidebar ${isRightSidebarOpenClasses} ${clickRestrictionsClasses}`}
title={rightSidebarTitle} title={rightSidebarTitle}
> >
{ rightChildren } { rightChildren }

View file

@ -12,6 +12,7 @@ import { SVG } from '../SVG/SVG';
import { RenderSymbol } from '../Canvas/Symbol'; import { RenderSymbol } from '../Canvas/Symbol';
interface IViewerProps { interface IViewerProps {
className: string
isLeftSidebarOpen: boolean isLeftSidebarOpen: boolean
isRightSidebarOpen: boolean isRightSidebarOpen: boolean
current: IHistoryState current: IHistoryState
@ -73,6 +74,7 @@ function UseSVGAutoResizerOnSidebar(
} }
export function Viewer({ export function Viewer({
className,
isLeftSidebarOpen, isRightSidebarOpen, isLeftSidebarOpen, isRightSidebarOpen,
current, current,
selectedContainer, selectedContainer,
@ -160,7 +162,7 @@ export function Viewer({
return ( return (
<Canvas <Canvas
draw={Draw} draw={Draw}
className='ml-16' className={`ml-16 ${className}`}
width={window.innerWidth - BAR_WIDTH} width={window.innerWidth - BAR_WIDTH}
height={window.innerHeight} height={window.innerHeight}
/> />
@ -169,7 +171,7 @@ export function Viewer({
return ( return (
<SVG <SVG
className={marginClasses} className={`${marginClasses} ${className}`}
viewerWidth={viewer.viewerWidth} viewerWidth={viewer.viewerWidth}
viewerHeight={viewer.viewerHeight} viewerHeight={viewer.viewerHeight}
width={mainContainer.properties.width} width={mainContainer.properties.width}

View file

@ -0,0 +1,5 @@
export interface IReplaceContainer {
id: string | undefined
isReplacing: boolean
category: string | undefined
}