@arcblock/ux 2.8.14 → 2.8.15
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,6 @@
|
|
1
1
|
import React, { useRef, useState, forwardRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import '@fontsource/ubuntu-mono/400.css';
|
4
|
-
import useMountedState from 'react-use/lib/useMountedState';
|
5
4
|
import Tooltip from '@mui/material/Tooltip';
|
6
5
|
import { green } from '@mui/material/colors';
|
7
6
|
import copy from 'copy-to-clipboard';
|
@@ -55,9 +54,6 @@ const DidAddress = /*#__PURE__*/forwardRef(({
|
|
55
54
|
// eslint-disable-next-line no-param-reassign
|
56
55
|
locale = 'en';
|
57
56
|
}
|
58
|
-
|
59
|
-
// 避免 unmounted 后 setTimeout handler 依然改变 state
|
60
|
-
const isMounted = useMountedState();
|
61
57
|
const [copied, setCopied] = useState(false);
|
62
58
|
const textRef = useRef();
|
63
59
|
const onCopy = e => {
|
@@ -67,9 +63,7 @@ const DidAddress = /*#__PURE__*/forwardRef(({
|
|
67
63
|
setCopied(true);
|
68
64
|
// 恢复 copied 状态
|
69
65
|
setTimeout(() => {
|
70
|
-
|
71
|
-
setCopied(false);
|
72
|
-
}
|
66
|
+
setCopied(false);
|
73
67
|
}, 1500);
|
74
68
|
};
|
75
69
|
let copyElement = null;
|
package/es/CodeBlock/index.js
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
import { useState } from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import Copy from 'copy-to-clipboard';
|
5
|
-
import useMountedState from 'react-use/lib/useMountedState';
|
6
5
|
import hljs from 'highlight.js/lib/core';
|
7
6
|
import javascript from 'highlight.js/lib/languages/javascript';
|
8
7
|
import typescript from 'highlight.js/lib/languages/typescript';
|
@@ -63,7 +62,6 @@ export default function CodeBlock({
|
|
63
62
|
...rest
|
64
63
|
}) {
|
65
64
|
const [copied, setCopied] = useState(false);
|
66
|
-
const isMounted = useMountedState();
|
67
65
|
const source = code || children;
|
68
66
|
const onCopy = () => {
|
69
67
|
if (copied) {
|
@@ -73,9 +71,7 @@ export default function CodeBlock({
|
|
73
71
|
setCopied(true);
|
74
72
|
// 恢复 copied 状态
|
75
73
|
setTimeout(() => {
|
76
|
-
|
77
|
-
setCopied(false);
|
78
|
-
}
|
74
|
+
setCopied(false);
|
79
75
|
}, 1500);
|
80
76
|
};
|
81
77
|
const originEl = /*#__PURE__*/_jsxs(Pre, {
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
require("@fontsource/ubuntu-mono/400.css");
|
10
|
-
var _useMountedState = _interopRequireDefault(require("react-use/lib/useMountedState"));
|
11
10
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
12
11
|
var _colors = require("@mui/material/colors");
|
13
12
|
var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard"));
|
@@ -74,9 +73,6 @@ const DidAddress = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
74
73
|
// eslint-disable-next-line no-param-reassign
|
75
74
|
locale = 'en';
|
76
75
|
}
|
77
|
-
|
78
|
-
// 避免 unmounted 后 setTimeout handler 依然改变 state
|
79
|
-
const isMounted = (0, _useMountedState.default)();
|
80
76
|
const [copied, setCopied] = (0, _react.useState)(false);
|
81
77
|
const textRef = (0, _react.useRef)();
|
82
78
|
const onCopy = e => {
|
@@ -86,9 +82,7 @@ const DidAddress = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
86
82
|
setCopied(true);
|
87
83
|
// 恢复 copied 状态
|
88
84
|
setTimeout(() => {
|
89
|
-
|
90
|
-
setCopied(false);
|
91
|
-
}
|
85
|
+
setCopied(false);
|
92
86
|
}, 1500);
|
93
87
|
};
|
94
88
|
let copyElement = null;
|
package/lib/CodeBlock/index.js
CHANGED
@@ -7,7 +7,6 @@ exports.default = CodeBlock;
|
|
7
7
|
var _react = require("react");
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard"));
|
10
|
-
var _useMountedState = _interopRequireDefault(require("react-use/lib/useMountedState"));
|
11
10
|
var _core = _interopRequireDefault(require("highlight.js/lib/core"));
|
12
11
|
var _javascript = _interopRequireDefault(require("highlight.js/lib/languages/javascript"));
|
13
12
|
var _typescript = _interopRequireDefault(require("highlight.js/lib/languages/typescript"));
|
@@ -79,7 +78,6 @@ function CodeBlock(_ref) {
|
|
79
78
|
} = _ref,
|
80
79
|
rest = _objectWithoutProperties(_ref, _excluded);
|
81
80
|
const [copied, setCopied] = (0, _react.useState)(false);
|
82
|
-
const isMounted = (0, _useMountedState.default)();
|
83
81
|
const source = code || children;
|
84
82
|
const onCopy = () => {
|
85
83
|
if (copied) {
|
@@ -89,9 +87,7 @@ function CodeBlock(_ref) {
|
|
89
87
|
setCopied(true);
|
90
88
|
// 恢复 copied 状态
|
91
89
|
setTimeout(() => {
|
92
|
-
|
93
|
-
setCopied(false);
|
94
|
-
}
|
90
|
+
setCopied(false);
|
95
91
|
}, 1500);
|
96
92
|
};
|
97
93
|
const originEl = /*#__PURE__*/(0, _jsxRuntime.jsxs)(Pre, _objectSpread(_objectSpread({}, rest), {}, {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.8.
|
3
|
+
"version": "2.8.15",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -322,11 +322,11 @@
|
|
322
322
|
"peerDependencies": {
|
323
323
|
"react": ">=18.1.0"
|
324
324
|
},
|
325
|
-
"gitHead": "
|
325
|
+
"gitHead": "82cb60b92bddc5dd96309350c542e05580011323",
|
326
326
|
"dependencies": {
|
327
327
|
"@arcblock/did-motif": "^1.1.13",
|
328
|
-
"@arcblock/icons": "^2.8.
|
329
|
-
"@arcblock/react-hooks": "^2.8.
|
328
|
+
"@arcblock/icons": "^2.8.15",
|
329
|
+
"@arcblock/react-hooks": "^2.8.15",
|
330
330
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
331
331
|
"@emotion/react": "^11.10.4",
|
332
332
|
"@emotion/styled": "^11.10.4",
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React, { useRef, useState, forwardRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import '@fontsource/ubuntu-mono/400.css';
|
4
|
-
import useMountedState from 'react-use/lib/useMountedState';
|
5
4
|
import Tooltip from '@mui/material/Tooltip';
|
6
5
|
import { green } from '@mui/material/colors';
|
7
6
|
import copy from 'copy-to-clipboard';
|
@@ -60,9 +59,6 @@ const DidAddress = forwardRef(
|
|
60
59
|
locale = 'en';
|
61
60
|
}
|
62
61
|
|
63
|
-
// 避免 unmounted 后 setTimeout handler 依然改变 state
|
64
|
-
const isMounted = useMountedState();
|
65
|
-
|
66
62
|
const [copied, setCopied] = useState(false);
|
67
63
|
const textRef = useRef();
|
68
64
|
|
@@ -73,9 +69,7 @@ const DidAddress = forwardRef(
|
|
73
69
|
setCopied(true);
|
74
70
|
// 恢复 copied 状态
|
75
71
|
setTimeout(() => {
|
76
|
-
|
77
|
-
setCopied(false);
|
78
|
-
}
|
72
|
+
setCopied(false);
|
79
73
|
}, 1500);
|
80
74
|
};
|
81
75
|
|
package/src/CodeBlock/index.js
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
import { useState } from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import Copy from 'copy-to-clipboard';
|
5
|
-
import useMountedState from 'react-use/lib/useMountedState';
|
6
5
|
|
7
6
|
import hljs from 'highlight.js/lib/core';
|
8
7
|
import javascript from 'highlight.js/lib/languages/javascript';
|
@@ -59,7 +58,6 @@ hljs.registerLanguage('markdown', markdown);
|
|
59
58
|
|
60
59
|
export default function CodeBlock({ code, language, children, dark, ...rest }) {
|
61
60
|
const [copied, setCopied] = useState(false);
|
62
|
-
const isMounted = useMountedState();
|
63
61
|
const source = code || children;
|
64
62
|
|
65
63
|
const onCopy = () => {
|
@@ -70,9 +68,7 @@ export default function CodeBlock({ code, language, children, dark, ...rest }) {
|
|
70
68
|
setCopied(true);
|
71
69
|
// 恢复 copied 状态
|
72
70
|
setTimeout(() => {
|
73
|
-
|
74
|
-
setCopied(false);
|
75
|
-
}
|
71
|
+
setCopied(false);
|
76
72
|
}, 1500);
|
77
73
|
};
|
78
74
|
|