File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
docs/.vitepress/theme/components/state Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,11 @@ export function deserializeState(serializedString) {
1616 }
1717
1818 try {
19- // For backward compatibility, it can address non-compressed data.
20- const compressed = ! serializedString . startsWith ( "eyJj" ) ;
2119 const decodedText = window . atob ( serializedString ) ;
22- const jsonText = compressed
23- ? pako . inflate ( decodedText , { to : "string" } )
24- : decodedText ;
20+ const jsonText = pako . inflate (
21+ Uint8Array . from ( decodedText , ( c ) => c . charCodeAt ( 0 ) ) ,
22+ { to : "string" } ,
23+ ) ;
2524 const json = JSON . parse ( jsonText ) ;
2625
2726 if ( typeof json === "object" && json != null ) {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export function serializeState(state) {
2525 rules : state . rules ? getEnabledRules ( state . rules ) : undefined ,
2626 } ;
2727 const jsonString = JSON . stringify ( saveData ) ;
28- const compressedString = pako . deflate ( jsonString , { to : "string" } ) ;
28+ const compressedString = String . fromCharCode ( ... pako . deflate ( jsonString ) ) ;
2929 const base64 =
3030 ( typeof window !== "undefined" && window . btoa ( compressedString ) ) ||
3131 compressedString ;
You can’t perform that action at this time.
0 commit comments