Skip to content

Commit

Permalink
feat: copy note to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
betterRunner committed Nov 7, 2021
1 parent ba72cdd commit 403f7f7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/content-scripts/renderer/popup/note-book/note-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default defineComponent({
createTime: dayjs().unix(),
updateTime: dayjs().unix(),
link: removeUrlPostfix(window.location.href),
linkTitle: window.document.title ?? '',
content: text,
rects: rects,
tags: [],
Expand Down
13 changes: 12 additions & 1 deletion src/content-scripts/renderer/popup/note-book/note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ import { inject, ref, computed, nextTick, PropType } from "vue";
import randomcolor from "randomcolor";
import dayjs from "dayjs";
import { ElMessage } from "element-plus";
import { QuillEditor, Delta } from "@vueup/vue-quill";
import "@vueup/vue-quill/dist/vue-quill.snow.css";
import { toClipboard } from "@soerenmartius/vue3-clipboard"
import { Note } from "@/types/note";
import { Tag } from "@/types/tag";
Expand Down Expand Up @@ -133,6 +133,17 @@ export default {
},
isConfirm: true,
},
{
title: "Copy to clipboard",
onClick: () => {
const { link = '', linkTitle = '', content = '', tags = [] } : Note = props.note;
const text = `[${linkTitle || 'unknowned'}](${link})
- ${content}
${tags.join(',')}`;
toClipboard(text);
ElMessage.success("Copied");
}
}
]);
/// note tags
Expand Down
1 change: 1 addition & 0 deletions src/types/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface Note {
createTime: number;
updateTime: number;
link: string;
linkTitle: string;
content: string;
tags: string[];
rects: Rect[];
Expand Down
2 changes: 1 addition & 1 deletion todo.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- [ ] export/import notes' data by json
- [x] export
- [x] import
- [ ] expand the notes(classify by tag)
- [x] expand the notes(classify by tag)
- [ ] more precise rects selection rather than coor (select the real dom by text)
- [ ] screenshot features
- https://javascript.plainenglish.io/a-better-alternative-to-html2canvas-in-vuejs-3-e0686755d56e

0 comments on commit 403f7f7

Please sign in to comment.