We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9ab3c0 commit 4e16bcaCopy full SHA for 4e16bca
src/index.tsx
@@ -177,6 +177,18 @@ const Terminal = ({
177
}
178
}, [historyIndex, history.length]);
179
180
+ // history local storage persistency
181
+ useEffect(() => {
182
+ const storedHistory = localStorage.getItem("terminal-history");
183
+ if (storedHistory) {
184
+ setHistory(JSON.parse(storedHistory));
185
+ }
186
+ }, []);
187
+
188
189
+ localStorage.setItem("terminalhistory", JSON.stringify(history));
190
+ }, [history]);
191
192
// We use a hidden input to capture terminal input; make sure the hidden input is focused when clicking anywhere on the terminal
193
useEffect(() => {
194
if (onInput == null) {
0 commit comments