next-tinacms-dos 1.2.0 → 1.3.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/dist/handlers.js +47 -33
- package/dist/index.es.js +172 -88
- package/dist/index.js +172 -88
- package/package.json +4 -4
package/dist/handlers.js
CHANGED
|
@@ -4,34 +4,36 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
|
-
__markAsModule(target);
|
|
10
8
|
for (var name in all)
|
|
11
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
10
|
};
|
|
13
|
-
var
|
|
14
|
-
if (
|
|
15
|
-
for (let key of __getOwnPropNames(
|
|
16
|
-
if (!__hasOwnProp.call(
|
|
17
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
16
|
}
|
|
19
|
-
return
|
|
20
|
-
};
|
|
21
|
-
var __toModule = (module2) => {
|
|
22
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
17
|
+
return to;
|
|
23
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
24
|
|
|
25
25
|
// src/handlers.ts
|
|
26
|
-
|
|
26
|
+
var handlers_exports = {};
|
|
27
|
+
__export(handlers_exports, {
|
|
27
28
|
createMediaHandler: () => createMediaHandler,
|
|
28
29
|
mediaHandlerConfig: () => mediaHandlerConfig
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
31
|
+
module.exports = __toCommonJS(handlers_exports);
|
|
32
|
+
var import_client_s3 = require("@aws-sdk/client-s3");
|
|
33
|
+
var import_path = __toESM(require("path"));
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_multer = __toESM(require("multer"));
|
|
36
|
+
var import_util = require("util");
|
|
35
37
|
var mediaHandlerConfig = {
|
|
36
38
|
api: {
|
|
37
39
|
bodyParser: false
|
|
@@ -70,16 +72,18 @@ var createMediaHandler = (config, options) => {
|
|
|
70
72
|
};
|
|
71
73
|
};
|
|
72
74
|
async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
73
|
-
const upload = (0, import_util.promisify)(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
const upload = (0, import_util.promisify)(
|
|
76
|
+
(0, import_multer.default)({
|
|
77
|
+
storage: import_multer.default.diskStorage({
|
|
78
|
+
directory: (req2, file, cb) => {
|
|
79
|
+
cb(null, "/tmp");
|
|
80
|
+
},
|
|
81
|
+
filename: (req2, file, cb) => {
|
|
82
|
+
cb(null, file.originalname);
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
}).single("file")
|
|
86
|
+
);
|
|
83
87
|
await upload(req, res);
|
|
84
88
|
const { directory } = req.body;
|
|
85
89
|
let prefix = directory.replace(/^\//, "").replace(/\/$/, "");
|
|
@@ -103,7 +107,11 @@ async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
|
103
107
|
id: prefix + filename,
|
|
104
108
|
filename,
|
|
105
109
|
directory: prefix,
|
|
106
|
-
|
|
110
|
+
thumbnails: {
|
|
111
|
+
"75x75": src,
|
|
112
|
+
"400x400": src,
|
|
113
|
+
"1000x1000": src
|
|
114
|
+
},
|
|
107
115
|
src: cdnUrl + (mediaRoot ? import_path.default.join(mediaRoot, prefix + filename) : prefix + filename)
|
|
108
116
|
});
|
|
109
117
|
} catch (e) {
|
|
@@ -158,10 +166,12 @@ async function listMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
|
158
166
|
directory: import_path.default.dirname(strippedPrefix)
|
|
159
167
|
});
|
|
160
168
|
});
|
|
161
|
-
items.push(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
items.push(
|
|
170
|
+
...(response.Contents || []).filter((file) => {
|
|
171
|
+
const strippedKey = stripMediaRoot(mediaRoot, file.Key);
|
|
172
|
+
return strippedKey !== prefix;
|
|
173
|
+
}).map(getDOSToTinaFunc(cdnUrl, mediaRoot))
|
|
174
|
+
);
|
|
165
175
|
res.json({
|
|
166
176
|
items,
|
|
167
177
|
offset: response.NextMarker
|
|
@@ -208,7 +218,11 @@ function getDOSToTinaFunc(cdnUrl, mediaRoot) {
|
|
|
208
218
|
filename,
|
|
209
219
|
directory,
|
|
210
220
|
src,
|
|
211
|
-
|
|
221
|
+
thumbnails: {
|
|
222
|
+
"75x75": src,
|
|
223
|
+
"400x400": src,
|
|
224
|
+
"1000x1000": src
|
|
225
|
+
},
|
|
212
226
|
type: "file"
|
|
213
227
|
};
|
|
214
228
|
};
|
package/dist/index.es.js
CHANGED
|
@@ -52894,6 +52894,9 @@ function BiArrowToBottom(props) {
|
|
|
52894
52894
|
function BiCloudUpload(props) {
|
|
52895
52895
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M13 19v-4h3l-4-5-4 5h3v4z" } }, { "tag": "path", "attr": { "d": "M7 19h2v-2H7c-1.654 0-3-1.346-3-3 0-1.404 1.199-2.756 2.673-3.015l.581-.102.192-.558C8.149 8.274 9.895 7 12 7c2.757 0 5 2.243 5 5v1h1c1.103 0 2 .897 2 2s-.897 2-2 2h-3v2h3c2.206 0 4-1.794 4-4a4.01 4.01 0 0 0-3.056-3.888C18.507 7.67 15.56 5 12 5 9.244 5 6.85 6.611 5.757 9.15 3.609 9.792 2 11.82 2 14c0 2.757 2.243 5 5 5z" } }] })(props);
|
|
52896
52896
|
}
|
|
52897
|
+
function BiCopyAlt(props) {
|
|
52898
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z" } }, { "tag": "path", "attr": { "d": "M6 12h6v2H6zm0 4h6v2H6z" } }] })(props);
|
|
52899
|
+
}
|
|
52897
52900
|
function BiFile(props) {
|
|
52898
52901
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19.903 8.586a.997.997 0 0 0-.196-.293l-6-6a.997.997 0 0 0-.293-.196c-.03-.014-.062-.022-.094-.033a.991.991 0 0 0-.259-.051C13.04 2.011 13.021 2 13 2H6c-1.103 0-2 .897-2 2v16c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V9c0-.021-.011-.04-.013-.062a.952.952 0 0 0-.051-.259c-.01-.032-.019-.063-.033-.093zM16.586 8H14V5.414L16.586 8zM6 20V4h6v5a1 1 0 0 0 1 1h5l.002 10H6z" } }, { "tag": "path", "attr": { "d": "M8 12h8v2H8zm0 4h8v2H8zm0-8h2v2H8z" } }] })(props);
|
|
52899
52902
|
}
|
|
@@ -52912,6 +52915,9 @@ function BiListUl(props) {
|
|
|
52912
52915
|
function BiRightArrowAlt(props) {
|
|
52913
52916
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" } }] })(props);
|
|
52914
52917
|
}
|
|
52918
|
+
function BiX(props) {
|
|
52919
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z" } }] })(props);
|
|
52920
|
+
}
|
|
52915
52921
|
function IoMdSync(props) {
|
|
52916
52922
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 93.09V32l-80 81.454 80 81.456v-61.093c65.996 0 120 54.982 120 122.183 0 20.363-5 39.714-14.004 57.016L391 342.547c15.996-25.457 25-54.988 25-86.547 0-89.599-72.002-162.91-160-162.91zm0 285.094c-66.001 0-120-54.988-120-122.184 0-20.363 5-39.709 13.999-57.02L121 169.454C104.999 193.89 96 224.436 96 256c0 89.599 72.002 162.91 160 162.91V480l80-81.453-80-81.457v61.094z" } }] })(props);
|
|
52917
52923
|
}
|
|
@@ -52962,7 +52968,12 @@ const dropzoneAcceptFromString = (str) => {
|
|
|
52962
52968
|
return Object.assign({}, ...(str || DEFAULT_MEDIA_UPLOAD_TYPES).split(",").map((x2) => ({ [x2]: [] })));
|
|
52963
52969
|
};
|
|
52964
52970
|
const isImage = (filename) => {
|
|
52965
|
-
return /\.(gif|jpg|jpeg|tiff|png|svg|webp)
|
|
52971
|
+
return /\.(gif|jpg|jpeg|tiff|png|svg|webp)(\?.*)?$/i.test(filename);
|
|
52972
|
+
};
|
|
52973
|
+
const absoluteImgURL = (str) => {
|
|
52974
|
+
if (str.startsWith("http"))
|
|
52975
|
+
return str;
|
|
52976
|
+
return `${window.location.origin}${str}`;
|
|
52966
52977
|
};
|
|
52967
52978
|
const onKeyDownSoftBreak = (editor, { options: { rules = [] } }) => (event) => {
|
|
52968
52979
|
const entry = getBlockAbove(editor);
|
|
@@ -54372,50 +54383,37 @@ function CursorPaginator({
|
|
|
54372
54383
|
className: "w-6 h-full ml-2 opacity-70"
|
|
54373
54384
|
})));
|
|
54374
54385
|
}
|
|
54375
|
-
function ListMediaItem({
|
|
54376
|
-
item,
|
|
54377
|
-
onClick,
|
|
54378
|
-
onSelect,
|
|
54379
|
-
onDelete
|
|
54380
|
-
}) {
|
|
54386
|
+
function ListMediaItem({ item, onClick, active: active3 }) {
|
|
54381
54387
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54388
|
+
const thumbnail = item.thumbnails["75x75"];
|
|
54382
54389
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54383
|
-
className:
|
|
54384
|
-
onClick: () =>
|
|
54390
|
+
className: `flex shrink-0 gap-3 items-center py-2 pl-2 pr-3 transition duration-150 ease-out cursor-pointer border-b border-gray-150 ${active3 ? "bg-gradient-to-r from-white to-gray-50/50 text-blue-500 hover:bg-gray-50" : "bg-white hover:bg-gray-50/50"}`,
|
|
54391
|
+
onClick: () => {
|
|
54392
|
+
if (!active3) {
|
|
54393
|
+
onClick(item);
|
|
54394
|
+
} else {
|
|
54395
|
+
onClick(false);
|
|
54396
|
+
}
|
|
54397
|
+
}
|
|
54385
54398
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54386
54399
|
className: "w-20 h-20 bg-gray-50 shadow border border-gray-100 rounded overflow-hidden flex justify-center flex-shrink-0"
|
|
54387
|
-
}, isImage(
|
|
54400
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54388
54401
|
className: "object-cover w-full h-full object-center",
|
|
54389
|
-
src:
|
|
54402
|
+
src: thumbnail,
|
|
54390
54403
|
alt: item.filename
|
|
54391
54404
|
}) : /* @__PURE__ */ React__default.createElement(FileIcon, {
|
|
54392
54405
|
className: "w-3/5 h-full fill-gray-300"
|
|
54393
|
-
})), /* @__PURE__ */ React__default.createElement(
|
|
54394
|
-
className: "
|
|
54395
|
-
},
|
|
54396
|
-
size: "medium",
|
|
54397
|
-
variant: "white",
|
|
54398
|
-
onClick: () => onSelect(item)
|
|
54399
|
-
}, "Insert", " ", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54400
|
-
className: "ml-1 -mr-0.5 w-6 h-auto text-blue-500 opacity-70"
|
|
54401
|
-
})), onDelete && item.type === "file" && /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
54402
|
-
variant: "ghost",
|
|
54403
|
-
size: "medium",
|
|
54404
|
-
onClick: () => onDelete(item)
|
|
54405
|
-
}, /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54406
|
-
className: "w-6 h-auto"
|
|
54407
|
-
}))));
|
|
54406
|
+
})), /* @__PURE__ */ React__default.createElement("span", {
|
|
54407
|
+
className: "text-base flex-grow w-full break-words truncate"
|
|
54408
|
+
}, item.filename));
|
|
54408
54409
|
}
|
|
54409
|
-
const Filename = ({ className = "", ...props }) => /* @__PURE__ */ React__default.createElement("span", {
|
|
54410
|
-
className: "text-base flex-grow w-full break-words truncate " + className,
|
|
54411
|
-
...props
|
|
54412
|
-
});
|
|
54413
54410
|
function GridMediaItem({ item, active: active3, onClick }) {
|
|
54414
54411
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54412
|
+
const thumbnail = item.thumbnails["400x400"];
|
|
54415
54413
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54416
|
-
className: `relative pb-[100%] h-0 block
|
|
54414
|
+
className: `relative pb-[100%] h-0 block border border-gray-100 rounded-md overflow-hidden flex justify-center shrink-0 w-full transition duration-150 ease-out ${active3 ? "shadow-outline" : "shadow hover:shadow-md hover:scale-103 hover:border-gray-150"} ${item.type === "dir" ? "cursor-pointer" : ""}`
|
|
54417
54415
|
}, /* @__PURE__ */ React__default.createElement("button", {
|
|
54418
|
-
className: "absolute w-full h-full flex items-center justify-center bg-
|
|
54416
|
+
className: "absolute w-full h-full flex items-center justify-center bg-white",
|
|
54419
54417
|
onClick: () => {
|
|
54420
54418
|
if (!active3) {
|
|
54421
54419
|
onClick(item);
|
|
@@ -54423,9 +54421,9 @@ function GridMediaItem({ item, active: active3, onClick }) {
|
|
|
54423
54421
|
onClick(false);
|
|
54424
54422
|
}
|
|
54425
54423
|
}
|
|
54426
|
-
}, isImage(
|
|
54424
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54427
54425
|
className: "object-cover w-full h-full object-center",
|
|
54428
|
-
src:
|
|
54426
|
+
src: thumbnail,
|
|
54429
54427
|
alt: item.filename
|
|
54430
54428
|
}) : /* @__PURE__ */ React__default.createElement("div", {
|
|
54431
54429
|
className: "p-4 w-full flex flex-col gap-4 items-center justify-center"
|
|
@@ -54472,6 +54470,74 @@ function Breadcrumb({ directory = "", setDirectory }) {
|
|
|
54472
54470
|
}, part);
|
|
54473
54471
|
}));
|
|
54474
54472
|
}
|
|
54473
|
+
const DeleteModal = ({
|
|
54474
|
+
close,
|
|
54475
|
+
deleteFunc,
|
|
54476
|
+
filename
|
|
54477
|
+
}) => {
|
|
54478
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54479
|
+
close
|
|
54480
|
+
}, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54481
|
+
padded: true
|
|
54482
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, "Are you sure you want to delete ", /* @__PURE__ */ React__default.createElement("strong", null, filename), "?")), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54483
|
+
style: { flexGrow: 2 },
|
|
54484
|
+
onClick: close
|
|
54485
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54486
|
+
style: { flexGrow: 3 },
|
|
54487
|
+
variant: "danger",
|
|
54488
|
+
onClick: () => {
|
|
54489
|
+
deleteFunc();
|
|
54490
|
+
close();
|
|
54491
|
+
}
|
|
54492
|
+
}, "Delete"))));
|
|
54493
|
+
};
|
|
54494
|
+
const SyncModal = ({ close, syncFunc, folder, branch }) => {
|
|
54495
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54496
|
+
close
|
|
54497
|
+
}, "Sync Media"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54498
|
+
padded: true
|
|
54499
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, `This will copy media assets from the \`${folder}\` folder on branch \`${branch}\` in your git repository to Tina Cloud's asset service. This will allow you to use these assets in your site with Tina Cloud`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54500
|
+
style: { flexGrow: 2 },
|
|
54501
|
+
onClick: close
|
|
54502
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54503
|
+
style: { flexGrow: 3 },
|
|
54504
|
+
variant: "primary",
|
|
54505
|
+
onClick: async () => {
|
|
54506
|
+
await syncFunc();
|
|
54507
|
+
close();
|
|
54508
|
+
}
|
|
54509
|
+
}, "Sync Media"))));
|
|
54510
|
+
};
|
|
54511
|
+
const CopyField = ({ label, description, value }) => {
|
|
54512
|
+
const [copied, setCopied] = React__default.useState(false);
|
|
54513
|
+
const [fadeOut, setFadeOut] = React__default.useState(false);
|
|
54514
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54515
|
+
className: "w-full"
|
|
54516
|
+
}, label && /* @__PURE__ */ React__default.createElement("label", {
|
|
54517
|
+
className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700"
|
|
54518
|
+
}, label), /* @__PURE__ */ React__default.createElement("span", {
|
|
54519
|
+
onClick: () => {
|
|
54520
|
+
if (copied === true)
|
|
54521
|
+
return;
|
|
54522
|
+
setCopied(true);
|
|
54523
|
+
setTimeout(() => {
|
|
54524
|
+
setFadeOut(true);
|
|
54525
|
+
}, 2500);
|
|
54526
|
+
setTimeout(() => {
|
|
54527
|
+
setCopied(false);
|
|
54528
|
+
setFadeOut(false);
|
|
54529
|
+
}, 3e3);
|
|
54530
|
+
navigator.clipboard.writeText(value);
|
|
54531
|
+
},
|
|
54532
|
+
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
54533
|
+
}, /* @__PURE__ */ React__default.createElement(BiCopyAlt, {
|
|
54534
|
+
className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20"
|
|
54535
|
+
}), " ", value, " ", copied && /* @__PURE__ */ React__default.createElement("span", {
|
|
54536
|
+
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
54537
|
+
}, /* @__PURE__ */ React__default.createElement("span", null, "Copied to clipboard!"))), description && /* @__PURE__ */ React__default.createElement("p", {
|
|
54538
|
+
className: "mt-2 text-sm text-gray-500"
|
|
54539
|
+
}, description));
|
|
54540
|
+
};
|
|
54475
54541
|
async function poll(fn2, timeout, interval) {
|
|
54476
54542
|
const endTime = Number(new Date()) + (timeout || 2e3);
|
|
54477
54543
|
interval = interval || 100;
|
|
@@ -54520,6 +54586,7 @@ function MediaPicker({
|
|
|
54520
54586
|
return "loading";
|
|
54521
54587
|
return "not-configured";
|
|
54522
54588
|
});
|
|
54589
|
+
const [deleteModalOpen, setDeleteModalOpen] = React__default.useState(false);
|
|
54523
54590
|
const [listError, setListError] = react.exports.useState(defaultListError);
|
|
54524
54591
|
const [directory, setDirectory] = react.exports.useState(props.directory);
|
|
54525
54592
|
const [list2, setList] = react.exports.useState({
|
|
@@ -54529,6 +54596,7 @@ function MediaPicker({
|
|
|
54529
54596
|
const [showSync, setShowSync] = react.exports.useState(false);
|
|
54530
54597
|
const [viewMode, setViewMode] = react.exports.useState("grid");
|
|
54531
54598
|
const [activeItem, setActiveItem] = react.exports.useState(false);
|
|
54599
|
+
const closePreview = () => setActiveItem(false);
|
|
54532
54600
|
const [offsetHistory, setOffsetHistory] = react.exports.useState([]);
|
|
54533
54601
|
const [loadingText, setLoadingText] = react.exports.useState("");
|
|
54534
54602
|
const offset2 = offsetHistory[offsetHistory.length - 1];
|
|
@@ -54550,7 +54618,16 @@ function MediaPicker({
|
|
|
54550
54618
|
const branch = (_m = cms.api.tina) == null ? void 0 : _m.branch;
|
|
54551
54619
|
function loadMedia() {
|
|
54552
54620
|
setListState("loading");
|
|
54553
|
-
cms.media.list({
|
|
54621
|
+
cms.media.list({
|
|
54622
|
+
offset: offset2,
|
|
54623
|
+
limit: cms.media.pageSize,
|
|
54624
|
+
directory,
|
|
54625
|
+
thumbnailSizes: [
|
|
54626
|
+
{ w: 75, h: 75 },
|
|
54627
|
+
{ w: 400, h: 400 },
|
|
54628
|
+
{ w: 1e3, h: 1e3 }
|
|
54629
|
+
]
|
|
54630
|
+
}).then((list22) => {
|
|
54554
54631
|
setList(list22);
|
|
54555
54632
|
setListState("loaded");
|
|
54556
54633
|
}).catch((e2) => {
|
|
@@ -54570,12 +54647,6 @@ function MediaPicker({
|
|
|
54570
54647
|
return cms.events.subscribe(["media:upload:success", "media:delete:success", "media:pageSize"], loadMedia);
|
|
54571
54648
|
}, [offset2, directory, cms.media.isConfigured]);
|
|
54572
54649
|
const onClickMediaItem = (item) => {
|
|
54573
|
-
if (item.type === "dir") {
|
|
54574
|
-
setDirectory(item.directory === "." || item.directory === "" ? item.filename : join(item.directory, item.filename));
|
|
54575
|
-
resetOffset();
|
|
54576
|
-
}
|
|
54577
|
-
};
|
|
54578
|
-
const onClickGridMediaItem = (item) => {
|
|
54579
54650
|
if (!item) {
|
|
54580
54651
|
setActiveItem(false);
|
|
54581
54652
|
} else if (item.type === "dir") {
|
|
@@ -54588,9 +54659,7 @@ function MediaPicker({
|
|
|
54588
54659
|
let deleteMediaItem;
|
|
54589
54660
|
if (allowDelete) {
|
|
54590
54661
|
deleteMediaItem = (item) => {
|
|
54591
|
-
|
|
54592
|
-
cms.media.delete(item);
|
|
54593
|
-
}
|
|
54662
|
+
cms.media.delete(item);
|
|
54594
54663
|
};
|
|
54595
54664
|
}
|
|
54596
54665
|
let selectMediaItem;
|
|
@@ -54678,7 +54747,16 @@ function MediaPicker({
|
|
|
54678
54747
|
docsLink
|
|
54679
54748
|
});
|
|
54680
54749
|
}
|
|
54681
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null,
|
|
54750
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, deleteModalOpen && /* @__PURE__ */ React__default.createElement(DeleteModal, {
|
|
54751
|
+
filename: activeItem ? activeItem.filename : "",
|
|
54752
|
+
deleteFunc: () => {
|
|
54753
|
+
if (activeItem) {
|
|
54754
|
+
deleteMediaItem(activeItem);
|
|
54755
|
+
setActiveItem(false);
|
|
54756
|
+
}
|
|
54757
|
+
},
|
|
54758
|
+
close: () => setDeleteModalOpen(false)
|
|
54759
|
+
}), /* @__PURE__ */ React__default.createElement(MediaPickerWrap, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
54682
54760
|
className: "flex items-center bg-gray-50 border-b border-gray-150 gap-x-4 py-3 px-5 shadow-sm flex-shrink-0"
|
|
54683
54761
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54684
54762
|
className: `grow-0 flex divide-x divide-gray-150 shadow-inner bg-gray-50 border border-gray-150 justify-between rounded-md`
|
|
@@ -54711,10 +54789,12 @@ function MediaPicker({
|
|
|
54711
54789
|
onClick,
|
|
54712
54790
|
uploading
|
|
54713
54791
|
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54714
|
-
className: "flex h-full overflow-hidden"
|
|
54792
|
+
className: "flex h-full overflow-hidden bg-white"
|
|
54793
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54794
|
+
className: "flex w-full flex-col h-full @container"
|
|
54715
54795
|
}, /* @__PURE__ */ React__default.createElement("ul", {
|
|
54716
54796
|
...rootProps,
|
|
54717
|
-
className: `h-full
|
|
54797
|
+
className: `h-full grow overflow-y-auto transition duration-150 ease-out bg-gradient-to-b from-gray-50/50 to-gray-50 ${list2.items.length === 0 || viewMode === "list" && "w-full flex flex-1 flex-col justify-start -mb-px"} ${list2.items.length > 0 && viewMode === "grid" && "w-full p-4 gap-4 grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 @2xl:grid-cols-4 @4xl:grid-cols-6 @6xl:grid-cols-8 auto-rows-auto content-start justify-start"} ${isDragActive ? `border-2 border-blue-500 rounded-lg` : ``}`
|
|
54718
54798
|
}, /* @__PURE__ */ React__default.createElement("input", {
|
|
54719
54799
|
...getInputProps()
|
|
54720
54800
|
}), listState === "loaded" && list2.items.length === 0 && /* @__PURE__ */ React__default.createElement(EmptyMediaList, {
|
|
@@ -54723,24 +54803,27 @@ function MediaPicker({
|
|
|
54723
54803
|
key: item.id,
|
|
54724
54804
|
item,
|
|
54725
54805
|
onClick: onClickMediaItem,
|
|
54726
|
-
|
|
54727
|
-
onDelete: deleteMediaItem
|
|
54806
|
+
active: activeItem && activeItem.id === item.id
|
|
54728
54807
|
})), viewMode === "grid" && list2.items.map((item) => /* @__PURE__ */ React__default.createElement(GridMediaItem, {
|
|
54729
54808
|
key: item.id,
|
|
54730
54809
|
item,
|
|
54731
|
-
onClick:
|
|
54810
|
+
onClick: onClickMediaItem,
|
|
54732
54811
|
active: activeItem && activeItem.id === item.id
|
|
54733
|
-
}))),
|
|
54734
|
-
|
|
54735
|
-
selectMediaItem,
|
|
54736
|
-
deleteMediaItem
|
|
54737
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54738
|
-
className: "bg-gray-50 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
54812
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
54813
|
+
className: "bg-gradient-to-r to-gray-50/50 from-gray-50 shrink-0 grow-0 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
54739
54814
|
}, /* @__PURE__ */ React__default.createElement(CursorPaginator, {
|
|
54740
54815
|
hasNext,
|
|
54741
54816
|
navigateNext,
|
|
54742
54817
|
hasPrev,
|
|
54743
54818
|
navigatePrev
|
|
54819
|
+
}))), /* @__PURE__ */ React__default.createElement(ActiveItemPreview, {
|
|
54820
|
+
activeItem,
|
|
54821
|
+
close: closePreview,
|
|
54822
|
+
selectMediaItem,
|
|
54823
|
+
allowDelete,
|
|
54824
|
+
deleteMediaItem: () => {
|
|
54825
|
+
setDeleteModalOpen(true);
|
|
54826
|
+
}
|
|
54744
54827
|
}))), showSync && /* @__PURE__ */ React__default.createElement(SyncModal, {
|
|
54745
54828
|
folder,
|
|
54746
54829
|
branch,
|
|
@@ -54752,23 +54835,41 @@ function MediaPicker({
|
|
|
54752
54835
|
}
|
|
54753
54836
|
const ActiveItemPreview = ({
|
|
54754
54837
|
activeItem,
|
|
54838
|
+
close,
|
|
54755
54839
|
selectMediaItem,
|
|
54756
|
-
deleteMediaItem
|
|
54840
|
+
deleteMediaItem,
|
|
54841
|
+
allowDelete
|
|
54757
54842
|
}) => {
|
|
54843
|
+
const thumbnail = activeItem ? activeItem.thumbnails["1000x1000"] : "";
|
|
54758
54844
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54759
|
-
className:
|
|
54760
|
-
},
|
|
54761
|
-
className: "
|
|
54762
|
-
|
|
54845
|
+
className: `shrink-0 h-full flex flex-col items-start gap-3 overflow-y-auto bg-white border-l border-gray-100 bg-white shadow-md transition ease-out duration-150 ${activeItem ? `p-4 opacity-100 w-[35%] max-w-[560px] min-w-[240px]` : `translate-x-8 opacity-0 w-[0px]`}`
|
|
54846
|
+
}, activeItem && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
54847
|
+
className: "flex grow-0 shrink-0 gap-2 w-full items-center justify-between"
|
|
54848
|
+
}, /* @__PURE__ */ React__default.createElement("h3", {
|
|
54849
|
+
className: "text-lg text-gray-600 w-full max-w-full break-words block truncate flex-1"
|
|
54850
|
+
}, activeItem.filename), /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
54851
|
+
variant: "ghost",
|
|
54852
|
+
className: "group grow-0 shrink-0",
|
|
54853
|
+
onClick: close
|
|
54854
|
+
}, /* @__PURE__ */ React__default.createElement(BiX, {
|
|
54855
|
+
className: `w-7 h-auto text-gray-500 opacity-50 group-hover:opacity-100 transition duration-150 ease-out`
|
|
54856
|
+
}))), isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("div", {
|
|
54857
|
+
className: "w-full max-h-[75%]"
|
|
54858
|
+
}, /* @__PURE__ */ React__default.createElement("img", {
|
|
54859
|
+
className: "block border border-gray-100 rounded-md overflow-hidden max-w-full max-h-full object-fit h-auto shadow",
|
|
54860
|
+
src: thumbnail,
|
|
54763
54861
|
alt: activeItem.filename
|
|
54764
|
-
}) : /* @__PURE__ */ React__default.createElement("span", {
|
|
54862
|
+
})) : /* @__PURE__ */ React__default.createElement("span", {
|
|
54765
54863
|
className: "p-3 border border-gray-100 rounded-md overflow-hidden bg-gray-50 shadow"
|
|
54766
54864
|
}, /* @__PURE__ */ React__default.createElement(BiFile, {
|
|
54767
54865
|
className: "w-14 h-auto fill-gray-300"
|
|
54768
|
-
})), /* @__PURE__ */ React__default.createElement("
|
|
54769
|
-
className: "
|
|
54770
|
-
},
|
|
54771
|
-
|
|
54866
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54867
|
+
className: "grow h-full w-full shrink flex flex-col gap-3 items-start justify-start"
|
|
54868
|
+
}, /* @__PURE__ */ React__default.createElement(CopyField, {
|
|
54869
|
+
value: absoluteImgURL(activeItem.src),
|
|
54870
|
+
label: "URL"
|
|
54871
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54872
|
+
className: "shrink-0 w-full flex flex-col justify-end items-start"
|
|
54772
54873
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54773
54874
|
className: "flex w-full gap-3"
|
|
54774
54875
|
}, selectMediaItem && /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54778,14 +54879,14 @@ const ActiveItemPreview = ({
|
|
|
54778
54879
|
onClick: () => selectMediaItem(activeItem)
|
|
54779
54880
|
}, "Insert", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54780
54881
|
className: "ml-1 -mr-0.5 w-6 h-auto text-white opacity-70"
|
|
54781
|
-
})), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54882
|
+
})), allowDelete && /* @__PURE__ */ React__default.createElement(Button, {
|
|
54782
54883
|
variant: "white",
|
|
54783
54884
|
size: "medium",
|
|
54784
54885
|
className: "grow max-w-[40%]",
|
|
54785
|
-
onClick:
|
|
54886
|
+
onClick: deleteMediaItem
|
|
54786
54887
|
}, "Delete", /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54787
54888
|
className: "ml-1 -mr-0.5 w-6 h-auto text-red-500 opacity-70"
|
|
54788
|
-
})))));
|
|
54889
|
+
}))))));
|
|
54789
54890
|
};
|
|
54790
54891
|
const UploadButton = ({ onClick, uploading }) => {
|
|
54791
54892
|
return /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54813,9 +54914,9 @@ const MediaPickerWrap = ({ children }) => {
|
|
|
54813
54914
|
};
|
|
54814
54915
|
const EmptyMediaList = (props) => {
|
|
54815
54916
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54816
|
-
className: `text-
|
|
54917
|
+
className: `p-12 text-xl opacity-50 text-center`,
|
|
54817
54918
|
...props
|
|
54818
|
-
}, "Drag and
|
|
54919
|
+
}, "Drag and drop assets here", props.hasTinaMedia && " or click 'Sync' to sync your media to Tina Cloud.");
|
|
54819
54920
|
};
|
|
54820
54921
|
const DocsLink = ({ title, message: message2, docsLink, ...props }) => {
|
|
54821
54922
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -54832,23 +54933,6 @@ const DocsLink = ({ title, message: message2, docsLink, ...props }) => {
|
|
|
54832
54933
|
className: "font-bold text-blue-500 hover:text-blue-600 hover:underline transition-all ease-out duration-150"
|
|
54833
54934
|
}, "Learn More"));
|
|
54834
54935
|
};
|
|
54835
|
-
const SyncModal = ({ close, syncFunc, folder, branch }) => {
|
|
54836
|
-
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54837
|
-
close
|
|
54838
|
-
}, "Sync Media"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54839
|
-
padded: true
|
|
54840
|
-
}, /* @__PURE__ */ React__default.createElement("p", null, `This will copy media assets from the \`${folder}\` folder on branch \`${branch}\` in your git repository to Tina Cloud's asset service. This will allow you to use these assets in your site with Tina Cloud`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54841
|
-
style: { flexGrow: 2 },
|
|
54842
|
-
onClick: close
|
|
54843
|
-
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54844
|
-
style: { flexGrow: 3 },
|
|
54845
|
-
variant: "primary",
|
|
54846
|
-
onClick: async () => {
|
|
54847
|
-
await syncFunc();
|
|
54848
|
-
close();
|
|
54849
|
-
}
|
|
54850
|
-
}, "Sync Media"))));
|
|
54851
|
-
};
|
|
54852
54936
|
createScreen({
|
|
54853
54937
|
name: "Media Manager",
|
|
54854
54938
|
Component: MediaPicker,
|
package/dist/index.js
CHANGED
|
@@ -52898,6 +52898,9 @@
|
|
|
52898
52898
|
function BiCloudUpload(props) {
|
|
52899
52899
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M13 19v-4h3l-4-5-4 5h3v4z" } }, { "tag": "path", "attr": { "d": "M7 19h2v-2H7c-1.654 0-3-1.346-3-3 0-1.404 1.199-2.756 2.673-3.015l.581-.102.192-.558C8.149 8.274 9.895 7 12 7c2.757 0 5 2.243 5 5v1h1c1.103 0 2 .897 2 2s-.897 2-2 2h-3v2h3c2.206 0 4-1.794 4-4a4.01 4.01 0 0 0-3.056-3.888C18.507 7.67 15.56 5 12 5 9.244 5 6.85 6.611 5.757 9.15 3.609 9.792 2 11.82 2 14c0 2.757 2.243 5 5 5z" } }] })(props);
|
|
52900
52900
|
}
|
|
52901
|
+
function BiCopyAlt(props) {
|
|
52902
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z" } }, { "tag": "path", "attr": { "d": "M6 12h6v2H6zm0 4h6v2H6z" } }] })(props);
|
|
52903
|
+
}
|
|
52901
52904
|
function BiFile(props) {
|
|
52902
52905
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19.903 8.586a.997.997 0 0 0-.196-.293l-6-6a.997.997 0 0 0-.293-.196c-.03-.014-.062-.022-.094-.033a.991.991 0 0 0-.259-.051C13.04 2.011 13.021 2 13 2H6c-1.103 0-2 .897-2 2v16c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V9c0-.021-.011-.04-.013-.062a.952.952 0 0 0-.051-.259c-.01-.032-.019-.063-.033-.093zM16.586 8H14V5.414L16.586 8zM6 20V4h6v5a1 1 0 0 0 1 1h5l.002 10H6z" } }, { "tag": "path", "attr": { "d": "M8 12h8v2H8zm0 4h8v2H8zm0-8h2v2H8z" } }] })(props);
|
|
52903
52906
|
}
|
|
@@ -52916,6 +52919,9 @@
|
|
|
52916
52919
|
function BiRightArrowAlt(props) {
|
|
52917
52920
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" } }] })(props);
|
|
52918
52921
|
}
|
|
52922
|
+
function BiX(props) {
|
|
52923
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z" } }] })(props);
|
|
52924
|
+
}
|
|
52919
52925
|
function IoMdSync(props) {
|
|
52920
52926
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 93.09V32l-80 81.454 80 81.456v-61.093c65.996 0 120 54.982 120 122.183 0 20.363-5 39.714-14.004 57.016L391 342.547c15.996-25.457 25-54.988 25-86.547 0-89.599-72.002-162.91-160-162.91zm0 285.094c-66.001 0-120-54.988-120-122.184 0-20.363 5-39.709 13.999-57.02L121 169.454C104.999 193.89 96 224.436 96 256c0 89.599 72.002 162.91 160 162.91V480l80-81.453-80-81.457v61.094z" } }] })(props);
|
|
52921
52927
|
}
|
|
@@ -52966,7 +52972,12 @@
|
|
|
52966
52972
|
return Object.assign({}, ...(str || DEFAULT_MEDIA_UPLOAD_TYPES).split(",").map((x2) => ({ [x2]: [] })));
|
|
52967
52973
|
};
|
|
52968
52974
|
const isImage = (filename) => {
|
|
52969
|
-
return /\.(gif|jpg|jpeg|tiff|png|svg|webp)
|
|
52975
|
+
return /\.(gif|jpg|jpeg|tiff|png|svg|webp)(\?.*)?$/i.test(filename);
|
|
52976
|
+
};
|
|
52977
|
+
const absoluteImgURL = (str) => {
|
|
52978
|
+
if (str.startsWith("http"))
|
|
52979
|
+
return str;
|
|
52980
|
+
return `${window.location.origin}${str}`;
|
|
52970
52981
|
};
|
|
52971
52982
|
const onKeyDownSoftBreak = (editor, { options: { rules = [] } }) => (event) => {
|
|
52972
52983
|
const entry = getBlockAbove(editor);
|
|
@@ -54376,50 +54387,37 @@
|
|
|
54376
54387
|
className: "w-6 h-full ml-2 opacity-70"
|
|
54377
54388
|
})));
|
|
54378
54389
|
}
|
|
54379
|
-
function ListMediaItem({
|
|
54380
|
-
item,
|
|
54381
|
-
onClick,
|
|
54382
|
-
onSelect,
|
|
54383
|
-
onDelete
|
|
54384
|
-
}) {
|
|
54390
|
+
function ListMediaItem({ item, onClick, active: active2 }) {
|
|
54385
54391
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54392
|
+
const thumbnail = item.thumbnails["75x75"];
|
|
54386
54393
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54387
|
-
className:
|
|
54388
|
-
onClick: () =>
|
|
54394
|
+
className: `flex shrink-0 gap-3 items-center py-2 pl-2 pr-3 transition duration-150 ease-out cursor-pointer border-b border-gray-150 ${active2 ? "bg-gradient-to-r from-white to-gray-50/50 text-blue-500 hover:bg-gray-50" : "bg-white hover:bg-gray-50/50"}`,
|
|
54395
|
+
onClick: () => {
|
|
54396
|
+
if (!active2) {
|
|
54397
|
+
onClick(item);
|
|
54398
|
+
} else {
|
|
54399
|
+
onClick(false);
|
|
54400
|
+
}
|
|
54401
|
+
}
|
|
54389
54402
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54390
54403
|
className: "w-20 h-20 bg-gray-50 shadow border border-gray-100 rounded overflow-hidden flex justify-center flex-shrink-0"
|
|
54391
|
-
}, isImage(
|
|
54404
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54392
54405
|
className: "object-cover w-full h-full object-center",
|
|
54393
|
-
src:
|
|
54406
|
+
src: thumbnail,
|
|
54394
54407
|
alt: item.filename
|
|
54395
54408
|
}) : /* @__PURE__ */ React__default.createElement(FileIcon, {
|
|
54396
54409
|
className: "w-3/5 h-full fill-gray-300"
|
|
54397
|
-
})), /* @__PURE__ */ React__default.createElement(
|
|
54398
|
-
className: "
|
|
54399
|
-
},
|
|
54400
|
-
size: "medium",
|
|
54401
|
-
variant: "white",
|
|
54402
|
-
onClick: () => onSelect(item)
|
|
54403
|
-
}, "Insert", " ", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54404
|
-
className: "ml-1 -mr-0.5 w-6 h-auto text-blue-500 opacity-70"
|
|
54405
|
-
})), onDelete && item.type === "file" && /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
54406
|
-
variant: "ghost",
|
|
54407
|
-
size: "medium",
|
|
54408
|
-
onClick: () => onDelete(item)
|
|
54409
|
-
}, /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54410
|
-
className: "w-6 h-auto"
|
|
54411
|
-
}))));
|
|
54410
|
+
})), /* @__PURE__ */ React__default.createElement("span", {
|
|
54411
|
+
className: "text-base flex-grow w-full break-words truncate"
|
|
54412
|
+
}, item.filename));
|
|
54412
54413
|
}
|
|
54413
|
-
const Filename = ({ className = "", ...props }) => /* @__PURE__ */ React__default.createElement("span", {
|
|
54414
|
-
className: "text-base flex-grow w-full break-words truncate " + className,
|
|
54415
|
-
...props
|
|
54416
|
-
});
|
|
54417
54414
|
function GridMediaItem({ item, active: active2, onClick }) {
|
|
54418
54415
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54416
|
+
const thumbnail = item.thumbnails["400x400"];
|
|
54419
54417
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54420
|
-
className: `relative pb-[100%] h-0 block
|
|
54418
|
+
className: `relative pb-[100%] h-0 block border border-gray-100 rounded-md overflow-hidden flex justify-center shrink-0 w-full transition duration-150 ease-out ${active2 ? "shadow-outline" : "shadow hover:shadow-md hover:scale-103 hover:border-gray-150"} ${item.type === "dir" ? "cursor-pointer" : ""}`
|
|
54421
54419
|
}, /* @__PURE__ */ React__default.createElement("button", {
|
|
54422
|
-
className: "absolute w-full h-full flex items-center justify-center bg-
|
|
54420
|
+
className: "absolute w-full h-full flex items-center justify-center bg-white",
|
|
54423
54421
|
onClick: () => {
|
|
54424
54422
|
if (!active2) {
|
|
54425
54423
|
onClick(item);
|
|
@@ -54427,9 +54425,9 @@
|
|
|
54427
54425
|
onClick(false);
|
|
54428
54426
|
}
|
|
54429
54427
|
}
|
|
54430
|
-
}, isImage(
|
|
54428
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54431
54429
|
className: "object-cover w-full h-full object-center",
|
|
54432
|
-
src:
|
|
54430
|
+
src: thumbnail,
|
|
54433
54431
|
alt: item.filename
|
|
54434
54432
|
}) : /* @__PURE__ */ React__default.createElement("div", {
|
|
54435
54433
|
className: "p-4 w-full flex flex-col gap-4 items-center justify-center"
|
|
@@ -54476,6 +54474,74 @@
|
|
|
54476
54474
|
}, part);
|
|
54477
54475
|
}));
|
|
54478
54476
|
}
|
|
54477
|
+
const DeleteModal = ({
|
|
54478
|
+
close,
|
|
54479
|
+
deleteFunc,
|
|
54480
|
+
filename
|
|
54481
|
+
}) => {
|
|
54482
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54483
|
+
close
|
|
54484
|
+
}, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54485
|
+
padded: true
|
|
54486
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, "Are you sure you want to delete ", /* @__PURE__ */ React__default.createElement("strong", null, filename), "?")), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54487
|
+
style: { flexGrow: 2 },
|
|
54488
|
+
onClick: close
|
|
54489
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54490
|
+
style: { flexGrow: 3 },
|
|
54491
|
+
variant: "danger",
|
|
54492
|
+
onClick: () => {
|
|
54493
|
+
deleteFunc();
|
|
54494
|
+
close();
|
|
54495
|
+
}
|
|
54496
|
+
}, "Delete"))));
|
|
54497
|
+
};
|
|
54498
|
+
const SyncModal = ({ close, syncFunc, folder, branch }) => {
|
|
54499
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54500
|
+
close
|
|
54501
|
+
}, "Sync Media"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54502
|
+
padded: true
|
|
54503
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, `This will copy media assets from the \`${folder}\` folder on branch \`${branch}\` in your git repository to Tina Cloud's asset service. This will allow you to use these assets in your site with Tina Cloud`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54504
|
+
style: { flexGrow: 2 },
|
|
54505
|
+
onClick: close
|
|
54506
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54507
|
+
style: { flexGrow: 3 },
|
|
54508
|
+
variant: "primary",
|
|
54509
|
+
onClick: async () => {
|
|
54510
|
+
await syncFunc();
|
|
54511
|
+
close();
|
|
54512
|
+
}
|
|
54513
|
+
}, "Sync Media"))));
|
|
54514
|
+
};
|
|
54515
|
+
const CopyField = ({ label, description, value }) => {
|
|
54516
|
+
const [copied, setCopied] = React__default.useState(false);
|
|
54517
|
+
const [fadeOut, setFadeOut] = React__default.useState(false);
|
|
54518
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54519
|
+
className: "w-full"
|
|
54520
|
+
}, label && /* @__PURE__ */ React__default.createElement("label", {
|
|
54521
|
+
className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700"
|
|
54522
|
+
}, label), /* @__PURE__ */ React__default.createElement("span", {
|
|
54523
|
+
onClick: () => {
|
|
54524
|
+
if (copied === true)
|
|
54525
|
+
return;
|
|
54526
|
+
setCopied(true);
|
|
54527
|
+
setTimeout(() => {
|
|
54528
|
+
setFadeOut(true);
|
|
54529
|
+
}, 2500);
|
|
54530
|
+
setTimeout(() => {
|
|
54531
|
+
setCopied(false);
|
|
54532
|
+
setFadeOut(false);
|
|
54533
|
+
}, 3e3);
|
|
54534
|
+
navigator.clipboard.writeText(value);
|
|
54535
|
+
},
|
|
54536
|
+
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
54537
|
+
}, /* @__PURE__ */ React__default.createElement(BiCopyAlt, {
|
|
54538
|
+
className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20"
|
|
54539
|
+
}), " ", value, " ", copied && /* @__PURE__ */ React__default.createElement("span", {
|
|
54540
|
+
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
54541
|
+
}, /* @__PURE__ */ React__default.createElement("span", null, "Copied to clipboard!"))), description && /* @__PURE__ */ React__default.createElement("p", {
|
|
54542
|
+
className: "mt-2 text-sm text-gray-500"
|
|
54543
|
+
}, description));
|
|
54544
|
+
};
|
|
54479
54545
|
async function poll(fn2, timeout, interval) {
|
|
54480
54546
|
const endTime = Number(new Date()) + (timeout || 2e3);
|
|
54481
54547
|
interval = interval || 100;
|
|
@@ -54524,6 +54590,7 @@
|
|
|
54524
54590
|
return "loading";
|
|
54525
54591
|
return "not-configured";
|
|
54526
54592
|
});
|
|
54593
|
+
const [deleteModalOpen, setDeleteModalOpen] = React__default.useState(false);
|
|
54527
54594
|
const [listError, setListError] = react.exports.useState(defaultListError);
|
|
54528
54595
|
const [directory, setDirectory] = react.exports.useState(props.directory);
|
|
54529
54596
|
const [list2, setList] = react.exports.useState({
|
|
@@ -54533,6 +54600,7 @@
|
|
|
54533
54600
|
const [showSync, setShowSync] = react.exports.useState(false);
|
|
54534
54601
|
const [viewMode, setViewMode] = react.exports.useState("grid");
|
|
54535
54602
|
const [activeItem, setActiveItem] = react.exports.useState(false);
|
|
54603
|
+
const closePreview = () => setActiveItem(false);
|
|
54536
54604
|
const [offsetHistory, setOffsetHistory] = react.exports.useState([]);
|
|
54537
54605
|
const [loadingText, setLoadingText] = react.exports.useState("");
|
|
54538
54606
|
const offset2 = offsetHistory[offsetHistory.length - 1];
|
|
@@ -54554,7 +54622,16 @@
|
|
|
54554
54622
|
const branch = (_m = cms.api.tina) == null ? void 0 : _m.branch;
|
|
54555
54623
|
function loadMedia() {
|
|
54556
54624
|
setListState("loading");
|
|
54557
|
-
cms.media.list({
|
|
54625
|
+
cms.media.list({
|
|
54626
|
+
offset: offset2,
|
|
54627
|
+
limit: cms.media.pageSize,
|
|
54628
|
+
directory,
|
|
54629
|
+
thumbnailSizes: [
|
|
54630
|
+
{ w: 75, h: 75 },
|
|
54631
|
+
{ w: 400, h: 400 },
|
|
54632
|
+
{ w: 1e3, h: 1e3 }
|
|
54633
|
+
]
|
|
54634
|
+
}).then((list22) => {
|
|
54558
54635
|
setList(list22);
|
|
54559
54636
|
setListState("loaded");
|
|
54560
54637
|
}).catch((e2) => {
|
|
@@ -54574,12 +54651,6 @@
|
|
|
54574
54651
|
return cms.events.subscribe(["media:upload:success", "media:delete:success", "media:pageSize"], loadMedia);
|
|
54575
54652
|
}, [offset2, directory, cms.media.isConfigured]);
|
|
54576
54653
|
const onClickMediaItem = (item) => {
|
|
54577
|
-
if (item.type === "dir") {
|
|
54578
|
-
setDirectory(item.directory === "." || item.directory === "" ? item.filename : join(item.directory, item.filename));
|
|
54579
|
-
resetOffset();
|
|
54580
|
-
}
|
|
54581
|
-
};
|
|
54582
|
-
const onClickGridMediaItem = (item) => {
|
|
54583
54654
|
if (!item) {
|
|
54584
54655
|
setActiveItem(false);
|
|
54585
54656
|
} else if (item.type === "dir") {
|
|
@@ -54592,9 +54663,7 @@
|
|
|
54592
54663
|
let deleteMediaItem;
|
|
54593
54664
|
if (allowDelete) {
|
|
54594
54665
|
deleteMediaItem = (item) => {
|
|
54595
|
-
|
|
54596
|
-
cms.media.delete(item);
|
|
54597
|
-
}
|
|
54666
|
+
cms.media.delete(item);
|
|
54598
54667
|
};
|
|
54599
54668
|
}
|
|
54600
54669
|
let selectMediaItem;
|
|
@@ -54682,7 +54751,16 @@
|
|
|
54682
54751
|
docsLink
|
|
54683
54752
|
});
|
|
54684
54753
|
}
|
|
54685
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null,
|
|
54754
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, deleteModalOpen && /* @__PURE__ */ React__default.createElement(DeleteModal, {
|
|
54755
|
+
filename: activeItem ? activeItem.filename : "",
|
|
54756
|
+
deleteFunc: () => {
|
|
54757
|
+
if (activeItem) {
|
|
54758
|
+
deleteMediaItem(activeItem);
|
|
54759
|
+
setActiveItem(false);
|
|
54760
|
+
}
|
|
54761
|
+
},
|
|
54762
|
+
close: () => setDeleteModalOpen(false)
|
|
54763
|
+
}), /* @__PURE__ */ React__default.createElement(MediaPickerWrap, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
54686
54764
|
className: "flex items-center bg-gray-50 border-b border-gray-150 gap-x-4 py-3 px-5 shadow-sm flex-shrink-0"
|
|
54687
54765
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54688
54766
|
className: `grow-0 flex divide-x divide-gray-150 shadow-inner bg-gray-50 border border-gray-150 justify-between rounded-md`
|
|
@@ -54715,10 +54793,12 @@
|
|
|
54715
54793
|
onClick,
|
|
54716
54794
|
uploading
|
|
54717
54795
|
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54718
|
-
className: "flex h-full overflow-hidden"
|
|
54796
|
+
className: "flex h-full overflow-hidden bg-white"
|
|
54797
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54798
|
+
className: "flex w-full flex-col h-full @container"
|
|
54719
54799
|
}, /* @__PURE__ */ React__default.createElement("ul", {
|
|
54720
54800
|
...rootProps,
|
|
54721
|
-
className: `h-full
|
|
54801
|
+
className: `h-full grow overflow-y-auto transition duration-150 ease-out bg-gradient-to-b from-gray-50/50 to-gray-50 ${list2.items.length === 0 || viewMode === "list" && "w-full flex flex-1 flex-col justify-start -mb-px"} ${list2.items.length > 0 && viewMode === "grid" && "w-full p-4 gap-4 grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 @2xl:grid-cols-4 @4xl:grid-cols-6 @6xl:grid-cols-8 auto-rows-auto content-start justify-start"} ${isDragActive ? `border-2 border-blue-500 rounded-lg` : ``}`
|
|
54722
54802
|
}, /* @__PURE__ */ React__default.createElement("input", {
|
|
54723
54803
|
...getInputProps()
|
|
54724
54804
|
}), listState === "loaded" && list2.items.length === 0 && /* @__PURE__ */ React__default.createElement(EmptyMediaList, {
|
|
@@ -54727,24 +54807,27 @@
|
|
|
54727
54807
|
key: item.id,
|
|
54728
54808
|
item,
|
|
54729
54809
|
onClick: onClickMediaItem,
|
|
54730
|
-
|
|
54731
|
-
onDelete: deleteMediaItem
|
|
54810
|
+
active: activeItem && activeItem.id === item.id
|
|
54732
54811
|
})), viewMode === "grid" && list2.items.map((item) => /* @__PURE__ */ React__default.createElement(GridMediaItem, {
|
|
54733
54812
|
key: item.id,
|
|
54734
54813
|
item,
|
|
54735
|
-
onClick:
|
|
54814
|
+
onClick: onClickMediaItem,
|
|
54736
54815
|
active: activeItem && activeItem.id === item.id
|
|
54737
|
-
}))),
|
|
54738
|
-
|
|
54739
|
-
selectMediaItem,
|
|
54740
|
-
deleteMediaItem
|
|
54741
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54742
|
-
className: "bg-gray-50 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
54816
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
54817
|
+
className: "bg-gradient-to-r to-gray-50/50 from-gray-50 shrink-0 grow-0 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
54743
54818
|
}, /* @__PURE__ */ React__default.createElement(CursorPaginator, {
|
|
54744
54819
|
hasNext,
|
|
54745
54820
|
navigateNext,
|
|
54746
54821
|
hasPrev,
|
|
54747
54822
|
navigatePrev
|
|
54823
|
+
}))), /* @__PURE__ */ React__default.createElement(ActiveItemPreview, {
|
|
54824
|
+
activeItem,
|
|
54825
|
+
close: closePreview,
|
|
54826
|
+
selectMediaItem,
|
|
54827
|
+
allowDelete,
|
|
54828
|
+
deleteMediaItem: () => {
|
|
54829
|
+
setDeleteModalOpen(true);
|
|
54830
|
+
}
|
|
54748
54831
|
}))), showSync && /* @__PURE__ */ React__default.createElement(SyncModal, {
|
|
54749
54832
|
folder,
|
|
54750
54833
|
branch,
|
|
@@ -54756,23 +54839,41 @@
|
|
|
54756
54839
|
}
|
|
54757
54840
|
const ActiveItemPreview = ({
|
|
54758
54841
|
activeItem,
|
|
54842
|
+
close,
|
|
54759
54843
|
selectMediaItem,
|
|
54760
|
-
deleteMediaItem
|
|
54844
|
+
deleteMediaItem,
|
|
54845
|
+
allowDelete
|
|
54761
54846
|
}) => {
|
|
54847
|
+
const thumbnail = activeItem ? activeItem.thumbnails["1000x1000"] : "";
|
|
54762
54848
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54763
|
-
className:
|
|
54764
|
-
},
|
|
54765
|
-
className: "
|
|
54766
|
-
|
|
54849
|
+
className: `shrink-0 h-full flex flex-col items-start gap-3 overflow-y-auto bg-white border-l border-gray-100 bg-white shadow-md transition ease-out duration-150 ${activeItem ? `p-4 opacity-100 w-[35%] max-w-[560px] min-w-[240px]` : `translate-x-8 opacity-0 w-[0px]`}`
|
|
54850
|
+
}, activeItem && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
54851
|
+
className: "flex grow-0 shrink-0 gap-2 w-full items-center justify-between"
|
|
54852
|
+
}, /* @__PURE__ */ React__default.createElement("h3", {
|
|
54853
|
+
className: "text-lg text-gray-600 w-full max-w-full break-words block truncate flex-1"
|
|
54854
|
+
}, activeItem.filename), /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
54855
|
+
variant: "ghost",
|
|
54856
|
+
className: "group grow-0 shrink-0",
|
|
54857
|
+
onClick: close
|
|
54858
|
+
}, /* @__PURE__ */ React__default.createElement(BiX, {
|
|
54859
|
+
className: `w-7 h-auto text-gray-500 opacity-50 group-hover:opacity-100 transition duration-150 ease-out`
|
|
54860
|
+
}))), isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("div", {
|
|
54861
|
+
className: "w-full max-h-[75%]"
|
|
54862
|
+
}, /* @__PURE__ */ React__default.createElement("img", {
|
|
54863
|
+
className: "block border border-gray-100 rounded-md overflow-hidden max-w-full max-h-full object-fit h-auto shadow",
|
|
54864
|
+
src: thumbnail,
|
|
54767
54865
|
alt: activeItem.filename
|
|
54768
|
-
}) : /* @__PURE__ */ React__default.createElement("span", {
|
|
54866
|
+
})) : /* @__PURE__ */ React__default.createElement("span", {
|
|
54769
54867
|
className: "p-3 border border-gray-100 rounded-md overflow-hidden bg-gray-50 shadow"
|
|
54770
54868
|
}, /* @__PURE__ */ React__default.createElement(BiFile, {
|
|
54771
54869
|
className: "w-14 h-auto fill-gray-300"
|
|
54772
|
-
})), /* @__PURE__ */ React__default.createElement("
|
|
54773
|
-
className: "
|
|
54774
|
-
},
|
|
54775
|
-
|
|
54870
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54871
|
+
className: "grow h-full w-full shrink flex flex-col gap-3 items-start justify-start"
|
|
54872
|
+
}, /* @__PURE__ */ React__default.createElement(CopyField, {
|
|
54873
|
+
value: absoluteImgURL(activeItem.src),
|
|
54874
|
+
label: "URL"
|
|
54875
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54876
|
+
className: "shrink-0 w-full flex flex-col justify-end items-start"
|
|
54776
54877
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54777
54878
|
className: "flex w-full gap-3"
|
|
54778
54879
|
}, selectMediaItem && /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54782,14 +54883,14 @@
|
|
|
54782
54883
|
onClick: () => selectMediaItem(activeItem)
|
|
54783
54884
|
}, "Insert", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54784
54885
|
className: "ml-1 -mr-0.5 w-6 h-auto text-white opacity-70"
|
|
54785
|
-
})), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54886
|
+
})), allowDelete && /* @__PURE__ */ React__default.createElement(Button, {
|
|
54786
54887
|
variant: "white",
|
|
54787
54888
|
size: "medium",
|
|
54788
54889
|
className: "grow max-w-[40%]",
|
|
54789
|
-
onClick:
|
|
54890
|
+
onClick: deleteMediaItem
|
|
54790
54891
|
}, "Delete", /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54791
54892
|
className: "ml-1 -mr-0.5 w-6 h-auto text-red-500 opacity-70"
|
|
54792
|
-
})))));
|
|
54893
|
+
}))))));
|
|
54793
54894
|
};
|
|
54794
54895
|
const UploadButton = ({ onClick, uploading }) => {
|
|
54795
54896
|
return /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54817,9 +54918,9 @@
|
|
|
54817
54918
|
};
|
|
54818
54919
|
const EmptyMediaList = (props) => {
|
|
54819
54920
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54820
|
-
className: `text-
|
|
54921
|
+
className: `p-12 text-xl opacity-50 text-center`,
|
|
54821
54922
|
...props
|
|
54822
|
-
}, "Drag and
|
|
54923
|
+
}, "Drag and drop assets here", props.hasTinaMedia && " or click 'Sync' to sync your media to Tina Cloud.");
|
|
54823
54924
|
};
|
|
54824
54925
|
const DocsLink = ({ title, message: message2, docsLink, ...props }) => {
|
|
54825
54926
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -54836,23 +54937,6 @@
|
|
|
54836
54937
|
className: "font-bold text-blue-500 hover:text-blue-600 hover:underline transition-all ease-out duration-150"
|
|
54837
54938
|
}, "Learn More"));
|
|
54838
54939
|
};
|
|
54839
|
-
const SyncModal = ({ close, syncFunc, folder, branch }) => {
|
|
54840
|
-
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54841
|
-
close
|
|
54842
|
-
}, "Sync Media"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54843
|
-
padded: true
|
|
54844
|
-
}, /* @__PURE__ */ React__default.createElement("p", null, `This will copy media assets from the \`${folder}\` folder on branch \`${branch}\` in your git repository to Tina Cloud's asset service. This will allow you to use these assets in your site with Tina Cloud`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54845
|
-
style: { flexGrow: 2 },
|
|
54846
|
-
onClick: close
|
|
54847
|
-
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54848
|
-
style: { flexGrow: 3 },
|
|
54849
|
-
variant: "primary",
|
|
54850
|
-
onClick: async () => {
|
|
54851
|
-
await syncFunc();
|
|
54852
|
-
close();
|
|
54853
|
-
}
|
|
54854
|
-
}, "Sync Media"))));
|
|
54855
|
-
};
|
|
54856
54940
|
createScreen({
|
|
54857
54941
|
name: "Media Manager",
|
|
54858
54942
|
Component: MediaPicker,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-tinacms-dos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"multer": "1.4.5-lts.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tinacms/toolkit": "1.
|
|
25
|
-
"@tinacms/scripts": "1.0.
|
|
24
|
+
"@tinacms/toolkit": "1.5.0",
|
|
25
|
+
"@tinacms/scripts": "1.0.4",
|
|
26
26
|
"@types/crypto-js": "^3.1.47",
|
|
27
27
|
"@types/js-cookie": "^2.2.6",
|
|
28
28
|
"@types/node": "^13.13.1",
|
|
29
29
|
"next": "12.2.4",
|
|
30
|
-
"tinacms": "1.3.
|
|
30
|
+
"tinacms": "1.3.1",
|
|
31
31
|
"typescript": "4.3.5"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|