File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,8 @@ <h1 class="text-3xl font-semibold mb-2">Bash Script Tools</h1>
9696 < script >
9797 ace . config . set ( "basePath" , "https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2/" ) ;
9898
99+ const STORAGE_KEY = "bash-script-tools-content" ;
100+
99101 const editor = ace . edit ( "editor" ) ;
100102 editor . session . setMode ( "ace/mode/sh" ) ;
101103 editor . setOptions ( {
@@ -105,6 +107,17 @@ <h1 class="text-3xl font-semibold mb-2">Bash Script Tools</h1>
105107 highlightGutterLine : true ,
106108 } ) ;
107109
110+ // Load content from localStorage
111+ const savedContent = localStorage . getItem ( STORAGE_KEY ) ;
112+ if ( savedContent ) {
113+ editor . setValue ( savedContent , - 1 ) ;
114+ }
115+
116+ // Save content to localStorage on change
117+ editor . session . on ( "change" , function ( ) {
118+ localStorage . setItem ( STORAGE_KEY , editor . getValue ( ) ) ;
119+ } ) ;
120+
108121 function setButtonsDisabled ( disabled ) {
109122 document . getElementById ( "format-btn" ) . disabled = disabled ;
110123 document . getElementById ( "lint-btn" ) . disabled = disabled ;
You can’t perform that action at this time.
0 commit comments