Ver Fonte

【修复】错误信息地址显示不正确

PJ568 há 1 ano atrás
pai
commit
b6e4a32554
3 ficheiros alterados com 6 adições e 6 exclusões
  1. 1 1
      Cargo.toml
  2. 5 5
      index.html
  3. 0 0
      index.min.html

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "markdown-html"
-version = "1.6.5"
+version = "1.6.6"
 edition = "2021"
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

+ 5 - 5
index.html

@@ -1,7 +1,7 @@
 <!doctype html>
 
 <html>
-<markdown-html version="1.6.5" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
+<markdown-html version="1.6.6" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
   license="CC BY-SA 4.0 International"></markdown-html>
 
 <head>
@@ -221,9 +221,9 @@
       const isRelativePath = (path) => !path.startsWith('/');
 
       // 处理错误
-      async function handleError(errorMessage) {
+      function handleError(mdPath, errorMessage) {
         document.title = '加载失败'
-        document.querySelector('.markdown-body').innerHTML = `<h1>加载失败</h1><p>加载文档<code>${await getPValue()}</code>时出错:<code>${errorMessage}</code>。您可以尝试<a class="refresh-btn" href="">重新加载</a>或<a class="back-btn">返回</a>。</p>`;
+        document.querySelector('.markdown-body').innerHTML = `<h1>加载失败</h1><p>加载文档<code>${mdPath}</code>时出错:<code>${errorMessage}</code>。您可以尝试<a class="refresh-btn" href="">重新加载</a>或<a class="back-btn">返回</a>。</p>`;
         customPushState(window.location.origin + window.location.pathname + '?p=error.md');
         endLoad();
       }
@@ -287,7 +287,7 @@
           customPushState(window.location.origin + window.location.pathname + (mdPath ? ('?p=' + mdPath) : ''));
           showMarkdownEnded();
         } catch (error) {
-          handleError(error)
+          handleError((mdPath ? mdPath : path), error)
         }
       }
 
@@ -425,7 +425,7 @@
         try {
           await showMarkdown(await getPValue());
         } catch (error) {
-          handleError('初始化内容时出错:', error);
+          handleError(await getPValue(), '初始化内容时出错:' + error);
         }
       };
 

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
index.min.html


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff