@blocklet/discuss-kit 1.0.13 → 1.0.14

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.
@@ -1,16 +1,18 @@
1
1
  "use strict";
2
+ const react = require("react");
2
3
  const editor = require("@blocklet/editor");
3
4
  const uploader = require("./uploader");
4
5
  const jsxRuntime = require("react/jsx-runtime");
5
6
  function UploadProvider(props) {
7
+ const config = react.useMemo(() => ({
8
+ uploader: {
9
+ upload: (file) => uploader.upload(file).then((url) => ({
10
+ url
11
+ }))
12
+ }
13
+ }), []);
6
14
  return /* @__PURE__ */ jsxRuntime.jsx(editor.EditorConfigProvider, {
7
- value: {
8
- uploader: {
9
- upload: (file) => uploader.upload(file).then((url) => ({
10
- url
11
- }))
12
- }
13
- },
15
+ value: config,
14
16
  ...props
15
17
  });
16
18
  }
@@ -1,15 +1,17 @@
1
+ import { useMemo } from "react";
1
2
  import { EditorConfigProvider } from "@blocklet/editor";
2
3
  import { upload } from "./uploader";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  function UploadProvider(props) {
6
+ const config = useMemo(() => ({
7
+ uploader: {
8
+ upload: (file) => upload(file).then((url) => ({
9
+ url
10
+ }))
11
+ }
12
+ }), []);
5
13
  return /* @__PURE__ */ jsx(EditorConfigProvider, {
6
- value: {
7
- uploader: {
8
- upload: (file) => upload(file).then((url) => ({
9
- url
10
- }))
11
- }
12
- },
14
+ value: config,
13
15
  ...props
14
16
  });
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "A react component for Discuss Kit blocklet.",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/es/index.js",
@@ -37,7 +37,7 @@
37
37
  "@arcblock/did-connect": "^2.4.57",
38
38
  "@arcblock/ux": "^2.4.57",
39
39
  "@arcblock/ws": "^1.18.30",
40
- "@blocklet/discuss-kit-ux": "1.0.13",
40
+ "@blocklet/discuss-kit-ux": "1.0.14",
41
41
  "@blocklet/editor": "^0.0.10",
42
42
  "@emotion/react": "^11.10.5",
43
43
  "@emotion/styled": "^11.10.5",
@@ -77,5 +77,5 @@
77
77
  "vite-plugin-build": "^0.6.0",
78
78
  "vite-plugin-svgr": "^2.2.2"
79
79
  },
80
- "gitHead": "c197cdf796a17b66fd6c031ca86d39c6efe7c710"
80
+ "gitHead": "2e344280e1268a0b26500ff576cb6916447a0699"
81
81
  }