Explorar el Código

fix: scroll in low network speed

DaiQiangReal hace 3 años
padre
commit
ae7ba925ba
Se han modificado 3 ficheros con 18 adiciones y 89 borrados
  1. 6 6
      package.json
  2. 3 1
      src/templates/postTemplate.js
  3. 9 82
      yarn.lock

+ 6 - 6
package.json

@@ -45,7 +45,7 @@
         "@douyinfe/semi-site-banner": "^0.0.2",
         "@douyinfe/semi-site-doc-style": "0.0.1",
         "@douyinfe/semi-site-header": "^0.0.10",
-        "@douyinfe/semi-site-markdown-blocks": "^0.0.7",
+        "@douyinfe/semi-site-markdown-blocks": "^0.0.8",
         "@mdx-js/react": "^1.6.22",
         "@svgr/core": "^5.5.0",
         "@types/react-window": "^1.8.5",
@@ -113,6 +113,7 @@
         "@babel/types": "^7.15.4",
         "@commitlint/cli": "^9.1.2",
         "@commitlint/config-conventional": "^7.6.0",
+        "@cypress/code-coverage": "^3.9.12",
         "@octokit/rest": "^18.12.0",
         "@shopify/jest-dom-mocks": "^2.11.7",
         "@storybook/addon-a11y": "^6.4.10",
@@ -150,6 +151,8 @@
         "chromatic": "^6.0.6",
         "crypto": "^1.0.1",
         "css-loader": "^3.6.0",
+        "cypress": "9.5.2",
+        "cypress-plugin-tab": "^1.0.5",
         "enzyme": "^3.11.0",
         "enzyme-adapter-react-16": "^1.15.6",
         "enzyme-to-json": "^3.6.2",
@@ -198,10 +201,7 @@
         "webpack": "^4.46.0",
         "webpack-cli": "^3.3.12",
         "webpack-dev-server": "^3.11.2",
-        "webpackbar": "^5.0.0-3",
-        "cypress": "9.5.2",
-        "cypress-plugin-tab": "^1.0.5",
-        "@cypress/code-coverage": "^3.9.12"
+        "webpackbar": "^5.0.0-3"
     },
     "husky": {
         "hooks": {
@@ -225,4 +225,4 @@
         ]
     },
     "license": "MIT"
-}
+}

+ 3 - 1
src/templates/postTemplate.js

