@lvce-editor/problems-view 1.34.2 → 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
|
};
|
|
@@ -3801,6 +3805,23 @@ const saveState = state => {
|
|
|
3801
3805
|
};
|
|
3802
3806
|
};
|
|
3803
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
|
+
|
|
3804
3825
|
const toggleFileGroup = (state, uri) => {
|
|
3805
3826
|
const {
|
|
3806
3827
|
collapsedUris
|
|
@@ -3850,6 +3871,7 @@ const commandMap = {
|
|
|
3850
3871
|
'Problems.diff2': diff2,
|
|
3851
3872
|
'Problems.focusIndex': wrapCommand(focusIndex),
|
|
3852
3873
|
'Problems.getCommandIds': getCommandIds,
|
|
3874
|
+
'Problems.getComponentState': getComponentState,
|
|
3853
3875
|
'Problems.getKeyBindings': getKeyBindings,
|
|
3854
3876
|
'Problems.getMenuEntries2': wrapGetter(getMenuEntries2),
|
|
3855
3877
|
'Problems.getMenuIds': getMenuIds,
|
|
@@ -3878,6 +3900,7 @@ const commandMap = {
|
|
|
3878
3900
|
'Problems.renderEventListeners': renderEventListeners,
|
|
3879
3901
|
'Problems.resize': resize,
|
|
3880
3902
|
'Problems.saveState': wrapGetter(saveState),
|
|
3903
|
+
'Problems.setComponentState': setComponentState,
|
|
3881
3904
|
'Problems.terminate': terminate,
|
|
3882
3905
|
'Problems.toggleFileGroup': wrapCommand(toggleFileGroup),
|
|
3883
3906
|
'Problems.toggleShowErrors': wrapCommand(toggleShowErrors),
|