From 5c4c73dbf9b6aaad97befd67d6454e03d36f98ba Mon Sep 17 00:00:00 2001 From: Siklos Date: Mon, 15 Aug 2022 17:53:34 +0200 Subject: [PATCH] Add directive for unlimited --- src/Components/Editor/Editor.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Components/Editor/Editor.tsx b/src/Components/Editor/Editor.tsx index 784cca4..3a728e3 100644 --- a/src/Components/Editor/Editor.tsx +++ b/src/Components/Editor/Editor.tsx @@ -18,12 +18,11 @@ interface IEditorProps { historyCurrentStep: number } -export const getCurrentHistory = (history: IHistoryState[], historyCurrentStep: number): IHistoryState[] => { - return history.slice( - Math.max(0, history.length - MAX_HISTORY), +export const getCurrentHistory = (history: IHistoryState[], historyCurrentStep: number): IHistoryState[] => + history.slice( + Math.max(0, history.length - MAX_HISTORY), // change this to 0 for unlimited (not recommanded because of overflow) historyCurrentStep + 1 ); -}; export const getCurrentHistoryState = (history: IHistoryState[], historyCurrentStep: number): IHistoryState => history[historyCurrentStep];