mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
core: support video,audio,document filter in attachments
This commit is contained in:
committed by
Abdullah Atta
parent
0374aa17c4
commit
ec1001067d
@@ -242,7 +242,15 @@ export class Attachments implements ICollection {
|
|||||||
|
|
||||||
ofNote(
|
ofNote(
|
||||||
noteId: string,
|
noteId: string,
|
||||||
...types: ("files" | "images" | "webclips" | "all")[]
|
...types: (
|
||||||
|
| "files"
|
||||||
|
| "images"
|
||||||
|
| "videos"
|
||||||
|
| "audio"
|
||||||
|
| "documents"
|
||||||
|
| "webclips"
|
||||||
|
| "all"
|
||||||
|
)[]
|
||||||
) {
|
) {
|
||||||
const selector = this.db.relations.from(
|
const selector = this.db.relations.from(
|
||||||
{ type: "note", id: noteId },
|
{ type: "note", id: noteId },
|
||||||
@@ -256,6 +264,16 @@ export class Attachments implements ICollection {
|
|||||||
const filters = [];
|
const filters = [];
|
||||||
if (types.includes("images"))
|
if (types.includes("images"))
|
||||||
filters.push(eb("mimeType", "like", `image/%`));
|
filters.push(eb("mimeType", "like", `image/%`));
|
||||||
|
|
||||||
|
if (types.includes("videos"))
|
||||||
|
filters.push(eb("mimeType", "like", `video/%`));
|
||||||
|
|
||||||
|
if (types.includes("audio"))
|
||||||
|
filters.push(eb("mimeType", "like", `audio/%`));
|
||||||
|
|
||||||
|
if (types.includes("documents"))
|
||||||
|
filters.push(eb("mimeType", "in", DocumentMimeTypes));
|
||||||
|
|
||||||
if (types.includes("webclips"))
|
if (types.includes("webclips"))
|
||||||
filters.push(
|
filters.push(
|
||||||
eb("mimeType", "==", `application/vnd.notesnook.web-clip`)
|
eb("mimeType", "==", `application/vnd.notesnook.web-clip`)
|
||||||
|
|||||||
Reference in New Issue
Block a user