@@ -528,7 +528,9 @@ export default function Template(args) {
                     let timer = null;
                     const messageHandle = (e)=>{
                         if(e.data === "oneCodeLoaded"){
-                            dom.scrollIntoView();
+                            // dom.scrollIntoView();
+                            window.scroll(0,dom.offsetTop)
+                            console.log("===>",dom.offsetHeight);
                             clearTimeout(timer);
                             timer = setTimeout(()=>{
                                 window.removeEventListener('message',messageHandle);

+ 9 - 82
yarn.lock

@@ -1445,16 +1445,6 @@
   resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
   integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==
 
-"@douyinfe/[email protected]":
-  version "2.18.2"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-animation-react/-/semi-animation-react-2.18.2.tgz#e4dc3ff6e56cf92ee318719f202a0470a9c2316f"
-  integrity sha512-OUo5a59vG3L28iKrcAQ/ENjSYHlJKiAWKk8IusR1GldLSgj4PIP8b/sl80tUJQWJSnp6TwSULc0JR8vIH/zs8w==
-  dependencies:
-    "@babel/runtime-corejs3" "^7.15.4"
-    "@douyinfe/semi-animation" "2.12.0"
-    "@douyinfe/semi-animation-styled" "2.18.2"
-    classnames "^2.2.6"
-
 "@douyinfe/[email protected]":
   version "2.9.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-animation-react/-/semi-animation-react-2.9.1.tgz#f2e4c6ef7899729ee6145edf0579598ba195bfdd"
@@ -1465,13 +1455,6 @@
     "@douyinfe/semi-animation-styled" "2.9.1"
     classnames "^2.2.6"
 
-"@douyinfe/[email protected]":
-  version "2.18.2"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-animation-styled/-/semi-animation-styled-2.18.2.tgz#7df86873d933f734c7c0d5d954d186ae8e5bbe77"
-  integrity sha512-y62aVQ0//pObTa8quPBVJtCcZ6XZCppr0h1Ms+xc1mHVd7E7ddWDqaeW3X8/zsfcX9IzT66bM4GBlzQlciLbig==
-  dependencies:
-    "@babel/runtime-corejs3" "^7.15.4"
-
 "@douyinfe/[email protected]":
   version "2.9.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-animation-styled/-/semi-animation-styled-2.9.1.tgz#0a4a3c521626118b209604b2d6447fbcaa4839a4"
@@ -1495,21 +1478,6 @@
     "@babel/runtime-corejs3" "^7.15.4"
     bezier-easing "^2.1.0"
 
-"@douyinfe/[email protected]":
-  version "2.18.2"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-foundation/-/semi-foundation-2.18.2.tgz#c765e2bc15532914a19f250ce180dc523603de37"
-  integrity sha512-r32i0fIL0DYpHRILCN/KJ4B8PEpfjxnoSAkG5RYxUqydLwACUwfBEbYtFvdftEbq1pMSlB2zcxoYCVGJQBa1xQ==
-  dependencies:
-    "@babel/runtime-corejs3" "^7.15.4"
-    "@douyinfe/semi-animation" "2.12.0"
-    async-validator "^3.5.0"
-    classnames "^2.2.6"
-    date-fns "^2.9.0"
-    date-fns-tz "^1.0.10"
-    lodash "^4.17.21"
-    memoize-one "^5.2.1"
-    scroll-into-view-if-needed "^2.2.24"
-
 "@douyinfe/[email protected]":
   version "2.9.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-foundation/-/semi-foundation-2.9.1.tgz#1300bb97d6ceb92274ca4c9e6c66c5c16dc284ea"
@@ -1525,14 +1493,6 @@
     memoize-one "^5.2.1"
     scroll-into-view-if-needed "^2.2.24"
 
-"@douyinfe/[email protected]", "@douyinfe/semi-icons@^2.0.0":
-  version "2.18.2"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-icons/-/semi-icons-2.18.2.tgz#daea1b5c738926646286b84e163eca59523f0c6a"
-  integrity sha512-d+OBgn34xrGLEhNdKC5kvAhJVpNGD65tG/ibNhxoC7esxW9hhOYpq77r3n+Pv7pDd2mIM9q4JoKWLTlcc/hJcw==
-  dependencies:
-    "@babel/runtime-corejs3" "^7.15.4"
-    classnames "^2.2.6"
-
 "@douyinfe/[email protected]", "@douyinfe/semi-icons@latest":
   version "2.9.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-icons/-/semi-icons-2.9.1.tgz#7a04e1a77070220b04f63e6f65aac30155ed8ddd"
@@ -1586,20 +1546,20 @@
     lodash-es "^4.17.21"
     react-i18next "^11.12.0"
 
-"@douyinfe/semi-site-markdown-blocks@^0.0.7":
-  version "0.0.7"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-site-markdown-blocks/-/semi-site-markdown-blocks-0.0.7.tgz#4377224a2e9d2e7ef9bbfaa10430033feb748f63"
-  integrity sha512-LP6wQCyTsA7bE6bFSrnyQS7+VdmbW8llCA23KqqlM9y/LF4NJqoNkLP0K0PeLqMVRdEfgvreNKRwIsBdHFL4+A==
+"@douyinfe/semi-site-markdown-blocks@^0.0.8":
+  version "0.0.8"
+  resolved "https://registry.yarnpkg.com/@douyinfe/semi-site-markdown-blocks/-/semi-site-markdown-blocks-0.0.8.tgz#692cf395ce399dc544d1c6ab7310b36c47734724"
+  integrity sha512-7OLcwhwGhzyL//lcgYSQ/pxIa193LVixv/QouN1Tf+ulK4fSz1EfDH3uLE+yC4w2LRqtkLNVkE+t5hVpauDseA==
   dependencies:
-    "@douyinfe/semi-site-playground" "0.0.7"
+    "@douyinfe/semi-site-playground" "0.0.8"
     classnames "^2.2.6"
     prism-react-renderer "^1.0.1"
     prop-types "^15.7.2"
 
-"@douyinfe/[email protected].7":
-  version "0.0.7"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-site-playground/-/semi-site-playground-0.0.7.tgz#5be45ca2d87420200bc52c730cf37a77f5d4d586"
-  integrity sha512-JhzHshDEfLBmc1sxTyGgbvpADIMxLBaq83LnizsPYUfbwmA97j2oJPftyQuktMZIWAl1Yl90cvAX4iIBb7XlhQ==
+"@douyinfe/[email protected].8":
+  version "0.0.8"
+  resolved "https://registry.yarnpkg.com/@douyinfe/semi-site-playground/-/semi-site-playground-0.0.8.tgz#faf19a7c3e36d2737148e4dda01ea081e1d9a9f0"
+  integrity sha512-u2EF4GNfW5AsCu1HfczIfkyjdoKYxk+jq30lZqQ04hVv9eD65kKMkG6YIPllemLmf63/dG9XBhFMbGPsYO6smw==
   dependencies:
     "@douyinfe/semi-icons" "^2.0.0"
     "@douyinfe/semi-ui" "^2.0.0"
@@ -1611,13 +1571,6 @@
     monaco-themes "^0.3.3"
     react-live "^2.2.2"
 
-"@douyinfe/[email protected]":
-  version "2.18.2"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-theme-default/-/semi-theme-default-2.18.2.tgz#33686bc173271ef46d8c5b267152a4580565a2a6"
-  integrity sha512-p64ocgajnetGgsfHPkxTZ2fP36CG3MXuGmvo9L9J6K3bwk5cQITCxYAht84JQtoLPXaeRL7hgBPh7Jtd90WieA==
-  dependencies:
-    glob "^7.1.6"
-
 "@douyinfe/[email protected]":
   version "2.9.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-theme-default/-/semi-theme-default-2.9.1.tgz#734113e9783ca58b69afe1769005e7e57e5a4da7"
@@ -1625,32 +1578,6 @@
   dependencies:
     glob "^7.1.6"
 
-"@douyinfe/semi-ui@^2.0.0":
-  version "2.18.2"
-  resolved "https://registry.yarnpkg.com/@douyinfe/semi-ui/-/semi-ui-2.18.2.tgz#3e41d400140792281e1dba7d321ddbadc17f9460"
-  integrity sha512-RFgrFkg1n3Srs6z7y9r2vfn698KgjzxjeIHCSonr8QiVTJR12q/5NcZjvY66iHaDRPP5yHWXp0C+FUIUYBczNA==
-  dependencies:
-    "@babel/runtime-corejs3" "^7.15.4"
-    "@douyinfe/semi-animation" "2.12.0"
-    "@douyinfe/semi-animation-react" "2.18.2"
-    "@douyinfe/semi-foundation" "2.18.2"
-    "@douyinfe/semi-icons" "2.18.2"
-    "@douyinfe/semi-illustrations" "2.15.0"
-    "@douyinfe/semi-theme-default" "2.18.2"
-    async-validator "^3.5.0"
-    classnames "^2.2.6"
-    copy-text-to-clipboard "^2.1.1"
-    date-fns "^2.9.0"
-    date-fns-tz "^1.0.10"
-    lodash "^4.17.21"
-    prop-types "^15.7.2"
-    react-resizable "^1.8.0"
-    react-sortable-hoc "^2.0.0"
-    react-window "^1.8.2"
-    resize-observer-polyfill "^1.5.1"
-    scroll-into-view-if-needed "^2.2.24"
-    utility-types "^3.10.0"
-
 "@douyinfe/semi-ui@latest":
   version "2.9.1"
   resolved "https://registry.yarnpkg.com/@douyinfe/semi-ui/-/semi-ui-2.9.1.tgz#505d4783ea1fa73d307b75f62091030f1fee9332"