@lvce-editor/extension-detail-view 3.44.0 → 3.45.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.
|
@@ -2170,7 +2170,7 @@ const User = 1;
|
|
|
2170
2170
|
const Script = 2;
|
|
2171
2171
|
|
|
2172
2172
|
const isEqual = (oldState, newState) => {
|
|
2173
|
-
return newState.scrollSource === User || oldState.readmeScrollTop === newState.readmeScrollTop;
|
|
2173
|
+
return newState.scrollSource === User || oldState.readmeScrollTop === newState.readmeScrollTop && oldState.selectedTab === newState.selectedTab;
|
|
2174
2174
|
};
|
|
2175
2175
|
|
|
2176
2176
|
const RenderFocus = 2;
|
|
@@ -3549,10 +3549,29 @@ const renderFocus = (oldState, newState) => {
|
|
|
3549
3549
|
return ['Viewlet.focusElementByName', ''];
|
|
3550
3550
|
};
|
|
3551
3551
|
|
|
3552
|
+
const getScrollTop = (selectedTab, readmeScrollTop, changelogScrollTop) => {
|
|
3553
|
+
if (selectedTab === Details) {
|
|
3554
|
+
return readmeScrollTop;
|
|
3555
|
+
}
|
|
3556
|
+
if (selectedTab === Changelog) {
|
|
3557
|
+
return changelogScrollTop;
|
|
3558
|
+
}
|
|
3559
|
+
return -1;
|
|
3560
|
+
};
|
|
3552
3561
|
const renderScrollTop = (oldState, newState) => {
|
|
3553
3562
|
const selector = '.ExtensionDetailPanel .Markdown';
|
|
3554
3563
|
const property = 'scrollTop';
|
|
3555
|
-
|
|
3564
|
+
const {
|
|
3565
|
+
uid,
|
|
3566
|
+
readmeScrollTop,
|
|
3567
|
+
changelogScrollTop,
|
|
3568
|
+
selectedTab
|
|
3569
|
+
} = newState;
|
|
3570
|
+
const scrollTop = getScrollTop(selectedTab, readmeScrollTop, changelogScrollTop);
|
|
3571
|
+
if (scrollTop === -1) {
|
|
3572
|
+
return [];
|
|
3573
|
+
}
|
|
3574
|
+
return ['Viewlet.setProperty', uid, selector, property, scrollTop];
|
|
3556
3575
|
};
|
|
3557
3576
|
|
|
3558
3577
|
const getRenderer = diffType => {
|
|
@@ -3572,7 +3591,10 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
3572
3591
|
const commands = [];
|
|
3573
3592
|
for (const item of diffResult) {
|
|
3574
3593
|
const fn = getRenderer(item);
|
|
3575
|
-
|
|
3594
|
+
const instanceCommands = fn(oldState, newState);
|
|
3595
|
+
if (instanceCommands.length > 0) {
|
|
3596
|
+
commands.push(instanceCommands);
|
|
3597
|
+
}
|
|
3576
3598
|
}
|
|
3577
3599
|
return commands;
|
|
3578
3600
|
};
|