parent
d41b146c51
commit
a2ff27f511
|
@ -180,7 +180,9 @@ export class Space extends EventEmitter<SpaceEvents> {
|
|||
async fetchAttachmentList(): Promise<AttachmentMeta[]> {
|
||||
return (await this.space.fetchFileList()).filter(
|
||||
(fileMeta) =>
|
||||
!fileMeta.name.endsWith(".md") && !fileMeta.name.endsWith(".plug.json"),
|
||||
!fileMeta.name.endsWith(".md") &&
|
||||
!fileMeta.name.endsWith(".plug.json") &&
|
||||
fileMeta.name !== "data.db",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import { QueryProviderEvent } from "$sb/app_event.ts";
|
||||
import { applyQuery } from "$sb/lib/query.ts";
|
||||
import { space } from "$sb/silverbullet-syscall/mod.ts";
|
||||
|
||||
export async function attachmentQueryProvider({ query }: QueryProviderEvent) {
|
||||
return applyQuery(query, await space.listAttachments());
|
||||
}
|
|
@ -66,6 +66,12 @@ functions:
|
|||
command:
|
||||
name: "Editor: Toggle Read Only Mode"
|
||||
|
||||
# Attachments
|
||||
attachmentQueryProvider:
|
||||
path: ./attachment.ts:attachmentQueryProvider
|
||||
events:
|
||||
- query:attachment
|
||||
|
||||
# Backlinks
|
||||
indexLinks:
|
||||
path: "./page.ts:indexLinks"
|
||||
|
|
|
@ -54,6 +54,7 @@ Start writing `<!— #query` or simply use `/query` slash command, it will show
|
|||
#### 4.1. Available data sources
|
||||
|
||||
- `page`: list of all pages
|
||||
- `attachment`: list of all attachments
|
||||
- `task`: list of all tasks created with `[ ]`
|
||||
- `full-text`: use it with `where phrase = "SOME_TEXT"`. List of all pages where `SOME_TEXT` is mentioned
|
||||
- `item`: list of ordered and unordered items such as bulleted lists
|
||||
|
|
Loading…
Reference in New Issue