@lvce-editor/problems-view 1.34.1 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1990,6 +1990,10 @@ const focusIndex = (state, index) => {
|
|
|
1990
1990
|
};
|
|
1991
1991
|
};
|
|
1992
1992
|
|
|
1993
|
+
const getComponentState = uid => {
|
|
1994
|
+
return get(uid).newState;
|
|
1995
|
+
};
|
|
1996
|
+
|
|
1993
1997
|
const mergeClassNames = (...classNames) => {
|
|
1994
1998
|
return classNames.filter(Boolean).join(' ');
|
|
1995
1999
|
};
|
|
@@ -2852,6 +2856,34 @@ const handleWheel = (state, deltaMode, deltaY) => {
|
|
|
2852
2856
|
return setDeltaY(state, currentDeltaY + deltaY);
|
|
2853
2857
|
};
|
|
2854
2858
|
|
|
2859
|
+
const handleWorkspaceChange = (state, newWorkspaceUri) => {
|
|
2860
|
+
const {
|
|
2861
|
+
workspaceUri
|
|
2862
|
+
} = state;
|
|
2863
|
+
if (newWorkspaceUri === workspaceUri) {
|
|
2864
|
+
return state;
|
|
2865
|
+
}
|
|
2866
|
+
return {
|
|
2867
|
+
...state,
|
|
2868
|
+
activeUri: '',
|
|
2869
|
+
collapsedUris: [],
|
|
2870
|
+
deltaY: 0,
|
|
2871
|
+
fileIconCache: {},
|
|
2872
|
+
filteredProblems: [],
|
|
2873
|
+
finalDeltaY: 0,
|
|
2874
|
+
focusedIndex: -2,
|
|
2875
|
+
handleOffset: 0,
|
|
2876
|
+
listItems: [],
|
|
2877
|
+
maxLineY: 0,
|
|
2878
|
+
message: getMessage(0),
|
|
2879
|
+
minLineY: 0,
|
|
2880
|
+
problems: [],
|
|
2881
|
+
scrollBarActive: false,
|
|
2882
|
+
scrollBarHeight: 0,
|
|
2883
|
+
workspaceUri: newWorkspaceUri
|
|
2884
|
+
};
|
|
2885
|
+
};
|
|
2886
|
+
|
|
2855
2887
|
const initialize = async () => {
|
|
2856
2888
|
// function is not needed anymore
|
|
2857
2889
|
};
|
|
@@ -3773,6 +3805,23 @@ const saveState = state => {
|
|
|
3773
3805
|
};
|
|
3774
3806
|
};
|
|
3775
3807
|
|
|
3808
|
+
const applyComponentState = (currentState, state) => {
|
|
3809
|
+
if (!state || typeof state !== 'object' || Array.isArray(state)) {
|
|
3810
|
+
throw new TypeError('Problems state must be an object');
|
|
3811
|
+
}
|
|
3812
|
+
const {
|
|
3813
|
+
uid
|
|
3814
|
+
} = state;
|
|
3815
|
+
const {
|
|
3816
|
+
uid: currentUid
|
|
3817
|
+
} = currentState;
|
|
3818
|
+
if (uid !== currentUid) {
|
|
3819
|
+
throw new Error(`Problems state uid must remain ${currentUid}`);
|
|
3820
|
+
}
|
|
3821
|
+
return state;
|
|
3822
|
+
};
|
|
3823
|
+
const setComponentState = wrapCommand(applyComponentState);
|
|
3824
|
+
|
|
3776
3825
|
const toggleFileGroup = (state, uri) => {
|
|
3777
3826
|
const {
|
|
3778
3827
|
collapsedUris
|
|
@@ -3822,6 +3871,7 @@ const commandMap = {
|
|
|
3822
3871
|
'Problems.diff2': diff2,
|
|
3823
3872
|
'Problems.focusIndex': wrapCommand(focusIndex),
|
|
3824
3873
|
'Problems.getCommandIds': getCommandIds,
|
|
3874
|
+
'Problems.getComponentState': getComponentState,
|
|
3825
3875
|
'Problems.getKeyBindings': getKeyBindings,
|
|
3826
3876
|
'Problems.getMenuEntries2': wrapGetter(getMenuEntries2),
|
|
3827
3877
|
'Problems.getMenuIds': getMenuIds,
|
|
@@ -3842,6 +3892,7 @@ const commandMap = {
|
|
|
3842
3892
|
'Problems.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
3843
3893
|
'Problems.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
3844
3894
|
'Problems.handleWheel': wrapCommand(handleWheel),
|
|
3895
|
+
'Problems.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
|
|
3845
3896
|
'Problems.initialize': initialize,
|
|
3846
3897
|
'Problems.loadContent': wrapCommand(loadContent),
|
|
3847
3898
|
'Problems.render2': render2,
|
|
@@ -3849,6 +3900,7 @@ const commandMap = {
|
|
|
3849
3900
|
'Problems.renderEventListeners': renderEventListeners,
|
|
3850
3901
|
'Problems.resize': resize,
|
|
3851
3902
|
'Problems.saveState': wrapGetter(saveState),
|
|
3903
|
+
'Problems.setComponentState': setComponentState,
|
|
3852
3904
|
'Problems.terminate': terminate,
|
|
3853
3905
|
'Problems.toggleFileGroup': wrapCommand(toggleFileGroup),
|
|
3854
3906
|
'Problems.toggleShowErrors': wrapCommand(toggleShowErrors),
|