sanity-plugin-media 6.0.9 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -3
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5633 -3596
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ _Individual asset view_
|
|
|
24
24
|
|
|
25
25
|
- Support for batch uploads with drag and drop support
|
|
26
26
|
- Edit text fields native to Sanity's asset documents, such as `title`, `description`, `altText` and `originalFilename`
|
|
27
|
+
- Browse folder documents in a dedicated sidebar and assign assets to folders individually or in bulk
|
|
27
28
|
- View asset metadata and a limited subset of EXIF data, if present
|
|
28
29
|
- Tag your assets individually or in bulk
|
|
29
30
|
- Manage tags directly within the plugin
|
|
@@ -32,7 +33,7 @@ _Individual asset view_
|
|
|
32
33
|
|
|
33
34
|
#### Granular search tools
|
|
34
35
|
|
|
35
|
-
- Refine your search with any combination of search facets such as filtering by tag name, asset usage, file size, orientation, type (and more)
|
|
36
|
+
- Refine your search with any combination of search facets such as filtering by tag name, folder, asset usage, file size, orientation, type (and more)
|
|
36
37
|
- Use text search for a quick lookup by title, description and alt text
|
|
37
38
|
|
|
38
39
|
#### Built for large datasets and collaborative editing in mind
|
|
@@ -118,6 +119,11 @@ export default defineConfig({
|
|
|
118
119
|
// number - maximum file size (in bytes) that can be uploaded through the plugin interface
|
|
119
120
|
directUploads: true,
|
|
120
121
|
// boolean - enable / disable direct uploads through the plugin interface (default true)
|
|
122
|
+
excludeTags: ['internal', 'archived'],
|
|
123
|
+
// string[] (optional) - tag slugs (`media.tag` `name.current`). Assets that reference
|
|
124
|
+
// any of these tags are omitted from the Media browser grid and asset picker queries,
|
|
125
|
+
// and those tags are hidden in the tag sidebar and tag search facet. The asset edit
|
|
126
|
+
// dialog still lists all tags so you can assign or remove them on an open asset.
|
|
121
127
|
components: {
|
|
122
128
|
details: CustomDetails,
|
|
123
129
|
// Custom component for asset details (see below)
|
|
@@ -286,6 +292,7 @@ export function CustomDetails(props) {
|
|
|
286
292
|
<summary>Limitations when using Sanity's GraphQL endpoints</summary>
|
|
287
293
|
|
|
288
294
|
- Currently, `opt.media.tags` on assets aren't accessible via GraphQL. This is because `opt` is a custom object used by this plugin and not part of Sanity's asset schema.
|
|
295
|
+
- The same limitation applies to `opt.media.folder`.
|
|
289
296
|
|
|
290
297
|
</details>
|
|
291
298
|
|
|
@@ -307,9 +314,9 @@ export function CustomDetails(props) {
|
|
|
307
314
|
<details>
|
|
308
315
|
<summary>How can I query asset fields I've set in this plugin?</summary>
|
|
309
316
|
|
|
310
|
-
The following GROQ query will return an image with additional asset text fields
|
|
317
|
+
The following GROQ query will return an image with additional asset text fields, its folder reference, resolved folder name, and an array of tag names.
|
|
311
318
|
|
|
312
|
-
Note that tags are namespaced within `opt.media
|
|
319
|
+
Note that tags and folders are namespaced within `opt.media`. Tag names are accessed via the `current` property (as they're defined as slugs on the `tag.media` document schema), and the folder is a single weak reference you can dereference for its `name`.
|
|
313
320
|
|
|
314
321
|
```
|
|
315
322
|
*[_id == 'my-document-id'] {
|
|
@@ -319,6 +326,8 @@ Note that tags are namespaced within `opt.media` and tag names are accessed via
|
|
|
319
326
|
_type,
|
|
320
327
|
altText,
|
|
321
328
|
description,
|
|
329
|
+
"folder": opt.media.folder,
|
|
330
|
+
"folderName": opt.media.folder->name,
|
|
322
331
|
"tags": opt.media.tags[]->name.current,
|
|
323
332
|
title
|
|
324
333
|
}
|
|
@@ -338,6 +347,20 @@ Note that tags are namespaced within `opt.media` and tag names are accessed via
|
|
|
338
347
|
|
|
339
348
|
</details>
|
|
340
349
|
|
|
350
|
+
#### Folders
|
|
351
|
+
|
|
352
|
+
<details>
|
|
353
|
+
<summary>How do folders work?</summary>
|
|
354
|
+
|
|
355
|
+
- This plugin defines the document type `media.folder`
|
|
356
|
+
- Folder hierarchy is stored on folder documents using a `parent` reference to another `media.folder` document
|
|
357
|
+
- Asset folder assignment is stored as a weak reference at `opt.media.folder`
|
|
358
|
+
- The default asset browser view shows all assets. Opening a folder filters the asset list to assets assigned to that folder.
|
|
359
|
+
- You can move selected assets to a folder from the selection bar, remove selected assets from the current folder, or change/remove an individual asset's folder from the asset details dialog
|
|
360
|
+
- Deleting a folder deletes only the folder document. Assets assigned to it stay in the library and have their folder assignment removed; nested folders move up one level.
|
|
361
|
+
|
|
362
|
+
</details>
|
|
363
|
+
|
|
341
364
|
#### Tags
|
|
342
365
|
|
|
343
366
|
<details>
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ type DetailsProps = {
|
|
|
15
15
|
allTagOptions: TagSelectOption[];
|
|
16
16
|
assetTagOptions: TagSelectOption[] | null;
|
|
17
17
|
currentAsset: Asset;
|
|
18
|
+
folderPath?: string;
|
|
19
|
+
folderMissing?: boolean;
|
|
20
|
+
onChangeFolder: () => void;
|
|
21
|
+
onRemoveFolder: () => void;
|
|
18
22
|
creditLine?: {
|
|
19
23
|
enabled: boolean;
|
|
20
24
|
excludeSources?: string | string[] | undefined;
|
|
@@ -122,6 +126,13 @@ type MediaToolOptions = {
|
|
|
122
126
|
excludeSources?: string | string[];
|
|
123
127
|
};
|
|
124
128
|
directUploads?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Tag slugs (`media.tag.name.current`) whose assets are omitted from the Media
|
|
131
|
+
* browser grid and asset source/picker queries (and from the tag sidebar / tag
|
|
132
|
+
* search facet). The asset edit dialog still lists all tags so they can be
|
|
133
|
+
* assigned or removed on an open asset.
|
|
134
|
+
*/
|
|
135
|
+
excludeTags?: string[];
|
|
125
136
|
/**
|
|
126
137
|
* Optional locales following Sanity recommended scheme: [{ id, title }]
|
|
127
138
|
* https://www.sanity.io/docs/studio/localization#k4da239411955
|
|
@@ -139,6 +150,7 @@ type CustomFields = {
|
|
|
139
150
|
description?: LocalizedString;
|
|
140
151
|
opt?: {
|
|
141
152
|
media?: {
|
|
153
|
+
folder?: SanityReference;
|
|
142
154
|
tags?: SanityReference[];
|
|
143
155
|
};
|
|
144
156
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/FormBuilderTool/index.tsx","../src/components/DialogAssetEdit/Details.tsx","../src/formSchema/index.ts","../src/types/index.ts","../src/plugin.tsx","../src/components/AutoTagInputWrapper/index.tsx","../src/utils/mediaField.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/FormBuilderTool/index.tsx","../src/components/DialogAssetEdit/Details.tsx","../src/formSchema/index.ts","../src/types/index.ts","../src/plugin.tsx","../src/components/AutoTagInputWrapper/index.tsx","../src/utils/mediaField.ts"],"mappings":";;;;;;;cAQM,kBAAe,OAAW,8CAAyB,IAAA;KCsB7C;EACV;EACA,kBAAkB;EAClB,SAAS,QAAQ;EACjB,QAAQ,YAAY;EACpB,UAAU,gBAAgB;EAC1B,eAAe;EACf,iBAAiB;EACjB,cAAc;EACd;EACA;EACA;EACA;EACA;IACE;IACA;;EAEF,UAAU;;cCjCC,iBAAe,EAAA;;;;;;;;;;iBAKZ,mBAAmB;EAAW;MAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCJ/C;EACV;;KAGU;EACV;EACA;EACA;IACE,UAAU,cACR;MAAgB,uBAAuB,OAAO,iBAAiB,IAAI;;;EAGvE;IACE;IACA;;EAEF;;;;;;;EAOA;;;;;EAKA,UAAU;;KAGA;EACV;EACA;GACC;;KAGE,2BAA2B;KAE3B;EACH,UAAU;EACV,cAAc;EACd;IACE;MACE,SAAS;MACT,OAAO;;;EAGX,QAAQ;;KAYE,QAAQ,YAAY;KAEpB,gBAAgB,EAAE,MAAM,kBAAkB;KAgJ1C,YAAY,sBACtB;EACE;;KAuBQ,aAAa,2BACvB;EACE;EACA,aAAa;;KAqBL;EACV;EACA;EACA;;KA0IU,kBAAkB,EAAE,aAAa;cCzYhC;;;;;;cAkBA,wBAAK,cAAA;KCpBN,oBAAoB;EAC9B;;;;;;;;;;;;;;;;;;;;;iBAsBc,aAAa,OAAO,oCAAiB,IAAA;KC7BhD,wBAAwB,KAAK,8BAChC;EACE;EACA;EACA,UAAU;;KAGT,uBAAuB,KAAK,6BAC/B;EACE;EACA;EACA,UAAU;;KAGT,wBAAwB,KAAK,8BAChC;EACE,UAAU;IAA8B;;EACxC;IAAa,cAAc;;IACzB,kBACJ;KAEG,uBAAuB,KAAK,6BAC/B;EACE,UAAU;IAA6B;;EACvC;IAAa,cAAc;;IACzB,kBACJ;;;;;;;;;;;;;;;;;;;;;;iBAuBc,WAAW,QAAQ,wBAAwB;iBAC3C,WAAW,QAAQ,uBAAuB"}
|