Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/easynote/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pnpm-debug.log*
*.njsproj
*.sln
*.sw?
.workbuddy

# 系统文件
.DS_Store
Expand Down
6 changes: 6 additions & 0 deletions plugins/easynote/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。

## [1.7.3] - 2026-09-01

### 新增

- **笔记 / 待办分别清空**:笔记栏、待办栏表头各新增「清空」按钮,二次确认(弹窗显示将删除的对应类型数量)后仅删除该类型全部便签,并提示已删除条数;该栏无便签时按钮置灰不可用。

## [1.7.2] - 2026-08-20

### 修复
Expand Down
5 changes: 5 additions & 0 deletions plugins/easynote/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ easynote 是一个 [ZTools](https://github.com/ztool-center/ztools) 插件,让

## ⏰ 更新日志

### v1.7.3 - 2026-09-01

- **笔记 / 待办分别清空**:笔记栏、待办栏表头各新增「清空」按钮,二次确认后仅删除对应类型的全部条目(确认弹窗会显示将删除的数量),该栏为空时按钮置灰。

### v1.7.2 - 2026-08-20

- **复制净化**:复制原文/纯文本时自动移除 Milkdown 序列化产生的 `<br />` 空行、合并连续空行、清理行首多余转义(如 `\=` → `=`),内容更紧凑干净。
Expand Down Expand Up @@ -119,6 +123,7 @@ npm run build
- **待办栏**:右栏集中展示所有待办,勾选即可标记完成(完成后划线显示,顶部同步完成进度);点击进入内容页。
- **便利贴按钮**:列表每条右侧的便利贴按钮,将内容以桌面便利贴形式打开。
- **删除**:删除按钮移除对应便签。
- **清空**:笔记栏、待办栏表头各有一个「清空」按钮,二次确认后仅删除对应栏的全部条目(不可恢复);该栏为空时按钮置灰。

### 3. 桌面便利贴

Expand Down
4 changes: 2 additions & 2 deletions plugins/easynote/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/easynote/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "easynote",
"version": "1.7.2",
"version": "1.7.3",
"description": "轻量、简单的便签应用,支持 Markdown 所见即所得/双栏编辑、笔记/待办类型管理、纯文本复制、字号控制",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/easynote/public/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "简单便签",
"description": "轻量、简单的便签应用,支持 Markdown 所见即所得/双栏编辑、笔记/待办类型管理、纯文本复制、字号控制",
"author": "咖啡八杯",
"version": "1.7.2",
"version": "1.7.3",
"categories": "productivity",
"main": "index.html",
"preload": "preload/services.js",
Expand Down
31 changes: 30 additions & 1 deletion plugins/easynote/src/Note/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
@open-sticky="$emit('openSticky', $event)"
@change-type="onChangeType"
@delete="onDelete"
@clear="onClear('note')"
/>

<HomeColumn
Expand All @@ -52,6 +53,7 @@
@open-sticky="$emit('openSticky', $event)"
@change-type="onChangeType"
@delete="onDelete"
@clear="onClear('todo')"
>
<template #count>{{ doneCount }}/{{ todos.length }}</template>
<template #prefix="{ item }">
Expand All @@ -69,6 +71,7 @@

<script setup lang="ts">
import { computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Minus } from '@element-plus/icons-vue'
import HomeColumn from './components/HomeColumn.vue'
import { useNotes } from './composables/useNotes'
Expand All @@ -80,7 +83,7 @@ defineEmits<{
(e: 'openSticky', id: string): void
}>()

const { sortedNotes, deleteNote, toggleDone, changeType } = useNotes()
const { sortedNotes, deleteNote, clearByType, toggleDone, changeType } = useNotes()
const { settings, setMode, setFontSize } = useSettings()

const notes = computed(() => sortedNotes.value.filter((n) => n.type === 'note'))
Expand Down Expand Up @@ -109,4 +112,30 @@ function onToggleDone(id: string) {
function onChangeType(id: string) {
changeType(id)
}

/** 清空指定类型的便签:二次确认后删除该栏全部条目 */
async function onClear(type: 'note' | 'todo') {
const list = type === 'note' ? notes.value : todos.value
if (!list.length) return

const label = type === 'note' ? '笔记' : '待办'
try {
await ElMessageBox.confirm(
`将删除全部 ${list.length} 条${label},删除后无法恢复。`,
`清空${label}`,
{
type: 'warning',
confirmButtonText: '确认清空',
cancelButtonText: '取消',
confirmButtonClass: 'el-button--danger',
closeOnClickModal: false
}
)
} catch {
return // 取消
}

const removed = clearByType(type)
if (removed) ElMessage.success(`已删除 ${removed} 条${label}`)
}
</script>
20 changes: 17 additions & 3 deletions plugins/easynote/src/Note/components/HomeColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
<div class="home-col">
<div class="home-col-header">
<span class="home-col-title">{{ title }}</span>
<el-tag size="small" :type="tagType" effect="plain">
<slot name="count">{{ items.length }}</slot>
</el-tag>
<div class="home-col-header-right">
<el-tag size="small" :type="tagType" effect="plain">
<slot name="count">{{ items.length }}</slot>
</el-tag>
<el-button
link
type="danger"
size="small"
:icon="Delete"
:disabled="!items.length"
title="清空该栏"
@click="$emit('clear')"
>
清空
</el-button>
</div>
</div>
<div class="home-list">
<div
Expand Down Expand Up @@ -70,5 +83,6 @@ defineEmits<{
(e: 'openSticky', id: string): void
(e: 'changeType', id: string): void
(e: 'delete', id: string): void
(e: 'clear'): void
}>()
</script>
25 changes: 24 additions & 1 deletion plugins/easynote/src/Note/composables/useNotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,28 @@ export function useNotes() {
savedNotes.value = notes
}

/** 清空指定类型的便签(笔记 / 待办),返回被清除的条数 */
function clearByType(type: NoteType): number {
const remaining = savedNotes.value.filter((x) => x.type !== type)
const count = savedNotes.value.length - remaining.length
if (!count) return 0

persist(remaining)
savedNotes.value = remaining

// 草稿若指向已被清空的便签,断开关联但保留内容,
// 由用户再次保存时决定是重新创建还是放弃
if (draft.value.noteId && !remaining.some((x) => x.id === draft.value.noteId)) {
draft.value = {
noteId: null,
content: draft.value.content,
type: draft.value.type,
done: false
}
}
return count
}

const sortedNotes = computed(() =>
[...savedNotes.value].sort((a, b) => b.updatedAt - a.updatedAt)
)
Expand All @@ -186,6 +208,7 @@ export function useNotes() {
saveDraft,
toggleDone,
changeType,
deleteNote
deleteNote,
clearByType
}
}
6 changes: 6 additions & 0 deletions plugins/easynote/src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ textarea {
font-weight: 600;
}

.home-col-header-right {
display: flex;
align-items: center;
gap: 6px;
}

.home-list {
flex: 1;
min-height: 0;
Expand Down
Loading