PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.13.0
Code Block Pro – Beautiful Syntax Highlighting v1.13.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
← All changes | src/state/language.ts +11 -4 1.27.31.13.0 View file →
@@ -1,5 +1,5 @@
1 -import { create } from 'zustand';
1 +import create from 'zustand';
2 2 import { devtools, persist } from 'zustand/middleware';
3 3 import { Lang } from '../types';
4 4
5 5 type LanguageType = {
@@ -18,9 +18,9 @@
18 18 get().addRecentLanguage(language);
19 19 },
20 20 recentLanguages: [] as Lang[],
21 21 addRecentLanguage(language: Lang) {
22 - // Limit to the last 5
22 + // Limit to the last 3
23 23 set((state) => {
24 24 if (state.recentLanguages.includes(language)) {
25 25 return state;
26 26 }
@@ -25,9 +25,9 @@
25 25 return state;
26 26 }
27 27 return {
28 28 recentLanguages: [
29 - ...(state.recentLanguages?.slice(-4) || []),
29 + ...(state.recentLanguages?.slice(-2) ?? []),
30 30 language,
31 31 ],
32 32 };
33 33 });
@@ -34,7 +34,14 @@
34 34 },
35 35 }),
36 36 { name: 'Code Block Pro Language' },
37 37 ),
38 - { name: 'code-block-pro-last-language' },
38 + {
39 + name: 'code-block-pro-last-language',
40 + getStorage: () => localStorage,
41 + partialize: (state) => ({
42 + previousLanguage: state?.previousLanguage ?? null,
43 + recentLanguages: state?.recentLanguages ?? [],
44 + }),
45 + },
39 46 ),
40 47 );