27
27
</q-item >
28
28
29
29
<q-item
30
- v-if =" note.react.notes.length > 0"
31
30
clickable
32
31
@click =" copyAsMarkdown({ includeDescendants: true })"
33
32
>
56
55
</q-item >
57
56
58
57
<q-item
59
- v-if =" note.react.notes.length > 0"
60
58
clickable
61
59
@click =" downloadAsMarkdown({ includeDescendants: true })"
62
60
>
@@ -88,7 +86,24 @@ import type { Ref } from 'vue';
88
86
89
87
const page = inject <Ref <Page >>(' page' )! ;
90
88
91
- const note = computed (() => page .value .activeElem .react .value as PageNote );
89
+ function notesToMarkdown(
90
+ notes : PageNote [],
91
+ params : {
92
+ includeDescendants: boolean ;
93
+ },
94
+ ) {
95
+ let markdown = ' ' ;
96
+
97
+ for (const [noteIndex, note] of notes .entries ()) {
98
+ if (noteIndex > 0 ) {
99
+ markdown += ' \n\n ---\n\n ' ;
100
+ }
101
+
102
+ markdown += noteToMarkdown (note , params );
103
+ }
104
+
105
+ return markdown ;
106
+ }
92
107
93
108
function noteToMarkdown(
94
109
note : PageNote ,
@@ -179,7 +194,7 @@ function editorToMarkdown(editor: Editor) {
179
194
180
195
async function copyAsMarkdown(params : { includeDescendants: boolean }) {
181
196
await setClipboardText (
182
- noteToMarkdown ( note .value , {
197
+ notesToMarkdown ( page .value . selection . react . notes , {
183
198
includeDescendants: params .includeDescendants ,
184
199
}),
185
200
);
@@ -194,7 +209,7 @@ async function downloadAsMarkdown(params: { includeDescendants: boolean }) {
194
209
try {
195
210
const blob = new Blob (
196
211
[
197
- noteToMarkdown ( note .value , {
212
+ notesToMarkdown ( page .value . selection . react . notes , {
198
213
includeDescendants: params .includeDescendants ,
199
214
}),
200
215
],
0 commit comments