过滤剪贴板无效占位符

This commit is contained in:
2026-07-15 22:51:42 +08:00
parent 42e647c932
commit 1ff250fa17
+15
View File
@@ -31,7 +31,22 @@ struct SaveClipIntent: AppIntent {
return .result(value: "文案为空,未保存。") return .result(value: "文案为空,未保存。")
} }
guard !isSystemClipboardPlaceholder(trimmed) else {
return .result(value: "剪贴板没有有效文本,未保存。")
}
try await ClipStore.shared.save(text: trimmed, source: source) try await ClipStore.shared.save(text: trimmed, source: source)
return .result(value: "已保存到收集箱。") return .result(value: "已保存到收集箱。")
} }
private func isSystemClipboardPlaceholder(_ text: String) -> Bool {
let lowercased = text.lowercased()
if lowercased.hasPrefix("clipboard ") && lowercased.contains(" at ") {
return true
}
if text == "获取剪贴板" {
return true
}
return false
}
} }