diff --git a/src/hooks/events/workspace-load.ts b/src/hooks/events/workspace-load.ts index b8c7b9a..faae222 100644 --- a/src/hooks/events/workspace-load.ts +++ b/src/hooks/events/workspace-load.ts @@ -14,7 +14,9 @@ const useWorkspaceLoad = (props: ISTKProps) => { if (props.data) { store.dispatch(sync(props.data)); } else { - store.dispatch(initializeElements()); + if (!props.options?.blank) { + store.dispatch(initializeElements()); + } } props.events?.onWorkspaceLoad?.(); }, [props.data]); diff --git a/src/store/reducers/editor/index.ts b/src/store/reducers/editor/index.ts index a4a327e..0ea257e 100644 --- a/src/store/reducers/editor/index.ts +++ b/src/store/reducers/editor/index.ts @@ -91,6 +91,9 @@ export const slice = createSlice({ resetWorkspace: (state) => { state.initialized = false; state.dataSynced = false; + Object.keys(initialState).forEach((key) => { + state[key] = initialState[key]; + }); }, setCursor: (state, action) => { state.cursor = action.payload; diff --git a/src/types/index.ts b/src/types/index.ts index 2360968..e068762 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -86,6 +86,8 @@ export interface ISTKProps { maxImageSize?: number; /** Overrides the default input placeholder at the top left corner of the screen */ locationInputPlaceholder?: string; + /** Loads a blank workspace */ + blank?: boolean; }; plugins?: IPlugins; }