react-screenshots 0.5.19 → 0.5.22
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/README.md +41 -41
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,29 +11,29 @@
|
|
|
11
11
|
1. web 中使用
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import React, { ReactElement, useCallback } from
|
|
15
|
-
import Screenshots, { Bounds } from
|
|
16
|
-
import url from
|
|
14
|
+
import React, { ReactElement, useCallback } from "react";
|
|
15
|
+
import Screenshots, { Bounds } from "react-screenshots";
|
|
16
|
+
import url from "./image.jpg";
|
|
17
17
|
|
|
18
18
|
interface Bounds {
|
|
19
|
-
x: number
|
|
20
|
-
y: number
|
|
21
|
-
width: number
|
|
22
|
-
height: number
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export default function App(): ReactElement {
|
|
26
26
|
const onSave = useCallback((blob: Blob, bounds: Bounds) => {
|
|
27
|
-
console.log(
|
|
28
|
-
console.log(URL.createObjectURL(blob))
|
|
29
|
-
}, [])
|
|
27
|
+
console.log("save", blob, bounds);
|
|
28
|
+
console.log(URL.createObjectURL(blob));
|
|
29
|
+
}, []);
|
|
30
30
|
const onCancel = useCallback(() => {
|
|
31
|
-
console.log(
|
|
32
|
-
}, [])
|
|
31
|
+
console.log("cancel");
|
|
32
|
+
}, []);
|
|
33
33
|
const onOk = useCallback((blob: Blob, bounds: Bounds) => {
|
|
34
|
-
console.log(
|
|
35
|
-
console.log(URL.createObjectURL(blob))
|
|
36
|
-
}, [])
|
|
34
|
+
console.log("ok", blob, bounds);
|
|
35
|
+
console.log(URL.createObjectURL(blob));
|
|
36
|
+
}, []);
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<Screenshots
|
|
@@ -41,19 +41,19 @@ export default function App(): ReactElement {
|
|
|
41
41
|
width={window.innerWidth}
|
|
42
42
|
height={window.innerHeight}
|
|
43
43
|
lang={{
|
|
44
|
-
operation_undo_title:
|
|
45
|
-
operation_mosaic_title:
|
|
46
|
-
operation_text_title:
|
|
47
|
-
operation_brush_title:
|
|
48
|
-
operation_arrow_title:
|
|
49
|
-
operation_ellipse_title:
|
|
50
|
-
operation_rectangle_title:
|
|
44
|
+
operation_undo_title: "Undo",
|
|
45
|
+
operation_mosaic_title: "Mosaic",
|
|
46
|
+
operation_text_title: "Text",
|
|
47
|
+
operation_brush_title: "Brush",
|
|
48
|
+
operation_arrow_title: "Arrow",
|
|
49
|
+
operation_ellipse_title: "Ellipse",
|
|
50
|
+
operation_rectangle_title: "Rectangle",
|
|
51
51
|
}}
|
|
52
52
|
onSave={onSave}
|
|
53
53
|
onCancel={onCancel}
|
|
54
54
|
onOk={onOk}
|
|
55
55
|
/>
|
|
56
|
-
)
|
|
56
|
+
);
|
|
57
57
|
}
|
|
58
58
|
```
|
|
59
59
|
|
|
@@ -85,25 +85,25 @@ window.screenshots: GlobalScreenshots
|
|
|
85
85
|
|
|
86
86
|
```ts
|
|
87
87
|
interface Bounds {
|
|
88
|
-
x: number
|
|
89
|
-
y: number
|
|
90
|
-
width: number
|
|
91
|
-
height: number
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
width: number;
|
|
91
|
+
height: number;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
interface Lang {
|
|
95
|
-
magnifier_position_label: string
|
|
96
|
-
operation_ok_title: string
|
|
97
|
-
operation_cancel_title: string
|
|
98
|
-
operation_save_title: string
|
|
99
|
-
operation_redo_title: string
|
|
100
|
-
operation_undo_title: string
|
|
101
|
-
operation_mosaic_title: string
|
|
102
|
-
operation_text_title: string
|
|
103
|
-
operation_brush_title: string
|
|
104
|
-
operation_arrow_title: string
|
|
105
|
-
operation_ellipse_title: string
|
|
106
|
-
operation_rectangle_title: string
|
|
95
|
+
magnifier_position_label: string;
|
|
96
|
+
operation_ok_title: string;
|
|
97
|
+
operation_cancel_title: string;
|
|
98
|
+
operation_save_title: string;
|
|
99
|
+
operation_redo_title: string;
|
|
100
|
+
operation_undo_title: string;
|
|
101
|
+
operation_mosaic_title: string;
|
|
102
|
+
operation_text_title: string;
|
|
103
|
+
operation_brush_title: string;
|
|
104
|
+
operation_arrow_title: string;
|
|
105
|
+
operation_ellipse_title: string;
|
|
106
|
+
operation_rectangle_title: string;
|
|
107
107
|
}
|
|
108
108
|
```
|
|
109
109
|
|
|
@@ -120,7 +120,7 @@ interface Lang {
|
|
|
120
120
|
### example
|
|
121
121
|
|
|
122
122
|
```js
|
|
123
|
-
import React from
|
|
123
|
+
import React from "react";
|
|
124
124
|
|
|
125
125
|
function App() {
|
|
126
126
|
return (
|
|
@@ -132,7 +132,7 @@ function App() {
|
|
|
132
132
|
onCancel={() => {}}
|
|
133
133
|
onOk={() => {}}
|
|
134
134
|
/>
|
|
135
|
-
)
|
|
135
|
+
);
|
|
136
136
|
}
|
|
137
137
|
```
|
|
138
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-screenshots",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.22",
|
|
4
4
|
"description": "a screenshot cropper tool by react",
|
|
5
5
|
"main": "./lib/react-screenshots.cjs.js",
|
|
6
6
|
"module": "./lib/react-screenshots.es.js",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"typescript": "^5.0.2",
|
|
66
66
|
"vite": "^4.2.1"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "0ca043df538efdadd3ebb72bc8a6d8832575561a"
|
|
69
69
|
}
|