react-design-editor 0.0.36 → 0.0.40
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/dist/react-design-editor.js +17036 -10673
- package/dist/react-design-editor.min.js +1 -1
- package/dist/react-design-editor.min.js.LICENSE.txt +0 -9
- package/lib/Canvas.d.ts +4 -4
- package/lib/Canvas.js +7 -7
- package/lib/handlers/Handler.js +2 -0
- package/lib/objects/Svg.js +25 -6
- package/package.json +20 -19
|
@@ -53,12 +53,3 @@ object-assign
|
|
|
53
53
|
* This source code is licensed under the MIT license found in the
|
|
54
54
|
* LICENSE file in the root directory of this source tree.
|
|
55
55
|
*/
|
|
56
|
-
|
|
57
|
-
/** @license React v16.14.0
|
|
58
|
-
* react.production.min.js
|
|
59
|
-
*
|
|
60
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
61
|
-
*
|
|
62
|
-
* This source code is licensed under the MIT license found in the
|
|
63
|
-
* LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/
|
package/lib/Canvas.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Handler, { HandlerOptions } from './handlers/Handler';
|
|
3
|
+
import './styles/canvas.less';
|
|
4
|
+
import './styles/contextmenu.less';
|
|
5
|
+
import './styles/fabricjs.less';
|
|
6
|
+
import './styles/tooltip.less';
|
|
3
7
|
import { FabricCanvas } from './utils';
|
|
4
|
-
import '../styles/core/canvas.less';
|
|
5
|
-
import '../styles/core/tooltip.less';
|
|
6
|
-
import '../styles/core/contextmenu.less';
|
|
7
|
-
import '../styles/fabricjs/fabricjs.less';
|
|
8
8
|
export interface CanvasInstance {
|
|
9
9
|
handler: Handler;
|
|
10
10
|
canvas: FabricCanvas;
|
package/lib/Canvas.js
CHANGED
|
@@ -22,16 +22,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const react_1 = __importStar(require("react"));
|
|
26
25
|
const fabric_1 = require("fabric");
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
27
|
const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
|
|
28
|
-
const Handler_1 = __importDefault(require("./handlers/Handler"));
|
|
29
|
-
const constants_1 = require("./constants");
|
|
30
28
|
const uuidv4_1 = require("uuidv4");
|
|
31
|
-
require("
|
|
32
|
-
require("
|
|
33
|
-
require("
|
|
34
|
-
require("
|
|
29
|
+
const constants_1 = require("./constants");
|
|
30
|
+
const Handler_1 = __importDefault(require("./handlers/Handler"));
|
|
31
|
+
require("./styles/canvas.less");
|
|
32
|
+
require("./styles/contextmenu.less");
|
|
33
|
+
require("./styles/fabricjs.less");
|
|
34
|
+
require("./styles/tooltip.less");
|
|
35
35
|
class InternalCanvas extends react_1.Component {
|
|
36
36
|
constructor() {
|
|
37
37
|
super(...arguments);
|
package/lib/handlers/Handler.js
CHANGED
|
@@ -141,7 +141,9 @@ class Handler {
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
if ((activeObject.type === 'svg' && key === 'fill') || key === 'stroke') {
|
|
144
|
+
activeObject.set(key, value);
|
|
144
145
|
activeObject._objects.forEach(obj => obj.set(key, value));
|
|
146
|
+
activeObject.setCoords();
|
|
145
147
|
}
|
|
146
148
|
else {
|
|
147
149
|
activeObject.set(key, value);
|
package/lib/objects/Svg.js
CHANGED
|
@@ -5,21 +5,38 @@ const utils_1 = require("../utils");
|
|
|
5
5
|
const Svg = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
|
|
6
6
|
type: 'svg',
|
|
7
7
|
initialize(option = {}) {
|
|
8
|
-
const { svg, loadType } = option;
|
|
9
8
|
this.callSuper('initialize', [], option);
|
|
10
|
-
this.loadSvg(
|
|
9
|
+
this.loadSvg(option);
|
|
11
10
|
},
|
|
12
11
|
addSvgElements(objects, options, path) {
|
|
13
12
|
const createdObj = fabric_1.fabric.util.groupSVGElements(objects, options, path);
|
|
14
13
|
this.set(options);
|
|
15
14
|
if (createdObj.getObjects) {
|
|
16
|
-
createdObj.getObjects().forEach(obj =>
|
|
15
|
+
createdObj.getObjects().forEach(obj => {
|
|
16
|
+
this.add(obj);
|
|
17
|
+
if (options.fill) {
|
|
18
|
+
obj.set('fill', options.fill);
|
|
19
|
+
}
|
|
20
|
+
if (options.stroke) {
|
|
21
|
+
obj.set('stroke', options.stroke);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
17
24
|
}
|
|
18
25
|
else {
|
|
19
26
|
createdObj.set({
|
|
20
27
|
originX: 'center',
|
|
21
28
|
originY: 'center',
|
|
22
29
|
});
|
|
30
|
+
if (options.fill) {
|
|
31
|
+
createdObj.set({
|
|
32
|
+
fill: options.fill,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (options.stroke) {
|
|
36
|
+
createdObj.set({
|
|
37
|
+
stroke: options.stroke,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
23
40
|
this.add(createdObj);
|
|
24
41
|
}
|
|
25
42
|
this.setCoords();
|
|
@@ -27,16 +44,18 @@ const Svg = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
|
|
|
27
44
|
this.canvas.requestRenderAll();
|
|
28
45
|
}
|
|
29
46
|
},
|
|
30
|
-
loadSvg(
|
|
47
|
+
loadSvg(option) {
|
|
48
|
+
const { svg, loadType, fill, stroke } = option;
|
|
49
|
+
console.log(option);
|
|
31
50
|
return new Promise(resolve => {
|
|
32
51
|
if (loadType === 'svg') {
|
|
33
52
|
fabric_1.fabric.loadSVGFromString(svg, (objects, options) => {
|
|
34
|
-
resolve(this.addSvgElements(objects, options, svg));
|
|
53
|
+
resolve(this.addSvgElements(objects, { ...options, fill, stroke }, svg));
|
|
35
54
|
});
|
|
36
55
|
}
|
|
37
56
|
else {
|
|
38
57
|
fabric_1.fabric.loadSVGFromURL(svg, (objects, options) => {
|
|
39
|
-
resolve(this.addSvgElements(objects, options, svg));
|
|
58
|
+
resolve(this.addSvgElements(objects, { ...options, fill, stroke }, svg));
|
|
40
59
|
});
|
|
41
60
|
}
|
|
42
61
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-design-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"description": "Design Editor Tools with React.js + ant.design + fabric.js",
|
|
5
5
|
"main": "dist/react-design-editor.min.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
|
-
"build": "npm run clean && webpack -
|
|
14
|
-
"build:lib": "npm run tsc && webpack -
|
|
13
|
+
"build": "npm run clean && webpack --node-env production --config webpack.prod.js && typedoc",
|
|
14
|
+
"build:lib": "npm run tsc && webpack --node-env production --config webpack.lib.js",
|
|
15
15
|
"start": "npm install && npm run start:dev",
|
|
16
|
-
"start:dev": "webpack
|
|
16
|
+
"start:dev": "webpack serve --config webpack.dev.js",
|
|
17
17
|
"ghpages": "npm run build && node scripts/ghpages",
|
|
18
18
|
"deploy": "npm run build:lib && npm publish",
|
|
19
19
|
"lint": "npm run tsc",
|
|
@@ -40,10 +40,9 @@
|
|
|
40
40
|
"homepage": "https://salgum1114.github.io/react-design-editor",
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"animejs": "^3.0.0",
|
|
43
|
-
"fabric": "^3.
|
|
44
|
-
"react": "^16.
|
|
45
|
-
"react-dom": "^16.14.0"
|
|
46
|
-
"react-dom-factories": "^1.0.2"
|
|
43
|
+
"fabric": "^3.6.6",
|
|
44
|
+
"react": "^16.14.0",
|
|
45
|
+
"react-dom": "^16.14.0"
|
|
47
46
|
},
|
|
48
47
|
"dependencies": {
|
|
49
48
|
"animejs": "^3.0.0",
|
|
@@ -51,7 +50,7 @@
|
|
|
51
50
|
"classnames": "^2.2.6",
|
|
52
51
|
"color": "^3.1.2",
|
|
53
52
|
"echarts": "^4.7.0",
|
|
54
|
-
"fabric": "^3.
|
|
53
|
+
"fabric": "^3.6.6",
|
|
55
54
|
"gifler": "^0.1.0",
|
|
56
55
|
"honeycomb-grid": "^3.1.7",
|
|
57
56
|
"i18next": "^19.0.0",
|
|
@@ -59,12 +58,11 @@
|
|
|
59
58
|
"lodash": "^4.17.10",
|
|
60
59
|
"mediaelement": "^4.2.9",
|
|
61
60
|
"prop-types": "^15.6.2",
|
|
62
|
-
"react": "^16.
|
|
61
|
+
"react": "^16.14.0",
|
|
63
62
|
"react-ace": "^8.1.0",
|
|
64
63
|
"react-color": "^2.14.1",
|
|
65
64
|
"react-custom-scrollbars": "^4.2.1",
|
|
66
65
|
"react-dom": "^16.14.0",
|
|
67
|
-
"react-dom-factories": "^1.0.2",
|
|
68
66
|
"react-helmet": "^5.2.0",
|
|
69
67
|
"react-hot-loader": "^4.12.20",
|
|
70
68
|
"react-json-view": "^1.19.1",
|
|
@@ -80,12 +78,14 @@
|
|
|
80
78
|
"@babel/plugin-proposal-decorators": "^7.16.4",
|
|
81
79
|
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
82
80
|
"@babel/plugin-proposal-private-methods": "^7.16.0",
|
|
81
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.16.0",
|
|
83
82
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
84
83
|
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
85
|
-
"@babel/
|
|
84
|
+
"@babel/plugin-transform-typescript": "^7.16.1",
|
|
86
85
|
"@babel/preset-env": "^7.16.4",
|
|
87
86
|
"@babel/preset-react": "^7.16.0",
|
|
88
87
|
"@babel/preset-typescript": "^7.16.0",
|
|
88
|
+
"@hot-loader/react-dom": "^17.0.1",
|
|
89
89
|
"@types/animejs": "^3.1.0",
|
|
90
90
|
"@types/color": "^3.0.1",
|
|
91
91
|
"@types/echarts": "^4.4.6",
|
|
@@ -101,11 +101,12 @@
|
|
|
101
101
|
"babel-loader": "^8.1.0",
|
|
102
102
|
"babel-plugin-dynamic-import-webpack": "^1.1.0",
|
|
103
103
|
"babel-plugin-import": "^1.13.0",
|
|
104
|
+
"core-js": "^3.19.1",
|
|
104
105
|
"css-loader": "^3.5.2",
|
|
105
106
|
"del": "^5.1.0",
|
|
106
|
-
"eslint": "^
|
|
107
|
-
"eslint-config-airbnb": "^
|
|
108
|
-
"eslint-loader": "^4.0.
|
|
107
|
+
"eslint": "^8.3.0",
|
|
108
|
+
"eslint-config-airbnb": "^19.0.0",
|
|
109
|
+
"eslint-loader": "^4.0.2",
|
|
109
110
|
"eslint-plugin-import": "^2.20.2",
|
|
110
111
|
"eslint-plugin-jsx-a11y": "^6.2.3",
|
|
111
112
|
"eslint-plugin-react": "^7.19.0",
|
|
@@ -118,15 +119,15 @@
|
|
|
118
119
|
"path": "^0.12.7",
|
|
119
120
|
"serve": "^11.3.0",
|
|
120
121
|
"style-loader": "^1.1.4",
|
|
121
|
-
"terser-webpack-plugin": "^2.3
|
|
122
|
+
"terser-webpack-plugin": "^4.2.3",
|
|
122
123
|
"tslint": "^6.1.1",
|
|
123
124
|
"tslint-react": "^5.0.0",
|
|
124
125
|
"typedoc": "^0.17.4",
|
|
125
126
|
"typescript": "^3.9.3",
|
|
126
127
|
"url-loader": "^4.1.0",
|
|
127
|
-
"webpack": "^4.
|
|
128
|
-
"webpack-cli": "^
|
|
129
|
-
"webpack-dev-server": "^3.
|
|
128
|
+
"webpack": "^4.46.0",
|
|
129
|
+
"webpack-cli": "^4.9.1",
|
|
130
|
+
"webpack-dev-server": "^3.11.3",
|
|
130
131
|
"webpack-merge": "^4.2.2",
|
|
131
132
|
"workbox-webpack-plugin": "^5.1.2"
|
|
132
133
|
}
|