Skip to content

Commit 84bc15c

Browse files
committed
feat: open in new windows
open in new windows
1 parent 290d1ed commit 84bc15c

19 files changed

+217
-181
lines changed

.github/workflows/ci.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Mobx React Form Devtools
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
CI:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
- run: npm install --force
13+
- run: npm run cover
14+
- run: npm run coverage:check
15+
- run: npm run build
16+
- run: npm run coverage:report
17+
- name: Semantic Release
18+
uses: cycjimmy/semantic-release-action@v3
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ npm install --save mobx-react-form-devtools
3434
```javascript
3535
import MobxReactFormDevTools from 'mobx-react-form-devtools';
3636

37-
// register forms
37+
// register forms (mobx-react-form Instances)
3838
MobxReactFormDevTools.register({
3939
loginForm,
4040
registerForm,

package-lock.json

+6-123
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@
5555
"classnames": "^2.3.2",
5656
"lodash": "^4.17.21",
5757
"react-dock": "0.2.4",
58-
"react-draggable": "^4.4.5",
5958
"react-icons": "^2.2.7",
60-
"react-json-tree": "0.11.0",
61-
"react-tooltip": "^5.8.3"
59+
"react-json-tree": "0.11.0"
6260
},
6361
"peerDependencies": {
6462
"mobx": "*",
6563
"mobx-react": "*",
6664
"mobx-react-form": "*",
6765
"prop-types": "*",
68-
"react": "*"
66+
"react": "*",
67+
"react-dom": "*"
6968
},
7069
"devDependencies": {
7170
"@types/react": "^18.0.28",

src/actions.ts

+12
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,17 @@ export default $store => ({
4444
}
4545
}),
4646

47+
openInWindow: action(() => {
48+
_.set($store, 'mode', 'windowed');
49+
_.set($store.dock, 'position', 'left');
50+
_.set($store.dock, 'fluid', true);
51+
}),
52+
53+
onCloseWindow: action(() => {
54+
_.set($store, 'mode', 'docked');
55+
_.set($store.dock, 'position', 'right');
56+
_.set($store.dock, 'fluid', false);
57+
}),
58+
4759
});
4860

src/components/Draggable.tsx

+42-28
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,55 @@
1-
import React from 'react';
1+
import React, { useRef } from 'react';
22
import { observer } from 'mobx-react';
33
import cx from 'classnames';
4-
import Draggable from 'react-draggable';
4+
// import Draggable from 'react-draggable';
55

66
import {
77
FaBars,
88
FaChevronLeft,
99
FaBook,
10+
FaWindows,
1011
} from '../icons';
1112

1213
import $U from '../styles/_.utils';
1314
import style from '../styles/Draggable';
1415

15-
export default observer(({ handlers }) => (
16-
<Draggable
17-
axis="y"
18-
handle=".devtools-handle-drag"
19-
defaultPosition={{ x: 0, y: 0 }}
20-
>
21-
<div>
22-
<div className={cx(style.draggable)}>
23-
<div className="devtools-handle-drag">
24-
<FaBars className={cx(style.icon, style.dragIcon)} />
25-
</div>
26-
<button
27-
className={cx($U.button, style.btn)}
28-
onClick={handlers.handleOnOpenTools}
29-
>
30-
<FaChevronLeft className={style.icon} />
31-
</button>
32-
<button
33-
className={cx($U.button, style.btn)}
34-
onClick={handlers.handleOnOpenDoc}
35-
>
36-
<FaBook className={style.icon} />
37-
</button>
38-
</div>
16+
export default observer(({ handlers }) => {
17+
18+
const handleOnDragEnd = (e) => {
19+
e.target.style.top = (e.clientY - 100) + "px";
20+
};
21+
22+
return (
23+
// <div
24+
// axis="y"
25+
// handle=".devtools-handle-drag"
26+
// defaultPosition={{ x: 0, y: 0 }}
27+
// >
28+
<div className={cx(style.draggable)} draggable onDragEnd={handleOnDragEnd}>
29+
<button className={cx($U.button, style.dragButton)}>
30+
<FaBars className={cx(style.icon, style.dragIcon)} />
31+
</button>
32+
<button
33+
className={cx($U.button, style.btn)}
34+
onClick={handlers.handleOnOpenTools}
35+
title="Open Tools"
36+
>
37+
<FaChevronLeft className={style.icon} />
38+
</button>
39+
<button
40+
className={cx($U.button, style.btn)}
41+
onClick={handlers.handleOpenInWindow}
42+
title="Open in new Window"
43+
>
44+
<FaWindows className={style.icon} />
45+
</button>
46+
<button
47+
className={cx($U.button, style.btn)}
48+
onClick={handlers.handleOnOpenDoc}
49+
title="Open Documentation"
50+
>
51+
<FaBook className={style.icon} />
52+
</button>
3953
</div>
40-
</Draggable>
41-
));
54+
// </Draggable>
55+
)});

0 commit comments

Comments
 (0)