Skip to content

Commit

Permalink
chore: update antd version (#2059)
Browse files Browse the repository at this point in the history
* chore: update antd

* fix: add gitignore

* fix: revert

* fix: revert

* fix: revert

* chore: 解决 ci 问题

* chore: update pnpm-lock

* chore: ci问题

* chore: ci问题

* chore: ci问题

* chore: ci问题

---------

Co-authored-by: 潇见 <xiaojian.lj@antgroup.com>
  • Loading branch information
li-jia-nan and crazylxr authored Feb 20, 2023
1 parent 88788e0 commit 03485ef
Show file tree
Hide file tree
Showing 5 changed files with 2,690 additions and 3,112 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
strategy:
matrix:
mode: ['normal', 'strict']
node-version: [14.x, 16.x]

steps:
- uses: actions/checkout@v3
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"url": "git+https://github.com/alibaba/hooks.git"
},
"scripts": {
"init": "NODE_OPTIONS=--openssl-legacy-provider pnpm install && pnpm run build",
"init": "pnpm install && pnpm run build",
"start": "pnpm run dev",
"dev": "dumi dev",
"clean-dist": "rimraf 'packages/*/{lib,es,node_modules,dist}'",
Expand All @@ -27,7 +27,7 @@
"test:strict": "cross-env REACT_MODE=strict jest"
},
"devDependencies": {
"@ant-design/icons": "^4.6.2",
"@ant-design/icons": "^5.0.1",
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.2",
"@babel/plugin-transform-runtime": "^7.19.6",
Expand All @@ -39,10 +39,11 @@
"@types/lodash.debounce": "^4.0.6",
"@types/lodash.isequal": "^4.5.5",
"@types/lodash.throttle": "^4.1.6",
"@types/mockjs": "^1.0.7",
"@types/react-router": "^5.1.19",
"@umijs/fabric": "^2.1.0",
"@umijs/plugin-sass": "^1.1.1",
"antd": "^4.3.3",
"antd": "^5.2.1",
"babel-loader": "^8.1.0",
"babel-plugin-import": "^1.12.0",
"babel-plugin-transform-async-to-promises": "^0.8.15",
Expand Down Expand Up @@ -86,4 +87,4 @@
"@commitlint/config-conventional"
]
}
}
}
4 changes: 2 additions & 2 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
},
"devDependencies": {
"@alifd/next": "^1.20.6",
"@ant-design/icons": "^4.6.2",
"@ant-design/icons": "^5.0.1",
"@types/enzyme": "^3.10.5",
"antd": "^4.16.9",
"antd": "^5.2.1",
"enzyme-adapter-react-16": "^1.15.4",
"jest-websocket-mock": "^2.1.0",
"mock-socket": "^9.0.3",
Expand Down
18 changes: 11 additions & 7 deletions packages/hooks/src/useTextSelection/demo/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@ const getResult = (keyword: string): Promise<string> => {
};

export default () => {
const { text = '', left = 0, top = 0, height = 0, width = 0 } = useTextSelection(() =>
document.querySelector('#translate-dom'),
);
const {
text = '',
left = 0,
top = 0,
height = 0,
width = 0,
} = useTextSelection(() => document.querySelector('#translate-dom'));

const [visible, setVisible] = useState(false);
const [open, setOpen] = useState<boolean>(false);

const { data, run, loading } = useRequest(getResult, {
manual: true,
});

useEffect(() => {
if (text.trim() === '') {
setVisible(false);
setOpen(false);
return;
}
setVisible(true);
setOpen(true);
run(text);
}, [text]);

Expand All @@ -47,7 +51,7 @@ export default () => {
</p>
<Popover
content={<Spin spinning={loading}>{loading ? 'Translating……' : data}</Spin>}
visible={visible}
open={open}
>
<span
style={{
Expand Down
Loading

0 comments on commit 03485ef

Please sign in to comment.