@sansitech/react-img-editor 0.4.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 kailunyao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # react-img-editor - Image Editor
2
+
3
+ react-img-editor is an image editor react component that supports image cropping, doodling, text editing, mosaic processing, and other operations, as well as custom plugins and flexible style configuration.
4
+
5
+ ![example](assets/demo.png)
6
+
7
+ View our [storybook](https://hanyuzhou2006.github.io/react-img-editor) for a live demo.
8
+
9
+ ## ✨ Features
10
+
11
+ - Support free brush, rectangle, circle, arrow, text, mosaic drawing
12
+ - Support eraser, undo, screenshot and image download
13
+ - Support custom plug-ins and toolbar configuration
14
+ - Support stretching, dragging and deleting of rectangle, circle, arrow, text and other nodes
15
+ - Support for multiple components on the same page at the same time
16
+
17
+ ## 📦 Download
18
+
19
+ ```
20
+ yarn add @sansitech/react-img-editor
21
+ ```
22
+
23
+ ## 🔨 Introduce and use
24
+
25
+ ```jsx
26
+ import ReactImgEditor from "@sansitech/react-img-editor";
27
+ import "@sansitech/react-img-editor/lib/index.css";
28
+
29
+ <ReactImgEditor src="https://www.w3schools.com/html/img_girl.jpg" />;
30
+ ```
31
+
32
+ ## 🧰 API
33
+
34
+ | Properties | Description | Type | Default |
35
+ | ---------- | ----------- | ---- | ------- |
36
+ | src | image url | string | - |
37
+ | width | board width | number? | 700 |
38
+ | height | board height | number? | 500 |
39
+ | style | styles | React.CSSProperties | - |
40
+ | plugins | Custom plugins | Plugin[] | [] |
41
+ | toolbar | toolbar configuration | { items: string[] } | {items: ['pen', 'eraser', 'arrow', 'rect', 'circle', 'mosaic', 'text', ' / ', 'repeat', 'download', 'crop']} |
42
+ | getStage | Get the [Stage](https://konvajs.org/api/Konva.Stage.html) object of KonvaJS, which can be used to download images, etc. | (stage: any) => void |
43
+ | defaultPluginName | The default selected plugin name | string? | - |
44
+ | crossOrigin | Handling cross-domain images | string? | - |
45
+ | language | Editor language (de,en) | string? | en |
46
+
47
+ ## 📝 TODO
48
+
49
+ - [ ] Load images dynamically
50
+ - [ ] Download image type configuration
51
+ - [ ] Provide plugin configuration items configuration
52
+ - [ ] Optimize free brush writing experience
53
+ - [x] Internationalization support
54
+
55
+ ## 🤝 Contribute
56
+
57
+ Development
58
+
59
+ ```bash
60
+ yarn run development
61
+ ```
62
+
63
+ ## Credits
64
+
65
+ This project is a fork of [react-img-editor](https://github.com/YaoKaiLun/react-img-editor)
@@ -0,0 +1,6 @@
1
+ export default class PubSub {
2
+ id: string;
3
+ constructor(id: string);
4
+ pub: (name: string, param?: any) => void;
5
+ sub: (name: string, callback: any) => void;
6
+ }
@@ -0,0 +1,13 @@
1
+ export declare const prefixCls = "react-img-editor";
2
+ export declare const transformerStyle: {
3
+ centeredScaling: boolean;
4
+ rotateEnabled: boolean;
5
+ anchorCornerRadius: number;
6
+ anchorStrokeWidth: number;
7
+ borderStrokeWidth: number;
8
+ anchorStroke: string;
9
+ borderStroke: string;
10
+ anchorFill: string;
11
+ anchorSize: number;
12
+ rotateAnchorOffset: number;
13
+ };
@@ -0,0 +1,22 @@
1
+ import PubSub from './PubSub';
2
+ import { EditorContextProps } from '../components/EditorContext';
3
+ import { Stage } from 'konva/lib/Stage';
4
+ import { Layer } from 'konva/lib/Layer';
5
+ export interface DrawEventParams extends EditorContextProps {
6
+ event?: any;
7
+ stage: Stage;
8
+ imageLayer: Layer;
9
+ drawLayer: Layer;
10
+ imageData: ImageData;
11
+ reload: (imageObj: any, rectWidth: number, rectHeigh: number) => void;
12
+ historyStack: any[];
13
+ pixelRatio: number;
14
+ pubSub: InstanceType<typeof PubSub>;
15
+ }
16
+ export type PluginParamName = 'strokeWidth' | 'color' | 'fontSize' | 'lineType';
17
+ export interface PluginParamValue {
18
+ strokeWidth?: number;
19
+ color?: string;
20
+ fontSize?: number;
21
+ lineType?: 'solid' | 'dash';
22
+ }
@@ -0,0 +1 @@
1
+ export declare function uuid(): string;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function <CP>(Context: React.Context<CP>, shouldRender?: (context: CP) => boolean): <P extends CP>(WrappedComponent: React.ComponentClass<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<React.PropsWithChildren<P>, keyof CP>> & React.RefAttributes<React.Component<P, any, any>>>;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import Plugin from '../plugins/Plugin';
3
+ import { PluginParamValue } from '../common/type';
4
+ export interface EditorContextProps {
5
+ containerWidth: number;
6
+ containerHeight: number;
7
+ plugins: Plugin[];
8
+ toolbar: {
9
+ items: string[];
10
+ };
11
+ currentPlugin: Plugin | null;
12
+ handlePluginChange: (plugin: Plugin) => void;
13
+ paramValue: PluginParamValue | null;
14
+ handlePluginParamValueChange: (paramValue: PluginParamValue) => void;
15
+ toolbarItemConfig: any;
16
+ updateToolbarItemConfig: (config: any) => void;
17
+ language: string;
18
+ }
19
+ export declare const EditorContext: React.Context<EditorContextProps>;
20
+ export declare const withEditorContext: <P extends EditorContextProps>(WrappedComponent: React.ComponentClass<P, any>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<React.PropsWithChildren<P>, keyof EditorContextProps>> & React.RefAttributes<React.Component<P, any, any>>>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { EditorContextProps } from './EditorContext';
3
+ interface PaletteProps extends EditorContextProps {
4
+ height: number;
5
+ imageObj: HTMLImageElement;
6
+ getStage?: (stage: any) => void;
7
+ }
8
+ declare const _default: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<PaletteProps>, keyof EditorContextProps> & React.RefAttributes<React.Component<PaletteProps, any, any>>>;
9
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface ColorSettingProps {
3
+ value?: string;
4
+ onChange: (color: string) => void;
5
+ }
6
+ export default function ColorSetting(props: ColorSettingProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface FontSizeSettingProps {
3
+ value?: number;
4
+ onChange: (fontSize: number) => void;
5
+ }
6
+ export default function FontSizeSetting(props: FontSizeSettingProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface LineTypeSettingProps {
3
+ value?: string;
4
+ onChange: (lineType: 'solid' | 'dash') => void;
5
+ }
6
+ export default function LineTypeSetting(props: LineTypeSettingProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface StrokeWidthSettingProps {
3
+ value?: number;
4
+ onChange: (strokeWidth: number) => void;
5
+ }
6
+ export default function StrokeWidthSetting(props: StrokeWidthSettingProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { PluginParamName, PluginParamValue } from '../../common/type';
3
+ interface ParamSettingProps {
4
+ paramNames: PluginParamName[];
5
+ paramValue: PluginParamValue | null;
6
+ onChange: (value: PluginParamValue) => void;
7
+ }
8
+ export default function ParamSetting(props: ParamSettingProps): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import 'rc-tooltip/assets/bootstrap_white.css';
3
+ export default function Toolbar(): React.JSX.Element;
package/lib/index.css ADDED
@@ -0,0 +1,386 @@
1
+ .rc-tooltip.rc-tooltip-zoom-appear,
2
+ .rc-tooltip.rc-tooltip-zoom-enter {
3
+ opacity: 0;
4
+ }
5
+ .rc-tooltip.rc-tooltip-zoom-enter,
6
+ .rc-tooltip.rc-tooltip-zoom-leave {
7
+ display: block;
8
+ }
9
+ .rc-tooltip-zoom-enter,
10
+ .rc-tooltip-zoom-appear {
11
+ opacity: 0;
12
+ animation-duration: 0.3s;
13
+ animation-fill-mode: both;
14
+ animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);
15
+ animation-play-state: paused;
16
+ }
17
+ .rc-tooltip-zoom-leave {
18
+ animation-duration: 0.3s;
19
+ animation-fill-mode: both;
20
+ animation-timing-function: cubic-bezier(0.6, -0.3, 0.74, 0.05);
21
+ animation-play-state: paused;
22
+ }
23
+ .rc-tooltip-zoom-enter.rc-tooltip-zoom-enter-active,
24
+ .rc-tooltip-zoom-appear.rc-tooltip-zoom-appear-active {
25
+ animation-name: rcToolTipZoomIn;
26
+ animation-play-state: running;
27
+ }
28
+ .rc-tooltip-zoom-leave.rc-tooltip-zoom-leave-active {
29
+ animation-name: rcToolTipZoomOut;
30
+ animation-play-state: running;
31
+ }
32
+ @keyframes rcToolTipZoomIn {
33
+ 0% {
34
+ opacity: 0;
35
+ transform-origin: 50% 50%;
36
+ transform: scale(0, 0);
37
+ }
38
+ 100% {
39
+ opacity: 1;
40
+ transform-origin: 50% 50%;
41
+ transform: scale(1, 1);
42
+ }
43
+ }
44
+ @keyframes rcToolTipZoomOut {
45
+ 0% {
46
+ opacity: 1;
47
+ transform-origin: 50% 50%;
48
+ transform: scale(1, 1);
49
+ }
50
+ 100% {
51
+ opacity: 0;
52
+ transform-origin: 50% 50%;
53
+ transform: scale(0, 0);
54
+ }
55
+ }
56
+ .rc-tooltip {
57
+ position: absolute;
58
+ z-index: 1070;
59
+ display: block;
60
+ visibility: visible;
61
+ line-height: 1.5;
62
+ font-size: 12px;
63
+ background-color: rgba(0, 0, 0, 0.05);
64
+ padding: 1px;
65
+ opacity: 0.9;
66
+ }
67
+ .rc-tooltip-hidden {
68
+ display: none;
69
+ }
70
+ .rc-tooltip-inner {
71
+ padding: 8px 10px;
72
+ color: #333333;
73
+ text-align: left;
74
+ text-decoration: none;
75
+ background-color: #ffffff;
76
+ border-radius: 3px;
77
+ min-height: 34px;
78
+ border: 1px solid #b1b1b1;
79
+ }
80
+ .rc-tooltip-arrow,
81
+ .rc-tooltip-arrow-inner {
82
+ position: absolute;
83
+ width: 0;
84
+ height: 0;
85
+ border-color: transparent;
86
+ border-style: solid;
87
+ }
88
+ .rc-tooltip-placement-top .rc-tooltip-arrow,
89
+ .rc-tooltip-placement-topLeft .rc-tooltip-arrow,
90
+ .rc-tooltip-placement-topRight .rc-tooltip-arrow {
91
+ transform: translate(-50%, 5px);
92
+ margin-left: -6px;
93
+ border-width: 6px 6px 0;
94
+ border-top-color: #b1b1b1;
95
+ }
96
+ .rc-tooltip-placement-top .rc-tooltip-arrow-inner,
97
+ .rc-tooltip-placement-topLeft .rc-tooltip-arrow-inner,
98
+ .rc-tooltip-placement-topRight .rc-tooltip-arrow-inner {
99
+ bottom: 1px;
100
+ margin-left: -6px;
101
+ border-width: 6px 6px 0;
102
+ border-top-color: #ffffff;
103
+ }
104
+ .rc-tooltip-placement-top .rc-tooltip-arrow {
105
+ left: 50%;
106
+ }
107
+ .rc-tooltip-placement-topLeft .rc-tooltip-arrow {
108
+ left: 15%;
109
+ }
110
+ .rc-tooltip-placement-topRight .rc-tooltip-arrow {
111
+ right: 15%;
112
+ }
113
+ .rc-tooltip-placement-right .rc-tooltip-arrow,
114
+ .rc-tooltip-placement-rightTop .rc-tooltip-arrow,
115
+ .rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
116
+ left: -5px;
117
+ margin-top: -6px;
118
+ border-width: 6px 6px 6px 0;
119
+ border-right-color: #b1b1b1;
120
+ transform: translateX(calc(-100% + 1px));
121
+ }
122
+ .rc-tooltip-placement-right .rc-tooltip-arrow-inner,
123
+ .rc-tooltip-placement-rightTop .rc-tooltip-arrow-inner,
124
+ .rc-tooltip-placement-rightBottom .rc-tooltip-arrow-inner {
125
+ left: 1px;
126
+ margin-top: -6px;
127
+ border-width: 6px 6px 6px 0;
128
+ border-right-color: #ffffff;
129
+ }
130
+ .rc-tooltip-placement-right .rc-tooltip-arrow {
131
+ top: 50%;
132
+ }
133
+ .rc-tooltip-placement-rightTop .rc-tooltip-arrow {
134
+ top: 15%;
135
+ margin-top: 0;
136
+ }
137
+ .rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
138
+ bottom: 15%;
139
+ }
140
+ .rc-tooltip-placement-left .rc-tooltip-arrow,
141
+ .rc-tooltip-placement-leftTop .rc-tooltip-arrow,
142
+ .rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
143
+ right: -5px;
144
+ margin-top: -6px;
145
+ border-width: 6px 0 6px 6px;
146
+ border-left-color: #b1b1b1;
147
+ transform: translateX(calc(100% - 1px));
148
+ }
149
+ .rc-tooltip-placement-left .rc-tooltip-arrow-inner,
150
+ .rc-tooltip-placement-leftTop .rc-tooltip-arrow-inner,
151
+ .rc-tooltip-placement-leftBottom .rc-tooltip-arrow-inner {
152
+ right: 1px;
153
+ margin-top: -6px;
154
+ border-width: 6px 0 6px 6px;
155
+ border-left-color: #ffffff;
156
+ }
157
+ .rc-tooltip-placement-left .rc-tooltip-arrow {
158
+ top: 50%;
159
+ }
160
+ .rc-tooltip-placement-leftTop .rc-tooltip-arrow {
161
+ top: 15%;
162
+ margin-top: 0;
163
+ }
164
+ .rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
165
+ bottom: 15%;
166
+ }
167
+ .rc-tooltip-placement-bottom .rc-tooltip-arrow,
168
+ .rc-tooltip-placement-bottomLeft .rc-tooltip-arrow,
169
+ .rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
170
+ transform: translate(-50%, -5px);
171
+ margin-left: -6px;
172
+ border-width: 0 6px 6px;
173
+ border-bottom-color: #b1b1b1;
174
+ }
175
+ .rc-tooltip-placement-bottom .rc-tooltip-arrow-inner,
176
+ .rc-tooltip-placement-bottomLeft .rc-tooltip-arrow-inner,
177
+ .rc-tooltip-placement-bottomRight .rc-tooltip-arrow-inner {
178
+ top: 1px;
179
+ margin-left: -6px;
180
+ border-width: 0 6px 6px;
181
+ border-bottom-color: #ffffff;
182
+ }
183
+ .rc-tooltip-placement-bottom .rc-tooltip-arrow {
184
+ left: 50%;
185
+ }
186
+ .rc-tooltip-placement-bottomLeft .rc-tooltip-arrow {
187
+ left: 15%;
188
+ }
189
+ .rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
190
+ right: 15%;
191
+ }
192
+
193
+ @font-face {
194
+ font-family: "iconfont";
195
+ src: url('//at.alicdn.com/t/font_1621501_k00ymzzhtbl.eot?t=1580659190858');
196
+ /* IE9 */
197
+ src: url('//at.alicdn.com/t/font_1621501_k00ymzzhtbl.eot?t=1580659190858#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('data:application/x-font-woff2;charset=utf-8;base64,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') format('woff2'), url('//at.alicdn.com/t/font_1621501_k00ymzzhtbl.woff?t=1580659190858') format('woff'), url('//at.alicdn.com/t/font_1621501_k00ymzzhtbl.ttf?t=1580659190858') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ url('//at.alicdn.com/t/font_1621501_k00ymzzhtbl.svg?t=1580659190858#iconfont') format('svg');
198
+ /* iOS 4.1- */
199
+ }
200
+ .iconfont {
201
+ font-family: "iconfont" !important;
202
+ font-size: 16px;
203
+ font-style: normal;
204
+ -webkit-font-smoothing: antialiased;
205
+ -moz-osx-font-smoothing: grayscale;
206
+ }
207
+ .icon-pen:before {
208
+ content: "\e8ac";
209
+ }
210
+ .icon-check:before {
211
+ content: "\e60c";
212
+ }
213
+ .icon-close:before {
214
+ content: "\e6b8";
215
+ }
216
+ .icon-eraser:before {
217
+ content: "\e78e";
218
+ }
219
+ .icon-download:before {
220
+ content: "\e6f7";
221
+ }
222
+ .icon-mosaic:before {
223
+ content: "\e77f";
224
+ }
225
+ .icon-dotted-line:before {
226
+ content: "\e782";
227
+ }
228
+ .icon-square:before {
229
+ content: "\e784";
230
+ }
231
+ .icon-circle:before {
232
+ content: "\e785";
233
+ }
234
+ .icon-line2:before {
235
+ content: "\e786";
236
+ }
237
+ .icon-text:before {
238
+ content: "\e787";
239
+ }
240
+ .icon-arrow:before {
241
+ content: "\e788";
242
+ }
243
+ .icon-cut:before {
244
+ content: "\e789";
245
+ }
246
+ .icon-repeal:before {
247
+ content: "\e78a";
248
+ }
249
+ .react-img-editor *:focus {
250
+ outline: none;
251
+ }
252
+ .react-img-editor-palette {
253
+ position: relative;
254
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC");
255
+ display: flex;
256
+ align-items: center;
257
+ justify-content: center;
258
+ }
259
+ .react-img-editor-container {
260
+ position: relative;
261
+ }
262
+ .react-img-editor-toolbar {
263
+ display: flex;
264
+ align-items: center;
265
+ justify-content: center;
266
+ height: 42px;
267
+ }
268
+ .react-img-editor-toolbar-separator {
269
+ display: inline-block;
270
+ height: 16px;
271
+ width: 1px;
272
+ margin: 0 6px;
273
+ background-color: #D4D4D9;
274
+ }
275
+ .react-img-editor-toolbar-icon {
276
+ padding: 5px;
277
+ }
278
+ .react-img-editor-toolbar-icon i {
279
+ font-size: 16px;
280
+ cursor: pointer;
281
+ color: #A9A9AC;
282
+ padding: 3px;
283
+ }
284
+ .react-img-editor-toolbar-icon.activated i {
285
+ color: #7DB5FD;
286
+ }
287
+ .react-img-editor-toolbar-icon:hover i {
288
+ background-color: #F6F6F9;
289
+ }
290
+ .react-img-editor-toolbar-icon.disabled i {
291
+ color: #D4D4D9;
292
+ background-color: inherit;
293
+ }
294
+ .react-img-editor-tooltip {
295
+ opacity: 1;
296
+ padding: 0;
297
+ }
298
+ .react-img-editor-tooltip .rc-tooltip-arrow {
299
+ border-bottom-color: rgba(0, 0, 0, 0.1);
300
+ }
301
+ .react-img-editor-tooltip .rc-tooltip-inner {
302
+ display: flex;
303
+ align-items: center;
304
+ box-sizing: border-box;
305
+ height: 40px;
306
+ background-color: #FFF;
307
+ border-radius: 2px;
308
+ color: #A9A9AC;
309
+ padding-top: 0;
310
+ padding-bottom: 0;
311
+ border: 1px solid rgba(0, 0, 0, 0.1);
312
+ }
313
+ .react-img-editor-param-setting {
314
+ display: flex;
315
+ align-items: center;
316
+ }
317
+ .react-img-editor-color-square {
318
+ display: inline-block;
319
+ width: 20px;
320
+ height: 20px;
321
+ border-radius: 2px;
322
+ margin: 0 2px;
323
+ box-sizing: border-box;
324
+ cursor: pointer;
325
+ border: 1px solid #EFEFF4;
326
+ }
327
+ .react-img-editor-color-square-activated {
328
+ border: 1px solid #007CFF;
329
+ }
330
+ .react-img-editor-line-type {
331
+ width: 20px;
332
+ height: 20px;
333
+ color: #BDBDC2;
334
+ margin: 0 8px;
335
+ cursor: pointer;
336
+ font-weight: 900;
337
+ line-height: 20px;
338
+ }
339
+ .react-img-editor-line-type-activated {
340
+ color: #007AFF;
341
+ }
342
+ .react-img-editor-stroke-circle {
343
+ display: inline-block;
344
+ border-radius: 50%;
345
+ background: #BDBDC2;
346
+ margin: 0 8px;
347
+ cursor: pointer;
348
+ }
349
+ .react-img-editor-stroke-circle-activated {
350
+ background: #007AFF;
351
+ }
352
+ .react-img-editor-stroke-circle-small {
353
+ width: 4px;
354
+ height: 4px;
355
+ }
356
+ .react-img-editor-stroke-circle-medium {
357
+ width: 10px;
358
+ height: 10px;
359
+ }
360
+ .react-img-editor-stroke-circle-large {
361
+ width: 18px;
362
+ height: 18px;
363
+ }
364
+ .react-img-editor-font-size {
365
+ display: inline-block;
366
+ line-height: 18px;
367
+ margin-left: -1px;
368
+ outline: none;
369
+ border: 1px solid #D7D6DB;
370
+ font-size: 12px;
371
+ color: #97979B;
372
+ cursor: pointer;
373
+ }
374
+ .react-img-editor-font-size:first-child:not(:last-child) {
375
+ border-top-left-radius: 4px;
376
+ border-bottom-left-radius: 4px;
377
+ }
378
+ .react-img-editor-font-size:last-child:not(:first-child) {
379
+ border-top-right-radius: 4px;
380
+ border-bottom-right-radius: 4px;
381
+ }
382
+ .react-img-editor-font-size-activated {
383
+ background-color: #007AFF;
384
+ color: #fff;
385
+ border: 1px solid #007AFF;
386
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import Plugin from './plugins/Plugin';
2
+ import React from 'react';
3
+ import './styles/index.less';
4
+ interface ReactImageEditorProps {
5
+ width?: number;
6
+ height?: number;
7
+ style?: React.CSSProperties;
8
+ plugins?: Plugin[];
9
+ toolbar?: {
10
+ items: string[];
11
+ };
12
+ src: string;
13
+ getStage?: (stage: any) => void;
14
+ defaultPluginName?: string;
15
+ crossOrigin?: string;
16
+ language?: string;
17
+ }
18
+ export default function ReactImageEditor({ width, height, style, plugins, toolbar, src, getStage, defaultPluginName, crossOrigin, language: languageProp, }: ReactImageEditorProps): React.JSX.Element;
19
+ export {};