Browse Source

修复JSON右键菜单的问题;同时修复其他小样式问题

[email protected] 2 years ago
parent
commit
1b5a740912

+ 7 - 5
apps/background/awesome.js

@@ -75,10 +75,15 @@ let Awesome = (() => {
         let toolKey = TOOL_NAME_TPL.replace('#TOOL-NAME#', toolName);
 
         return Promise.all([StorageMgr.get(toolKey), StorageMgr.get(menuKey)]).then(values => {
+            let toolInstalled = !!values[0];
+            // 系统预置的功能,是强制 installed 状态的
+            if(toolMap[toolName] && toolMap[toolName].systemInstalled) {
+                toolInstalled = true;
+            }
             if (detectMenu) {
-                return values[0] && String(values[1]) === '1';
+                return toolInstalled && String(values[1]) === '1';
             }
-            return !!values[0];
+            return toolInstalled;
         });
     };
 
@@ -154,9 +159,6 @@ let Awesome = (() => {
                     toolMap[tool][key] = toolMap[tool][key] && toolMap[tool]._enable;
                 }
             });
-            Object.keys(toolMap).forEach(tool => {
-                toolMap[tool].installed = toolMap[tool].systemInstalled || toolMap[tool].installed;
-            });
             return toolMap;
         });
         let pSort = SortToolMgr.get();

+ 1 - 1
apps/background/background.js

@@ -368,7 +368,7 @@ let BgPageInstance = (function () {
                         return true;
                     case 'toggle-jsonformat-options':
                         Awesome.StorageMgr.get('JSON_TOOL_BAR_ALWAYS_SHOW').then(result => {
-                            let show = result !== 'false';
+                            let show = result !== false;
                             Awesome.StorageMgr.set('JSON_TOOL_BAR_ALWAYS_SHOW',!show).then(() => {
                                 callback && callback(!show);
                             });

+ 1 - 1
apps/json-format/content-script.css

@@ -284,7 +284,7 @@ html..fh-jf body {
 html.fh-jf .x-toolbar {
     background-color: #f5f5f5;
     background: -webkit-linear-gradient(#fafafa, #f4f4f4 40%, #e5e5e5);
-    margin: 10px 0;
+    margin: 0 0 10px ;
     border: 1px solid #ddd;
     border-bottom-color: #ccc;
     border-radius: 4px;

+ 2 - 2
apps/json-format/content-script.js

@@ -86,7 +86,7 @@ window.JsonAutoFormat = (() => {
             type: 'fh-dynamic-any-thing',
             thing:'request-jsonformat-options',
             params: STORAGE_KEYS
-        }).then(result => success(result));
+        }, result => success(result));
     };
 
     let _getHtmlFragment = () => {
@@ -301,7 +301,7 @@ window.JsonAutoFormat = (() => {
             chrome.runtime.sendMessage({
                 type: 'fh-dynamic-any-thing',
                 thing: 'toggle-jsonformat-options'
-            }).then(show => {
+            }, show => {
                 let toolBarClassList = document.querySelector('#jfToolbar').classList;
                 if (show) {
                     toolBarClassList.remove('t-collapse');

+ 2 - 2
apps/json-format/index.css

@@ -137,11 +137,11 @@ html,body {
     margin-top: 0;
 }
 
-.x-toolbar {
+html.fh-jf .x-toolbar {
     padding-top:5px;
     padding-bottom: 5px;
 }
-.x-toolbar.x-inpage {
+html.fh-jf .x-toolbar.x-inpage {
     margin:10px 20px;
 }
 .panel-title>a.x-other-tools {

+ 1 - 1
apps/manifest.json

@@ -1,7 +1,7 @@
 {
   "name": "FeHelper(前端助手)-Dev",
   "short_name": "FeHelper",
-  "version": "2023.01.0512",
+  "version": "2023.01.0911",
   "manifest_version": 3,
   "description": "JSON自动格式化、手动格式化,支持排序、解码、下载等,更多功能可在配置页按需安装!",
   "icons": {

BIN
output/fehelper.zip