sanity-plugin-mux-input 2.11.0 → 2.11.2
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/dist/index.js +19 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/actions/upload.ts +3 -2
- package/src/components/Uploader.tsx +1 -1
- package/src/components/VideoPlayer.tsx +2 -1
- package/src/components/documentPreview/PaneItemPreview.tsx +8 -8
- package/src/sanity-ui.d.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-mux-input",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"description": "An input component that integrates Sanity Studio with Mux video encoding/hosting service.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"use-error-boundary": "^2.0.6"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@sanity/client": "^
|
|
74
|
-
"@sanity/pkg-utils": "^
|
|
75
|
-
"@sanity/plugin-kit": "4.0.
|
|
73
|
+
"@sanity/client": "^7.12.1",
|
|
74
|
+
"@sanity/pkg-utils": "^8.1.29",
|
|
75
|
+
"@sanity/plugin-kit": "^4.0.20",
|
|
76
76
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
77
|
-
"@sanity/vision": "^3.
|
|
77
|
+
"@sanity/vision": "^3.99.0",
|
|
78
78
|
"@types/lodash": "^4.17.15",
|
|
79
79
|
"@types/react": "^19.0.10",
|
|
80
80
|
"@types/react-is": "^19.0.0",
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
"react": "^19.0.0",
|
|
97
97
|
"react-dom": "^19.0.0",
|
|
98
98
|
"react-is": "^19.0.0",
|
|
99
|
-
"sanity": "^3.
|
|
99
|
+
"sanity": "^3.99.0",
|
|
100
100
|
"semantic-release": "^24.2.3",
|
|
101
101
|
"styled-components": "^6.1.15",
|
|
102
|
-
"typescript": "5.
|
|
102
|
+
"typescript": "5.9.3"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"react": "^18.3 || ^19",
|
package/src/actions/upload.ts
CHANGED
|
@@ -242,16 +242,17 @@ export function testUrl(url: string): Observable<string> {
|
|
|
242
242
|
if (typeof url !== 'string') {
|
|
243
243
|
return throwError(error)
|
|
244
244
|
}
|
|
245
|
+
const trimmedUrl = url.trim()
|
|
245
246
|
let parsed
|
|
246
247
|
try {
|
|
247
|
-
parsed = new URL(
|
|
248
|
+
parsed = new URL(trimmedUrl)
|
|
248
249
|
} catch (err) {
|
|
249
250
|
return throwError(error)
|
|
250
251
|
}
|
|
251
252
|
if (parsed && !parsed.protocol.match(/http:|https:/)) {
|
|
252
253
|
return throwError(error)
|
|
253
254
|
}
|
|
254
|
-
return of(
|
|
255
|
+
return of(trimmedUrl)
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
function optionsFromFile(opts: {preserveFilename?: boolean}, file: File) {
|
|
@@ -274,7 +274,7 @@ export default function Uploader(props: Props) {
|
|
|
274
274
|
event.preventDefault()
|
|
275
275
|
event.stopPropagation()
|
|
276
276
|
const clipboardData = event.clipboardData || (window as any).clipboardData
|
|
277
|
-
const url = clipboardData.getData('text')
|
|
277
|
+
const url = clipboardData.getData('text')?.trim()
|
|
278
278
|
if (!isValidUrl(url)) {
|
|
279
279
|
toast.push({status: 'error', title: 'Invalid URL for Mux video input.'})
|
|
280
280
|
return
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {type MuxPlayerProps, type MuxPlayerRefAttributes} from '@mux/mux-player-react'
|
|
2
|
+
import MuxPlayer from '@mux/mux-player-react/lazy'
|
|
2
3
|
import {ErrorOutlineIcon} from '@sanity/icons'
|
|
3
4
|
import {Card, Text} from '@sanity/ui'
|
|
4
5
|
import {type PropsWithChildren, useMemo, useRef} from 'react'
|
|
@@ -45,26 +45,26 @@ export function PaneItemPreview(props: PaneItemPreviewProps) {
|
|
|
45
45
|
: null
|
|
46
46
|
|
|
47
47
|
const observable = useMemo(
|
|
48
|
-
() => getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id
|
|
49
|
-
[props.documentPreviewStore, schemaType,
|
|
48
|
+
() => getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id),
|
|
49
|
+
[props.documentPreviewStore, schemaType, value._id]
|
|
50
50
|
)
|
|
51
|
-
const {
|
|
52
|
-
draft: null,
|
|
53
|
-
published: null,
|
|
51
|
+
const {snapshot, original, isLoading} = useObservable(observable, {
|
|
54
52
|
isLoading: true,
|
|
53
|
+
snapshot: null,
|
|
54
|
+
original: null,
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
const status = isLoading ? null : (
|
|
58
58
|
<Inline space={4}>
|
|
59
59
|
{presence && presence.length > 0 && <DocumentPreviewPresence presence={presence} />}
|
|
60
|
-
<PublishedStatus document={
|
|
61
|
-
<DraftStatus document={
|
|
60
|
+
<PublishedStatus document={original} />
|
|
61
|
+
<DraftStatus document={snapshot} />
|
|
62
62
|
</Inline>
|
|
63
63
|
)
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
66
|
<SanityDefaultPreview
|
|
67
|
-
{...(getPreviewValueWithFallback({
|
|
67
|
+
{...(getPreviewValueWithFallback({snapshot, original, fallback: {title}}) as any)}
|
|
68
68
|
isPlaceholder={isLoading}
|
|
69
69
|
icon={icon}
|
|
70
70
|
layout={layout}
|