@electrolux-oss/sanity-plugin-media 2.0.0 → 3.0.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 +30 -12
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -27
- package/sanity.json +0 -8
package/README.md
CHANGED
|
@@ -3,9 +3,15 @@
|
|
|
3
3
|
> This plugin is for **Sanity Studio v4**.
|
|
4
4
|
> This is a forked version of Sanitys own [Media Plugin (v4.0.0)](https://github.com/sanity-io/sanity-plugin-media)
|
|
5
5
|
|
|
6
|
+
## :warning: Breaking changes - (v2.0.0 → v3.0.0)
|
|
7
|
+
### **v2 → v3**
|
|
8
|
+
|
|
9
|
+
This release upgrades the plugin’s peer dependency from **React 18** to **React 19**.
|
|
10
|
+
Projects using this plugin must update to React 19 before upgrading to v3.
|
|
11
|
+
|
|
6
12
|
## What is it?
|
|
7
13
|
|
|
8
|
-
A Sanity Studio
|
|
14
|
+
A Sanity Studio v4 plugin that extends media handling capabilities with custom enhancements, based on a fork of an original plugin by Sanity.io.
|
|
9
15
|
|
|
10
16
|
A convenient way to browse, manage and refine your [Sanity](https://www.sanity.io/) assets.
|
|
11
17
|
|
|
@@ -52,7 +58,7 @@ _Asset details tab_ | _Asset alt texts tab_
|
|
|
52
58
|
- Define a list of available languages to enable multi-language alt texts for assets.
|
|
53
59
|
- See example of how to enable this feature [here](###plugin-config).
|
|
54
60
|
|
|
55
|
-
## Install (Sanity Studio
|
|
61
|
+
## Install (Sanity Studio v4)
|
|
56
62
|
|
|
57
63
|
In your Sanity project folder:
|
|
58
64
|
|
|
@@ -146,27 +152,39 @@ export default defineConfig({
|
|
|
146
152
|
|
|
147
153
|
### Test your plugin locally
|
|
148
154
|
|
|
149
|
-
|
|
155
|
+
**Step 1: Set up the plugin for local development**
|
|
156
|
+
|
|
157
|
+
In the plugin directory, run:
|
|
150
158
|
```zsh
|
|
151
159
|
npm run link-watch
|
|
152
160
|
```
|
|
153
161
|
|
|
154
|
-
This will
|
|
162
|
+
This will:
|
|
163
|
+
- Build your plugin automatically whenever code changes
|
|
164
|
+
- Publish the package to a local yalc repository
|
|
155
165
|
|
|
156
|
-
|
|
166
|
+
**Step 2: Link the plugin to your studio**
|
|
157
167
|
|
|
168
|
+
In your studio project directory, run:
|
|
158
169
|
```zsh
|
|
159
|
-
npx yalc add @electrolux-oss/sanity-plugin-media &&
|
|
170
|
+
npx yalc add @electrolux-oss/sanity-plugin-media && npm install
|
|
160
171
|
```
|
|
161
172
|
|
|
162
|
-
|
|
173
|
+
**Step 3: Verify the setup**
|
|
163
174
|
|
|
175
|
+
Check your studio's `package.json` - you should see:
|
|
176
|
+
```json
|
|
177
|
+
"@electrolux-oss/sanity-plugin-media": "file:.yalc/@electrolux-oss/sanity-plugin-media"
|
|
164
178
|
```
|
|
165
|
-
|
|
179
|
+
|
|
180
|
+
Now you can use the local version of the plugin:
|
|
181
|
+
```typescript
|
|
182
|
+
import { workflow } from '@electrolux-oss/sanity-plugin-media'
|
|
166
183
|
```
|
|
167
184
|
|
|
168
|
-
|
|
185
|
+
### Making changes
|
|
169
186
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
187
|
+
When you modify the plugin code:
|
|
188
|
+
1. The `link-watch` command will automatically rebuild
|
|
189
|
+
2. In your studio, run `npx yalc update` to pull the latest changes
|
|
190
|
+
3. Restart your dev server: `npm run dev`
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var jsxRuntime = require("react/jsx-runtime"), sanity = require("sanity"), icons = require("@sanity/icons"), react = require("react"), ui = require("@sanity/ui"), groq = require("groq"), reactRedux = require("react-redux"), nanoid = require("nanoid"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), toolkit = require("@reduxjs/toolkit"), uuid = require("@sanity/uuid"), styledComponents = require("styled-components"), pluralize = require("pluralize"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), reactHookForm = require("react-hook-form"), zod = require("@hookform/resolvers/zod"), z = require("zod"),
|
|
3
|
+
var jsxRuntime = require("react/jsx-runtime"), sanity = require("sanity"), icons = require("@sanity/icons"), react = require("react"), ui = require("@sanity/ui"), groq = require("groq"), reactRedux = require("react-redux"), nanoid = require("nanoid"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), toolkit = require("@reduxjs/toolkit"), uuid = require("@sanity/uuid"), styledComponents = require("styled-components"), pluralize = require("pluralize"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), reactHookForm = require("react-hook-form"), zod = require("@hookform/resolvers/zod"), z = require("zod"), dateFns = require("date-fns"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), reactDropzone = require("react-dropzone");
|
|
4
4
|
function _interopDefaultCompat(e) {
|
|
5
5
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
6
|
}
|
|
@@ -19,7 +19,7 @@ function _interopNamespaceCompat(e) {
|
|
|
19
19
|
}
|
|
20
20
|
}), n.default = e, Object.freeze(n);
|
|
21
21
|
}
|
|
22
|
-
var groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z),
|
|
22
|
+
var groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z), filesize__default = /* @__PURE__ */ _interopDefaultCompat(filesize), copy__default = /* @__PURE__ */ _interopDefaultCompat(copy), CreatableSelect__default = /* @__PURE__ */ _interopDefaultCompat(CreatableSelect);
|
|
23
23
|
function getDefaultExportFromCjs(x) {
|
|
24
24
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
25
25
|
}
|
|
@@ -2788,7 +2788,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
2788
2788
|
Row,
|
|
2789
2789
|
{
|
|
2790
2790
|
label: "Original date",
|
|
2791
|
-
value:
|
|
2791
|
+
value: dateFns.format(new Date(exif.DateTimeOriginal), "PPp")
|
|
2792
2792
|
}
|
|
2793
2793
|
)
|
|
2794
2794
|
] }) })
|
|
@@ -3079,7 +3079,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
3079
3079
|
"Last updated",
|
|
3080
3080
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
3081
3081
|
" ",
|
|
3082
|
-
|
|
3082
|
+
dateFns.format(new Date(lastUpdated), "PPp")
|
|
3083
3083
|
] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsxRuntime.jsx(
|
|
3084
3084
|
ui.Tooltip,
|
|
3085
3085
|
{
|
|
@@ -4878,7 +4878,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4878
4878
|
gridRow: mediaIndex < 3 ? 4 : "auto",
|
|
4879
4879
|
opacity: opacityCell
|
|
4880
4880
|
},
|
|
4881
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children:
|
|
4881
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: dateFns.formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()) })
|
|
4882
4882
|
}
|
|
4883
4883
|
),
|
|
4884
4884
|
/* @__PURE__ */ jsxRuntime.jsx(
|