@lvce-editor/extension-detail-view 3.44.0 → 3.46.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.
|
@@ -34,6 +34,7 @@ const Resources$1 = 'Resources';
|
|
|
34
34
|
const SaveImageAs = 'Save Image as';
|
|
35
35
|
const Schema = 'Schema';
|
|
36
36
|
const ScrollToTop$1 = 'Scroll to top';
|
|
37
|
+
const NoReadmeFound = 'No Readme Found.';
|
|
37
38
|
const Selector = 'Selector';
|
|
38
39
|
const SetColorTheme$1 = 'Set Color Theme';
|
|
39
40
|
const Settings$1 = 'Settings';
|
|
@@ -131,6 +132,9 @@ const uninstall = () => {
|
|
|
131
132
|
const scrollToTop = () => {
|
|
132
133
|
return i18nString(ScrollToTop$1);
|
|
133
134
|
};
|
|
135
|
+
const noReadmeFound = () => {
|
|
136
|
+
return i18nString(NoReadmeFound);
|
|
137
|
+
};
|
|
134
138
|
|
|
135
139
|
const getActivationEventsDetails = async extension => {
|
|
136
140
|
const activationEvents = extension.activation || [];
|
|
@@ -744,8 +748,13 @@ const {
|
|
|
744
748
|
const readFile$1$1 = async uri => {
|
|
745
749
|
return invoke$7('FileSystem.readFile', uri);
|
|
746
750
|
};
|
|
751
|
+
const exists$1 = async uri => {
|
|
752
|
+
// @ts-ignore
|
|
753
|
+
return invoke$7('FileSystem.exists', uri);
|
|
754
|
+
};
|
|
747
755
|
const FileSystemWorker = {
|
|
748
756
|
__proto__: null,
|
|
757
|
+
exists: exists$1,
|
|
749
758
|
invoke: invoke$7,
|
|
750
759
|
readFile: readFile$1$1,
|
|
751
760
|
set: set$7};
|
|
@@ -2170,7 +2179,7 @@ const User = 1;
|
|
|
2170
2179
|
const Script = 2;
|
|
2171
2180
|
|
|
2172
2181
|
const isEqual = (oldState, newState) => {
|
|
2173
|
-
return newState.scrollSource === User || oldState.readmeScrollTop === newState.readmeScrollTop;
|
|
2182
|
+
return newState.scrollSource === User || oldState.readmeScrollTop === newState.readmeScrollTop && oldState.selectedTab === newState.selectedTab;
|
|
2174
2183
|
};
|
|
2175
2184
|
|
|
2176
2185
|
const RenderFocus = 2;
|
|
@@ -2394,6 +2403,7 @@ const handleScroll = (state, scrollTop, scrollSource = Script) => {
|
|
|
2394
2403
|
|
|
2395
2404
|
const {
|
|
2396
2405
|
set,
|
|
2406
|
+
exists,
|
|
2397
2407
|
readFile: readFile$1,
|
|
2398
2408
|
invoke
|
|
2399
2409
|
} = FileSystemWorker;
|
|
@@ -2595,8 +2605,7 @@ const initialize = async () => {
|
|
|
2595
2605
|
};
|
|
2596
2606
|
|
|
2597
2607
|
const existsFile = async uri => {
|
|
2598
|
-
|
|
2599
|
-
return true;
|
|
2608
|
+
return exists(uri);
|
|
2600
2609
|
};
|
|
2601
2610
|
|
|
2602
2611
|
const Web = 1;
|
|
@@ -3057,9 +3066,9 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
3057
3066
|
name
|
|
3058
3067
|
} = headerData;
|
|
3059
3068
|
const readmeUrl = join(extensionUri, 'README.md');
|
|
3060
|
-
join(extensionUri, 'CHANGELOG.md');
|
|
3061
|
-
const [hasReadme, hasChangelog] = await Promise.all([existsFile(), existsFile()]);
|
|
3062
|
-
const readmeContent = await loadReadmeContent(readmeUrl);
|
|
3069
|
+
const changelogUrl = join(extensionUri, 'CHANGELOG.md');
|
|
3070
|
+
const [hasReadme, hasChangelog] = await Promise.all([existsFile(readmeUrl), existsFile(changelogUrl)]);
|
|
3071
|
+
const readmeContent = hasReadme ? await loadReadmeContent(readmeUrl) : noReadmeFound();
|
|
3063
3072
|
const baseUrl = getBaseUrl(extension.path, platform);
|
|
3064
3073
|
const readmeHtml = await renderMarkdown(readmeContent, {
|
|
3065
3074
|
baseUrl
|
|
@@ -3549,10 +3558,29 @@ const renderFocus = (oldState, newState) => {
|
|
|
3549
3558
|
return ['Viewlet.focusElementByName', ''];
|
|
3550
3559
|
};
|
|
3551
3560
|
|
|
3561
|
+
const getScrollTop = (selectedTab, readmeScrollTop, changelogScrollTop) => {
|
|
3562
|
+
if (selectedTab === Details) {
|
|
3563
|
+
return readmeScrollTop;
|
|
3564
|
+
}
|
|
3565
|
+
if (selectedTab === Changelog) {
|
|
3566
|
+
return changelogScrollTop;
|
|
3567
|
+
}
|
|
3568
|
+
return -1;
|
|
3569
|
+
};
|
|
3552
3570
|
const renderScrollTop = (oldState, newState) => {
|
|
3553
3571
|
const selector = '.ExtensionDetailPanel .Markdown';
|
|
3554
3572
|
const property = 'scrollTop';
|
|
3555
|
-
|
|
3573
|
+
const {
|
|
3574
|
+
uid,
|
|
3575
|
+
readmeScrollTop,
|
|
3576
|
+
changelogScrollTop,
|
|
3577
|
+
selectedTab
|
|
3578
|
+
} = newState;
|
|
3579
|
+
const scrollTop = getScrollTop(selectedTab, readmeScrollTop, changelogScrollTop);
|
|
3580
|
+
if (scrollTop === -1) {
|
|
3581
|
+
return [];
|
|
3582
|
+
}
|
|
3583
|
+
return ['Viewlet.setProperty', uid, selector, property, scrollTop];
|
|
3556
3584
|
};
|
|
3557
3585
|
|
|
3558
3586
|
const getRenderer = diffType => {
|
|
@@ -3572,7 +3600,10 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
3572
3600
|
const commands = [];
|
|
3573
3601
|
for (const item of diffResult) {
|
|
3574
3602
|
const fn = getRenderer(item);
|
|
3575
|
-
|
|
3603
|
+
const instanceCommands = fn(oldState, newState);
|
|
3604
|
+
if (instanceCommands.length > 0) {
|
|
3605
|
+
commands.push(instanceCommands);
|
|
3606
|
+
}
|
|
3576
3607
|
}
|
|
3577
3608
|
return commands;
|
|
3578
3609
|
};
|