PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.26.7
Code Block Pro – Beautiful Syntax Highlighting v1.26.7
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/global.ts +13 -43 1.9.31.26.7 View file →
@@ -1,49 +1,19 @@
1 -import create from 'zustand';
2 -import { devtools, persist } from 'zustand/middleware';
1 +import { create } from 'zustand';
2 +import { devtools } from 'zustand/middleware';
3 3
4 4 type GlobalTypes = {
5 - seenNotices: string[];
6 - setSeenNotice: (notice: string) => void;
7 - previousSettings: {
8 - copyButton: boolean;
9 - };
10 - setPreviousSettings: (
11 - settings: Partial<GlobalTypes['previousSettings']>,
12 - ) => void;
5 + bringAttentionToPanel: false | string;
6 + setBringAttentionToPanel: (b: false | string) => void;
13 7 };
8 +
14 9 export const useGlobalStore = create<GlobalTypes>()(
15 - persist(
16 - devtools(
17 - (set) => ({
18 - seenNotices: [],
19 - setSeenNotice(notice: string) {
20 - set((state) => {
21 - if (state.seenNotices.includes(notice)) return state;
22 - return { seenNotices: [...state.seenNotices, notice] };
23 - });
24 - },
25 - // If any of these values have changed, we will use these for defaults.
26 - // Themes and languages are handled separately.
27 - previousSettings: {
28 - copyButton: true,
29 - },
30 - setPreviousSettings(
31 - s: Partial<GlobalTypes['previousSettings']>,
32 - ) {
33 - set((state) => ({
34 - previousSettings: { ...state.previousSettings, ...s },
35 - }));
36 - },
37 - }),
38 - { name: 'Code Block Pro Globals' },
39 - ),
40 - {
41 - name: 'code-block-pro-last-globals',
42 - getStorage: () => localStorage,
43 - partialize: (state) => ({
44 - seenNotices: state?.seenNotices ?? [],
45 - previousSettings: state?.previousSettings ?? {},
46 - }),
47 - },
10 + devtools(
11 + (set) => ({
12 + bringAttentionToPanel: false,
13 + setBringAttentionToPanel: (bringAttentionToPanel) => {
14 + set(() => ({ bringAttentionToPanel }));
15 + },
16 + }),
17 + { name: 'Code Block Pro Globals' },
48 18 ),
49 19 );