diff --git a/src/components/CommandSideBar.vue b/src/components/CommandSideBar.vue
index 1c0a1a8..7b0619d 100644
--- a/src/components/CommandSideBar.vue
+++ b/src/components/CommandSideBar.vue
@@ -270,7 +270,7 @@
/>
-
+
diff --git a/src/components/ConfigurationMenu.vue b/src/components/ConfigurationMenu.vue
index b45e218..33a1a07 100644
--- a/src/components/ConfigurationMenu.vue
+++ b/src/components/ConfigurationMenu.vue
@@ -37,6 +37,7 @@
style="width: 280px"
autofocus
v-model="$root.profile.quickFileTag"
+ @blur="$root.profile.quickFileTag || ($root.profile.quickFileTag = '文件')"
type="text"
>
@@ -68,6 +69,8 @@
input-class="text-center"
style="width: 280px"
v-model="$root.profile.quickUrlTag"
+ @blur="$root.profile.quickUrlTag || ($root.profile.quickUrlTag = '网址')"
+
type="text"
>
diff --git a/src/components/ResultArea.vue b/src/components/ResultArea.vue
index 440034f..7bbc178 100644
--- a/src/components/ResultArea.vue
+++ b/src/components/ResultArea.vue
@@ -11,13 +11,13 @@
>
@@ -86,7 +86,12 @@ export default {
!utools.isDarkColors() || (cfw.document.body.style.color = "white");
let clientHeight =
cfw.document.documentElement.getBoundingClientRect().height;
- this.frameHeight = clientHeight === 20 ? 0 : clientHeight;
+ clientHeight = clientHeight === 20 ? 0 : clientHeight;
+ this.frameHeight = Math.max(
+ // 当有绝对定位的元素时只能通过遍历获取高度
+ this.getMaxElHeight(cfw.document),
+ clientHeight
+ );
this.$emit("frameLoad", this.frameHeight);
};
},
@@ -108,6 +113,14 @@ export default {
onerror: (e) => showError(e),
};
},
+ getMaxElHeight(doc) {
+ let els = Array.prototype.slice.call(doc.body.getElementsByTagName("*"));
+ let elHeights = [];
+ for (let i = 0, l = els.length; i < l; i++) {
+ elHeights.push(els[i].scrollTop + els[i].offsetHeight);
+ }
+ return Math.max.apply(Math, elHeights);
+ },
},
};
diff --git a/src/components/popup/ShareDialog.vue b/src/components/popup/ShareDialog.vue
index 5d67850..7aa88cd 100644
--- a/src/components/popup/ShareDialog.vue
+++ b/src/components/popup/ShareDialog.vue
@@ -84,12 +84,7 @@ export default {
},
computed: {
disableShare() {
- return (
- this.shareLock ||
- !this.yuQueInfo.yuQueToken ||
- (this.yuQueInfo.authorId !== this.command.authorId &&
- this.command.fromShare)
- );
+ return this.shareLock || !this.yuQueInfo.yuQueToken;
},
},
mounted() {
diff --git a/src/components/popup/UserData.vue b/src/components/popup/UserData.vue
index edbb7dc..e8c5437 100644
--- a/src/components/popup/UserData.vue
+++ b/src/components/popup/UserData.vue
@@ -18,7 +18,9 @@
:placeholder="item.value || '本机未设置'"
>
- {{ item.id }}
+ {{
+ item.id
+ }}
{
+ this.$root.enterData.payload.forEach((file) => {
let uid = this.getUid();
let fileInfo = window.getFileInfo({
type: "file",
diff --git a/src/components/quickFeatures/FavUrl.vue b/src/components/quickFeatures/FavUrl.vue
index 51ef660..57da8a7 100644
--- a/src/components/quickFeatures/FavUrl.vue
+++ b/src/components/quickFeatures/FavUrl.vue
@@ -24,7 +24,7 @@ export default {
);
url = choise.text + "://" + url;
}
- let title = this.$root.payload.title
+ let title = this.$root.enterData.payload.title
.replace(/和另外 \d+ 个页面.*/, "")
.replace(/[-|—] .*?[Edge|Firefox|Chrome].*/, "")
.trim();
@@ -39,7 +39,7 @@ export default {
let uid = this.getUid();
let command = {
features: {
- explain: `访问${title}`,
+ explain: title,
cmds: [title],
platform: ["linux", "win32", "darwin"],
code: `key_${uid}`,
@@ -51,7 +51,7 @@ export default {
};
try {
let res = await quickcommand.downloadFile(iconUrl, iconPath);
- if (res) command.features.icon = iconPath;
+ if (res) command.features.icon = window.getBase64Ico(iconPath);
} catch (e) {}
this.importCommand(command);
utools.showNotification("操作成功!");
diff --git a/src/components/quickcommandUI/QuickCommand.vue b/src/components/quickcommandUI/QuickCommand.vue
index 5a72315..05be426 100644
--- a/src/components/quickcommandUI/QuickCommand.vue
+++ b/src/components/quickcommandUI/QuickCommand.vue
@@ -85,9 +85,11 @@ export default {
}),
showMessageBox: (message, icon = "success", time) => {
+ message = _.truncate(message, { length: 1200 });
if (icon === "success") icon = "positive";
if (icon === "error") icon = "negative";
- if (!time) time = Math.max(message.toString().length * 120, 1000);
+ if (typeof time === "undefined")
+ time = Math.max(message.toString().length * 120, 1000);
Notify.create({
type: icon,
message: message,
diff --git a/src/js/options/specialVars.js b/src/js/options/specialVars.js
index 399062e..731aa8b 100644
--- a/src/js/options/specialVars.js
+++ b/src/js/options/specialVars.js
@@ -4,7 +4,7 @@
let escapeItem = item => {
if (typeof item === 'number') return item
- item = typeof item === 'object' ? JSON.stringify(item) : item.replace('\\', '\\\\')
+ item = typeof item === 'object' ? JSON.stringify(item) : item.replace(/\\/g, '\\\\')
return item.replace('$', '$$$')
}
diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue
index 01f156d..7a7be05 100644
--- a/src/pages/ConfigurationPage.vue
+++ b/src/pages/ConfigurationPage.vue
@@ -289,7 +289,9 @@ export default {
allQuickCommandTags() {
let allTags = _.union(
...Object.values(this.allQuickCommands).map((x) => x.tags)
- ).concat(["未分类", "来自分享"]);
+ )
+ .concat(["未分类", "来自分享"])
+ .filter((x) => x);
if (this.commandSearchKeyword?.length > 1) allTags.push("搜索结果");
return allTags;
},
diff --git a/src/pages/ShareCenterPage.vue b/src/pages/ShareCenterPage.vue
index 3d79023..c079a2a 100644
--- a/src/pages/ShareCenterPage.vue
+++ b/src/pages/ShareCenterPage.vue
@@ -141,6 +141,7 @@ export default {
releaseRepo: "fofolee/qcreleases",
commandTypes: commandTypes,
platform: window.processPlatform,
+ errCommandsCount: 0,
};
},
computed: {
@@ -151,9 +152,11 @@ export default {
return this.commands.length === this.currentPageCounts ? false : true;
},
currentPageCounts() {
- return this.currentPage === this.maxPages
- ? this.matchedCommands.length % this.perPage
- : this.perPage;
+ return (
+ (this.currentPage === this.maxPages
+ ? this.matchedCommands.length % this.perPage
+ : this.perPage) - this.errCommandsCount
+ );
},
},
mounted() {
@@ -166,6 +169,7 @@ export default {
},
methods: {
fetchCommandDetails(page) {
+ this.errCommandsCount = 0;
this.commands = [];
this.matchedCommands
.slice((page - 1) * this.perPage, page * this.perPage)
@@ -176,7 +180,13 @@ export default {
item.last_editor.name,
item.last_editor.id
).then((command) => {
- this.commands.push(command);
+ if (!command) {
+ this.errCommandsCount++;
+ return;
+ }
+ command.updated
+ ? this.commands.unshift(command.data)
+ : this.commands.push(command.data);
});
});
},
@@ -208,17 +218,29 @@ export default {
// 如果远端更新时间和本地相同则读取本地缓存,否则更新
async getCommand(id, updateTime, authorName, authorId) {
let localCache = JSON.parse(localStorage.getItem(id));
- if (localCache?.updateTime === updateTime) return localCache;
+ if (localCache?.updateTime === updateTime)
+ return {
+ data: localCache,
+ updated: false,
+ };
let res = await window.yuQueClient(
`repos/${this.releaseRepo}/docs/${id}?raw=1`
);
- let command = JSON.parse(
- res.data?.data.body.match(/```json([\s\S]*)```/)?.[1]
- );
+ let command;
+ try {
+ command = JSON.parse(
+ res.data?.data.body.match(/```json([\s\S]*)```/)?.[1]
+ );
+ } catch (error) {
+ console.log("parseErr", command, error);
+ }
if (!command) return;
Object.assign(command, { authorName, updateTime, authorId });
localStorage.setItem(id, JSON.stringify(command));
- return command;
+ return {
+ data: command,
+ updated: true,
+ };
},
fetchCommands() {
window.yuQueClient(`repos/${this.releaseRepo}/docs`).then((res) => {