From 35b03201331301985b6dafecdf488170d41f96cd Mon Sep 17 00:00:00 2001 From: zephyr Date: Fri, 8 Jul 2022 16:50:03 +0800 Subject: [PATCH] [update] 1.2.8 --- README.CN.md | 4 +++- README.md | 16 +++++++--------- package.json | 2 +- src/content/download.js | 4 ++-- src/manifest.json | 2 +- src/utils/toast.js | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.CN.md b/README.CN.md index efe6eb3..6f0109d 100644 --- a/README.CN.md +++ b/README.CN.md @@ -64,6 +64,7 @@ div.codehilite > pre ``` ## 改动日志 +- [1.2.8] 更新mermaid版本到9.1.3, 改进toast样式. - [1.2.7] 更新mermaid版本到8.14.0, 支持GitHub原生mermaid下载. - [1.2.6] 更新mermaid版本到8.13.8, 优化配置页交互与样式. - [1.2.5] 更新mermaid版本到8.13.5. 修复bitbucket预览问题. @@ -80,7 +81,8 @@ div.codehilite > pre - [x] 自动化测试套件 - [x] 下载github原生mermaid -- [ ] 改进toast样式 +- [x] 改进toast样式 +- [ ] 修复github下载toast重复问题(分离渲染,contextmenu,toast脚本,仅contextmenu脚本需要allFrames执行) - [ ] 增加hover菜单,用于下载/复制code - [ ] ... diff --git a/README.md b/README.md index 6e0cd74..9d802b3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mermaid Previewer -## github has natively supported mermaid since 2022-02-14 (except gist) [link](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) +## github has natively supported mermaid since 2022-02-14 [link](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) A chrome extension for previewing and exporting mermaid in github/bitbucket. @@ -15,19 +15,15 @@ Right-click on the rendered mermaid image and select "Export png" to export the ## Support list - [x] GitHub - - [x] gist(need to match *.md) - - [x] gist comment - - [x] native mermaid download - - [x] ... + - [x] mermaid export - [x] Bitbucket - [x] readme - [x] markdown preview - [x] edit preview - [x] ... -- [x] mermaid picture export. +- [x] mermaid export. - [x] Provide custom exclusion list and rule list configuration capabilities. - At the same time, the following pages with dom structure are supported: ```html
@@ -64,7 +60,8 @@ div.codehilite > pre
 ```
 
 ## Changelog
-- [1.2.7]  Update mermaid version to 8.14.0, support GitHub native mermaid download
+- [1.2.8]  Update mermaid version to 9.1.3, fix repeat toast & modify toast style.
+- [1.2.7]  Update mermaid version to 8.14.0, support GitHub native mermaid download.
 - [1.2.6]  Update mermaid version to 8.13.8, optimize configuration page interaction and style.
 - [1.2.5]  Update mermaid version to 8.13.5, fix preview issue of Bitbucket.
 - [1.2.4]  Added popup options page, providing domain exclusion and dom selector configuration.
@@ -80,7 +77,8 @@ div.codehilite > pre
 
 - [x] autotest suit.
 - [x] download for GitHub native mermaid.
-- [ ] modify toast style.
+- [x] modify toast style.
+- [ ] Fix github download toast duplication problem (separate rendering, contextmenu, toast script, only contextmenu script needs allFrames to execute)
 - [ ] added hover menu for downloading/copying code.
 - [ ] ...
 
diff --git a/package.json b/package.json
index 295625c..3ac6f95 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "mermaid-previewer",
-  "version": "1.2.7",
+  "version": "1.2.8",
   "description": "Preview and export mermaid in github/bitbucket.",
   "directories": {
     "test": "test"
diff --git a/src/content/download.js b/src/content/download.js
index 1ec575a..24aed5e 100644
--- a/src/content/download.js
+++ b/src/content/download.js
@@ -13,7 +13,7 @@ const svgToPng = async (svgContainer, callback) => {
   const imgDom = document.createElement("img");
   imgDom.setAttribute(
     "src",
-    "data:image/svg+xml;base64," + btoa(decodeURI(encodeURIComponent(svgData)))
+    "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(svgData)))
   );
 
   const canvasDom = document.createElement("canvas");
@@ -34,7 +34,7 @@ const svgToPng = async (svgContainer, callback) => {
  * 监听Toast类型的message
  */
 const watchToastMessage = async () => {
-  if (!window.mermaidPreviewerHadWatchToast) {
+  if (!window.mermaidPreviewerHadWatchToast && !inIframe()) {
     // noinspection JSUnresolvedVariable
     chrome.runtime.onMessage.addListener(async (message) => {
       if (message?.type === MESSAGE_TYPE_TOAST) {
diff --git a/src/manifest.json b/src/manifest.json
index 22560c7..9660264 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,7 +1,7 @@
 {
   "name": "Mermaid Previewer",
   "description": "Preview and export mermaid in github/bitbucket.",
-  "version": "1.2.7",
+  "version": "1.2.8",
   "manifest_version": 3,
   "background": {
     "service_worker": "src/worker/background.js"
diff --git a/src/utils/toast.js b/src/utils/toast.js
index c361da9..e2197cf 100644
--- a/src/utils/toast.js
+++ b/src/utils/toast.js
@@ -36,7 +36,7 @@ export const toast = async (text, level) => {
 
   Toastify({
     text: text,
-    duration: 13000,
+    duration: 5000,
     style: css.style,
     close: true,
     position: "center",