@blocklet/discuss-kit 1.0.23 → 1.0.25
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/lib/cjs/comments.js +1 -3
- package/lib/cjs/index.js +0 -6
- package/lib/es/comments.js +1 -2
- package/lib/es/index.js +1 -3
- package/package.json +3 -3
- package/lib/cjs/components/upload-provider.js +0 -19
- package/lib/cjs/components/uploader.css +0 -1287
- package/lib/cjs/components/uploader.js +0 -41
- package/lib/es/components/upload-provider.js +0 -20
- package/lib/es/components/uploader.css +0 -1287
- package/lib/es/components/uploader.js +0 -39
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const joinUrl = require("url-join");
|
|
4
|
-
const uppload$1 = require("uppload");
|
|
5
|
-
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
6
|
-
const joinUrl__default = /* @__PURE__ */ _interopDefaultLegacy(joinUrl);
|
|
7
|
-
const uppload = "";
|
|
8
|
-
const light = "";
|
|
9
|
-
const getEndpoint = () => {
|
|
10
|
-
const obj = new window.URL(window.location.origin);
|
|
11
|
-
obj.pathname = joinUrl__default.default(window.blocklet.prefix, "/api/uploads");
|
|
12
|
-
return obj.href;
|
|
13
|
-
};
|
|
14
|
-
const upload = uppload$1.xhrUploader({
|
|
15
|
-
endpoint: getEndpoint(),
|
|
16
|
-
fileKeyName: "image",
|
|
17
|
-
responseFunction: (text) => {
|
|
18
|
-
try {
|
|
19
|
-
const json = JSON.parse(text);
|
|
20
|
-
return json.url;
|
|
21
|
-
} catch (error) {
|
|
22
|
-
return Promise.reject(error);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const uploader = new uppload$1.Uppload({
|
|
27
|
-
lang: uppload$1.en,
|
|
28
|
-
defaultService: "local",
|
|
29
|
-
maxWidth: 1440,
|
|
30
|
-
maxHeight: 900,
|
|
31
|
-
uploader: uppload$1.xhrUploader({
|
|
32
|
-
endpoint: getEndpoint(),
|
|
33
|
-
fileKeyName: "image"
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
uploader.use([new uppload$1.Local({
|
|
37
|
-
mimeTypes: ["image/png", "image/jpeg", "image/gif"]
|
|
38
|
-
}), new uppload$1.Camera(), new uppload$1.Screenshot(), new uppload$1.URL(), new uppload$1.Twitter(), new uppload$1.Facebook()]);
|
|
39
|
-
uploader.use([new uppload$1.Preview(), new uppload$1.Rotate(), new uppload$1.Crop(), new uppload$1.Blur(), new uppload$1.Contrast(), new uppload$1.Grayscale(), new uppload$1.Saturate()]);
|
|
40
|
-
exports.default = uploader;
|
|
41
|
-
exports.upload = upload;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { EditorConfigProvider } from "@blocklet/editor";
|
|
3
|
-
import { upload } from "./uploader";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
function UploadProvider(props) {
|
|
6
|
-
const config = useMemo(() => ({
|
|
7
|
-
uploader: {
|
|
8
|
-
upload: (file) => upload(file).then((url) => ({
|
|
9
|
-
url
|
|
10
|
-
}))
|
|
11
|
-
}
|
|
12
|
-
}), []);
|
|
13
|
-
return /* @__PURE__ */ jsx(EditorConfigProvider, {
|
|
14
|
-
value: config,
|
|
15
|
-
...props
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
UploadProvider as default
|
|
20
|
-
};
|