dumi 2.0.8 → 2.0.9
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.
package/dist/features/assets.js
CHANGED
|
@@ -164,12 +164,13 @@ export default function DumiContextWrapper() {
|
|
|
164
164
|
|
|
165
165
|
useEffect(() => {
|
|
166
166
|
return history.listen((next) => {
|
|
167
|
-
// mark loading when route change, page component will set false when loaded
|
|
168
|
-
setLoading(true);
|
|
169
|
-
|
|
170
|
-
// scroll to top when route changed
|
|
171
167
|
if (next.location.pathname !== prev.current) {
|
|
172
168
|
prev.current = next.location.pathname;
|
|
169
|
+
|
|
170
|
+
// mark loading when route change, page component will set false when loaded
|
|
171
|
+
setLoading(true);
|
|
172
|
+
|
|
173
|
+
// scroll to top when route changed
|
|
173
174
|
document.documentElement.scrollTo(0, 0);
|
|
174
175
|
}
|
|
175
176
|
});
|
|
@@ -141,7 +141,7 @@ function rehypeDemo(opts) {
|
|
|
141
141
|
if (codeType === "external") {
|
|
142
142
|
const chunkName = [vFile.data.frontmatter.atomId, "demos"].filter(Boolean).join("__");
|
|
143
143
|
parseOpts.fileAbsPath = codeNode.properties.src;
|
|
144
|
-
parseOpts.id = getCodeId(opts.cwd, opts.fileAbsPath, import_path.default.parse(parseOpts.fileAbsPath).name, vFile.data.frontmatter.atomId);
|
|
144
|
+
parseOpts.id = getCodeId(opts.cwd, opts.fileAbsPath, import_path.default.parse(parseOpts.fileAbsPath.replace(/\/index\.(j|t)sx?$/, "")).name, vFile.data.frontmatter.atomId);
|
|
145
145
|
component = `React.lazy(() => import( /* webpackChunkName: "${chunkName}" */ '${(0, import_plugin_utils.winPath)(parseOpts.fileAbsPath)}?techStack=${techStack.name}'))`;
|
|
146
146
|
if (codeValue)
|
|
147
147
|
codeNode.properties.title = codeValue;
|