@m11s-io/decap-cms-media-library-s3 0.1.2 → 0.1.4
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.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.global.js +5 -5
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface Config {
|
|
2
2
|
upload_url?: string;
|
|
3
3
|
}
|
|
4
4
|
interface InitArgs {
|
|
5
|
-
|
|
5
|
+
config?: Config;
|
|
6
6
|
handleInsert: (url: string) => void;
|
|
7
7
|
}
|
|
8
8
|
interface Instance {
|
|
@@ -16,7 +16,7 @@ interface Instance {
|
|
|
16
16
|
}
|
|
17
17
|
declare const S3MediaLibrary: {
|
|
18
18
|
name: string;
|
|
19
|
-
init({
|
|
19
|
+
init({ config, handleInsert }: InitArgs): Instance;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export { S3MediaLibrary as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface Config {
|
|
2
2
|
upload_url?: string;
|
|
3
3
|
}
|
|
4
4
|
interface InitArgs {
|
|
5
|
-
|
|
5
|
+
config?: Config;
|
|
6
6
|
handleInsert: (url: string) => void;
|
|
7
7
|
}
|
|
8
8
|
interface Instance {
|
|
@@ -16,7 +16,7 @@ interface Instance {
|
|
|
16
16
|
}
|
|
17
17
|
declare const S3MediaLibrary: {
|
|
18
18
|
name: string;
|
|
19
|
-
init({
|
|
19
|
+
init({ config, handleInsert }: InitArgs): Instance;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export { S3MediaLibrary as default };
|
package/dist/index.global.js
CHANGED
|
@@ -25,16 +25,16 @@ var S3MediaLibrary = (() => {
|
|
|
25
25
|
});
|
|
26
26
|
var S3MediaLibrary = {
|
|
27
27
|
name: "s3",
|
|
28
|
-
init({
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
init({ config = {}, handleInsert }) {
|
|
29
|
+
const uploadUrl = config.upload_url;
|
|
30
|
+
if (!uploadUrl) throw new Error("decap-cms-media-library-s3: upload_url is required in media_library.config");
|
|
31
31
|
const input = document.createElement("input");
|
|
32
32
|
input.type = "file";
|
|
33
33
|
input.style.display = "none";
|
|
34
34
|
document.body.appendChild(input);
|
|
35
35
|
input.addEventListener("change", async () => {
|
|
36
|
-
var
|
|
37
|
-
const file = (
|
|
36
|
+
var _a;
|
|
37
|
+
const file = (_a = input.files) == null ? void 0 : _a[0];
|
|
38
38
|
if (!file) return;
|
|
39
39
|
const formData = new FormData();
|
|
40
40
|
formData.append("file", file);
|
package/dist/index.js
CHANGED
|
@@ -25,16 +25,16 @@ __export(index_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
var S3MediaLibrary = {
|
|
27
27
|
name: "s3",
|
|
28
|
-
init({
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
init({ config = {}, handleInsert }) {
|
|
29
|
+
const uploadUrl = config.upload_url;
|
|
30
|
+
if (!uploadUrl) throw new Error("decap-cms-media-library-s3: upload_url is required in media_library.config");
|
|
31
31
|
const input = document.createElement("input");
|
|
32
32
|
input.type = "file";
|
|
33
33
|
input.style.display = "none";
|
|
34
34
|
document.body.appendChild(input);
|
|
35
35
|
input.addEventListener("change", async () => {
|
|
36
|
-
var
|
|
37
|
-
const file = (
|
|
36
|
+
var _a;
|
|
37
|
+
const file = (_a = input.files) == null ? void 0 : _a[0];
|
|
38
38
|
if (!file) return;
|
|
39
39
|
const formData = new FormData();
|
|
40
40
|
formData.append("file", file);
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var S3MediaLibrary = {
|
|
3
3
|
name: "s3",
|
|
4
|
-
init({
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
init({ config = {}, handleInsert }) {
|
|
5
|
+
const uploadUrl = config.upload_url;
|
|
6
|
+
if (!uploadUrl) throw new Error("decap-cms-media-library-s3: upload_url is required in media_library.config");
|
|
7
7
|
const input = document.createElement("input");
|
|
8
8
|
input.type = "file";
|
|
9
9
|
input.style.display = "none";
|
|
10
10
|
document.body.appendChild(input);
|
|
11
11
|
input.addEventListener("change", async () => {
|
|
12
|
-
var
|
|
13
|
-
const file = (
|
|
12
|
+
var _a;
|
|
13
|
+
const file = (_a = input.files) == null ? void 0 : _a[0];
|
|
14
14
|
if (!file) return;
|
|
15
15
|
const formData = new FormData();
|
|
16
16
|
formData.append("file", file);
|