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/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
mod
|
|
20
20
|
));
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
22
|
-
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"), compact = require("lodash/compact.js"), toLower = require("lodash/toLower.js"), trim = require("lodash/trim.js"), uniq = require("lodash/uniq.js"), words = require("lodash/words.js"), suspendReact = require("suspend-react"), rxjs = require("rxjs"), styledComponents = require("styled-components"), uuid = require("@sanity/uuid"), operators = require("rxjs/operators"), MuxPlayer = require("@mux/mux-player-react"), router = require("sanity/router"), isNumber = require("lodash/isNumber.js"), isString = require("lodash/isString.js"), reactRx = require("react-rx"), useSWR = require("swr"), scrollIntoView = require("scroll-into-view-if-needed"), upchunk = require("@mux/upchunk"), reactIs = require("react-is"), LanguagesList = require("iso-639-1");
|
|
22
|
+
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"), compact = require("lodash/compact.js"), toLower = require("lodash/toLower.js"), trim = require("lodash/trim.js"), uniq = require("lodash/uniq.js"), words = require("lodash/words.js"), suspendReact = require("suspend-react"), rxjs = require("rxjs"), styledComponents = require("styled-components"), uuid = require("@sanity/uuid"), operators = require("rxjs/operators"), MuxPlayer = require("@mux/mux-player-react/lazy"), router = require("sanity/router"), isNumber = require("lodash/isNumber.js"), isString = require("lodash/isString.js"), reactRx = require("react-rx"), useSWR = require("swr"), scrollIntoView = require("scroll-into-view-if-needed"), upchunk = require("@mux/upchunk"), reactIs = require("react-is"), LanguagesList = require("iso-639-1");
|
|
23
23
|
function _interopDefaultCompat(e) {
|
|
24
24
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
25
25
|
}
|
|
@@ -1527,7 +1527,7 @@ function VideoPlayer({
|
|
|
1527
1527
|
crossOrigin: "anonymous",
|
|
1528
1528
|
metadata: {
|
|
1529
1529
|
player_name: "Sanity Admin Dashboard",
|
|
1530
|
-
player_version: "2.11.
|
|
1530
|
+
player_version: "2.11.2",
|
|
1531
1531
|
page_type: "Preview Player"
|
|
1532
1532
|
},
|
|
1533
1533
|
audio: isAudio,
|
|
@@ -1618,21 +1618,21 @@ function PublishedStatus(props) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
function PaneItemPreview(props) {
|
|
1620
1620
|
const { icon, layout, presence, schemaType, value } = props, title = sanity.isRecord(value.title) && React.isValidElement(value.title) || isString__default.default(value.title) || isNumber__default.default(value.title) ? value.title : null, observable = React.useMemo(
|
|
1621
|
-
() => sanity.getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id
|
|
1622
|
-
[props.documentPreviewStore, schemaType,
|
|
1623
|
-
), {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1621
|
+
() => sanity.getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id),
|
|
1622
|
+
[props.documentPreviewStore, schemaType, value._id]
|
|
1623
|
+
), { snapshot, original, isLoading } = reactRx.useObservable(observable, {
|
|
1624
|
+
isLoading: !0,
|
|
1625
|
+
snapshot: null,
|
|
1626
|
+
original: null
|
|
1627
1627
|
}), status = isLoading ? null : /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 4, children: [
|
|
1628
1628
|
presence && presence.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(sanity.DocumentPreviewPresence, { presence }),
|
|
1629
|
-
/* @__PURE__ */ jsxRuntime.jsx(PublishedStatus, { document:
|
|
1630
|
-
/* @__PURE__ */ jsxRuntime.jsx(DraftStatus, { document:
|
|
1629
|
+
/* @__PURE__ */ jsxRuntime.jsx(PublishedStatus, { document: original }),
|
|
1630
|
+
/* @__PURE__ */ jsxRuntime.jsx(DraftStatus, { document: snapshot })
|
|
1631
1631
|
] });
|
|
1632
1632
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1633
1633
|
sanity.SanityDefaultPreview,
|
|
1634
1634
|
{
|
|
1635
|
-
...sanity.getPreviewValueWithFallback({
|
|
1635
|
+
...sanity.getPreviewValueWithFallback({ snapshot, original, fallback: { title } }),
|
|
1636
1636
|
isPlaceholder: isLoading,
|
|
1637
1637
|
icon,
|
|
1638
1638
|
layout,
|
|
@@ -2454,7 +2454,7 @@ const useAccessControl = (config) => {
|
|
|
2454
2454
|
{ refreshInterval: 2e3, refreshWhenHidden: !0, dedupingInterval: 1e3 }
|
|
2455
2455
|
);
|
|
2456
2456
|
};
|
|
2457
|
-
var c = function(r) {
|
|
2457
|
+
var c = (function(r) {
|
|
2458
2458
|
var t, e;
|
|
2459
2459
|
function n(t2) {
|
|
2460
2460
|
var e2;
|
|
@@ -2470,7 +2470,7 @@ var c = function(r) {
|
|
|
2470
2470
|
var r2 = this.state, t2 = this.props, e2 = t2.render, n2 = t2.children, o2 = t2.renderError;
|
|
2471
2471
|
return r2.hasError ? o2 ? o2({ error: r2.error }) : null : e2 ? e2() : n2 || null;
|
|
2472
2472
|
}, n;
|
|
2473
|
-
}(React.PureComponent), u = function(r, t) {
|
|
2473
|
+
})(React.PureComponent), u = function(r, t) {
|
|
2474
2474
|
switch (t.type) {
|
|
2475
2475
|
case "catch":
|
|
2476
2476
|
return { didCatch: !0, error: t.error };
|
|
@@ -2746,13 +2746,14 @@ function testUrl(url) {
|
|
|
2746
2746
|
const error = new Error("Invalid URL");
|
|
2747
2747
|
if (typeof url != "string")
|
|
2748
2748
|
return rxjs.throwError(error);
|
|
2749
|
+
const trimmedUrl = url.trim();
|
|
2749
2750
|
let parsed;
|
|
2750
2751
|
try {
|
|
2751
|
-
parsed = new URL(
|
|
2752
|
+
parsed = new URL(trimmedUrl);
|
|
2752
2753
|
} catch {
|
|
2753
2754
|
return rxjs.throwError(error);
|
|
2754
2755
|
}
|
|
2755
|
-
return parsed && !parsed.protocol.match(/http:|https:/) ? rxjs.throwError(error) : rxjs.of(
|
|
2756
|
+
return parsed && !parsed.protocol.match(/http:|https:/) ? rxjs.throwError(error) : rxjs.of(trimmedUrl);
|
|
2756
2757
|
}
|
|
2757
2758
|
function optionsFromFile(opts, file) {
|
|
2758
2759
|
if (!(typeof window > "u" || !(file instanceof window.File)))
|
|
@@ -3790,7 +3791,7 @@ function Uploader(props) {
|
|
|
3790
3791
|
const events$ = new rxjs.Subject();
|
|
3791
3792
|
return {
|
|
3792
3793
|
observable: events$.asObservable(),
|
|
3793
|
-
handleClick: (event) => events$.next(event)
|
|
3794
|
+
handleClick: ((event) => events$.next(event))
|
|
3794
3795
|
};
|
|
3795
3796
|
})()
|
|
3796
3797
|
).current, uploadRef = React.useRef(null), uploadingDocumentId = React.useRef(null), [state, dispatch] = React.useReducer(
|
|
@@ -3801,7 +3802,7 @@ function Uploader(props) {
|
|
|
3801
3802
|
case "commitUpload":
|
|
3802
3803
|
return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
|
|
3803
3804
|
case "progressInfo": {
|
|
3804
|
-
const { ...payload } = action;
|
|
3805
|
+
const { type, action: _, ...payload } = action;
|
|
3805
3806
|
return Object.assign({}, prev, {
|
|
3806
3807
|
uploadStatus: {
|
|
3807
3808
|
...prev.uploadStatus,
|
|
@@ -3909,7 +3910,7 @@ function Uploader(props) {
|
|
|
3909
3910
|
});
|
|
3910
3911
|
}, handlePaste = (event) => {
|
|
3911
3912
|
event.preventDefault(), event.stopPropagation();
|
|
3912
|
-
const url = (event.clipboardData || window.clipboardData).getData("text");
|
|
3913
|
+
const url = (event.clipboardData || window.clipboardData).getData("text")?.trim();
|
|
3913
3914
|
if (!isValidUrl(url)) {
|
|
3914
3915
|
toast.push({ status: "error", title: "Invalid URL for Mux video input." });
|
|
3915
3916
|
return;
|