@arcblock/terminal 2.7.3 → 2.7.5
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/Player.js +3 -4
- package/package.json +5 -5
- package/src/Player.js +3 -2
package/lib/Player.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.default = Player;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _useInterval = _interopRequireDefault(require("@arcblock/react-hooks/lib/useInterval"));
|
|
10
|
-
var
|
|
10
|
+
var _ahooks = require("ahooks");
|
|
11
11
|
var _Terminal = _interopRequireDefault(require("./Terminal"));
|
|
12
12
|
require("./player.css");
|
|
13
13
|
var _util = require("./util");
|
|
@@ -83,10 +83,9 @@ function Player(props) {
|
|
|
83
83
|
const progress = (0, _react.useRef)(null);
|
|
84
84
|
const container = (0, _react.useRef)(null);
|
|
85
85
|
const [maxWidth, setMaxWidth] = (0, _react.useState)(0);
|
|
86
|
-
const
|
|
87
|
-
width
|
|
88
|
-
} = (0, _useWindowSize.default)();
|
|
86
|
+
const size = (0, _ahooks.useSize)(document.body);
|
|
89
87
|
const [state, dispatch] = (0, _react.useReducer)(stateReducer, _util.defaultState);
|
|
88
|
+
const width = (size === null || size === void 0 ? void 0 : size.width) || 0;
|
|
90
89
|
(0, _react.useEffect)(() => {
|
|
91
90
|
if (!terminal.current) {
|
|
92
91
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/terminal",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"description": "A react wrapper for xterm allowing you to easily render a terminal in the browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=18.1.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "5821ccc5b51c313ef45426587eb2357ffe951834",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@arcblock/react-hooks": "^2.7.
|
|
52
|
-
"@arcblock/ux": "^2.7.
|
|
51
|
+
"@arcblock/react-hooks": "^2.7.5",
|
|
52
|
+
"@arcblock/ux": "^2.7.5",
|
|
53
53
|
"@emotion/react": "^11.10.4",
|
|
54
54
|
"@emotion/styled": "^11.10.4",
|
|
55
|
+
"ahooks": "^3.7.8",
|
|
55
56
|
"core-js": "^3.25.5",
|
|
56
57
|
"lodash": "^4.17.21",
|
|
57
|
-
"react-use": "^17.4.0",
|
|
58
58
|
"xterm": "4.19.0",
|
|
59
59
|
"xterm-addon-fit": "^0.2.1",
|
|
60
60
|
"xterm-addon-web-links": "^0.2.1"
|
package/src/Player.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useReducer, useState, useRef, useEffect } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import useInterval from '@arcblock/react-hooks/lib/useInterval';
|
|
5
|
-
import
|
|
5
|
+
import { useSize } from 'ahooks';
|
|
6
6
|
|
|
7
7
|
import Terminal from './Terminal';
|
|
8
8
|
|
|
@@ -82,8 +82,9 @@ export default function Player(props) {
|
|
|
82
82
|
const progress = useRef(null);
|
|
83
83
|
const container = useRef(null);
|
|
84
84
|
const [maxWidth, setMaxWidth] = useState(0);
|
|
85
|
-
const
|
|
85
|
+
const size = useSize(document.body);
|
|
86
86
|
const [state, dispatch] = useReducer(stateReducer, defaultState);
|
|
87
|
+
const width = size?.width || 0;
|
|
87
88
|
|
|
88
89
|
useEffect(() => {
|
|
89
90
|
if (!terminal.current) {
|