Skip to content

Commit fcfc495

Browse files
committed
add Color
1 parent b7616b6 commit fcfc495

File tree

8 files changed

+404
-13
lines changed

8 files changed

+404
-13
lines changed

assets/index.less

Lines changed: 144 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,25 @@
2222
color: @text-color;
2323
box-shadow: none;
2424
font-weight: 200;
25+
2526
&::placeholder {
2627
color: fade(@text-color, 15);
2728
}
2829
}
30+
2931
.ant-select {
3032
&-selection {
3133
background: @bg-color2;
3234
border-color: @line-color;
3335
color: @text-color;
3436
box-shadow: none;
3537
}
38+
3639
&-arrow {
3740
color: inherit;
3841
}
3942
}
40-
43+
4144
}
4245

4346
&-breadcrumb {
@@ -49,6 +52,7 @@
4952
.ant-breadcrumb {
5053
color: fade(@title-color, 70);
5154
transition: color .3s;
55+
5256
>span {
5357
cursor: pointer;
5458
}
@@ -93,7 +97,7 @@
9397
&-string {
9498
margin: 8px 0;
9599
}
96-
100+
97101
}
98102

99103
&-title {
@@ -110,6 +114,7 @@
110114
margin: 8px 0;
111115
color: @text-color2;
112116
}
117+
113118
&-z {
114119
color: @text-color;
115120
border-top: 1px solid @line-color;
@@ -186,9 +191,11 @@
186191
.anticon {
187192
margin-right: 8px;
188193
}
194+
189195
a {
190-
196+
191197
color: @primary-color;
198+
192199
&:hover {
193200
color: lighten(@primary-color, 5%)
194201
}
@@ -207,6 +214,7 @@
207214
overflow: hidden;
208215
}
209216
}
217+
210218
&-upload-button {
211219
width: 100%;
212220
border-radius: 4px;
@@ -218,9 +226,11 @@
218226
overflow: hidden;
219227
cursor: pointer;
220228
position: relative;
229+
221230
p {
222231
position: relative;
223232
}
233+
224234
em {
225235
position: absolute;
226236
left: 0;
@@ -232,4 +242,135 @@
232242
transition: width .3s;
233243
}
234244
}
245+
246+
&-color {
247+
width: 60px;
248+
height: 22px;
249+
border-radius: 4px;
250+
cursor: pointer;
251+
overflow: hidden;
252+
display: inline-block;
253+
transition: box-shadow .3s, border .3s;
254+
border: 1px solid #A4A7A8;
255+
256+
&-input {
257+
display: inline-block;
258+
width: ~"calc(100% - 8px - 60px)";
259+
margin-left: 8px;
260+
vertical-align: top;
261+
}
262+
263+
&-picker-wrapper {
264+
position: absolute;
265+
top: 0;
266+
left: 0;
267+
}
268+
269+
&-picker-show {
270+
.@{editorJSON}-color-mask {
271+
position: fixed;
272+
z-index: 9998;
273+
top: 0;
274+
bottom: 0;
275+
left: 0;
276+
right: 0;
277+
}
278+
}
279+
280+
&-picker {
281+
position: absolute;
282+
left: -41px;
283+
perspective: 300px;
284+
margin-top: 5px;
285+
z-index: 9999;
286+
287+
.sketch-picker {
288+
background: @line-color !important;
289+
span {
290+
color: @text-color !important;
291+
}
292+
input {
293+
border-radius: 4px;
294+
overflow: hidden;
295+
color: rgba(0, 0, 0, 0.65)
296+
}
297+
.flexbox-fix {
298+
border-top-color: @bg-color !important;
299+
}
300+
}
301+
302+
.block-picker {
303+
background: @line-color !important;
304+
box-shadow: 4px 8px 16px rgba(0, 0, 0, 0.15);
305+
306+
>div {
307+
&:nth-child(1) {
308+
border-color: transparent transparent @line-color !important;
309+
left: 10px !important;
310+
margin-left: 0 !important;
311+
}
312+
313+
&:nth-child(2), input {
314+
display: none !important;
315+
}
316+
&:nth-child(3) {
317+
padding-bottom: 0 !important;
318+
}
319+
}
320+
}
321+
}
322+
323+
i {
324+
width: 100%;
325+
height: 100%;
326+
display: block;
327+
position: relative;
328+
329+
&:after {
330+
content: '';
331+
display: block;
332+
position: absolute;
333+
width: 0;
334+
height: 0;
335+
border-bottom: 4px solid white;
336+
border-left: 4px solid transparent;
337+
right: 1px;
338+
bottom: 1px;
339+
}
340+
}
341+
342+
&.active {
343+
//border-color: @input-line-color-hover;
344+
//box-shadow: 0 0 4px @input-line-color-hover;
345+
}
346+
347+
&-wrapper {
348+
&:hover {
349+
.color-close {
350+
opacity: 1;
351+
}
352+
}
353+
354+
.color-close {
355+
position: absolute;
356+
line-height: 12px;
357+
text-align: center;
358+
width: 12px;
359+
height: 12px;
360+
top: -5px;
361+
left: -5px;
362+
border-radius: 100%;
363+
background: #ff0000;
364+
color: #fff;
365+
opacity: 0;
366+
cursor: pointer;
367+
transition: opacity .3s;
368+
369+
.anticon-close {
370+
font-size: 12px;
371+
transform: scale(.8);
372+
}
373+
}
374+
}
375+
}
235376
}

examples/simple.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
import EditorJSON from '../src/';
33
import * as React from 'react';
44
import * as ReactDOM from 'react-dom';
5-
import { schema } from 'schema-util';
5+
import { schema } from 'schemas-utile';
66
import '../assets/index.less';
77

88
const schemaJSON = schema(`
9-
Object(产品优势_0) {
9+
Object(产品优势) {
10+
wrapper(背景编辑):Object {
11+
backgroundColor(背景颜色): Object {
12+
children(背景颜色): Color[color: "#FFFFFF,#FAFBFC"]
13+
}
14+
},
1015
blockWrapper(主要信息): Object{
1116
bannerBgPC(电脑端背景): Object {
1217
children(图片地址): Image
@@ -87,6 +92,9 @@ Object(产品优势_0) {
8792
const dataSource = {
8893
wrapper: {
8994
className: 'product-banner',
95+
backgroundColor: {
96+
children: '#FFFFFF',
97+
},
9098
},
9199
blockWrapper: {
92100
className: 'product-banner-wrapper',
@@ -221,6 +229,12 @@ const dataSource = {
221229
};
222230

223231
const dataBasic = {
232+
wrapper: {
233+
className: 'product-banner',
234+
backgroundColor: {
235+
children: '#FFFFFF',
236+
},
237+
},
224238
blockWrapper: {
225239
dynamic: {
226240
children: [
@@ -268,7 +282,7 @@ const dataBasic = {
268282
},
269283
};
270284

271-
const d = ['blockWrapper', 'descriptionContent'];
285+
const d = [];
272286
export default class Demo extends React.Component<any, any> {
273287
state = {
274288
selected: d

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@
4545
"babel-runtime": "^6.26.0",
4646
"classnames": "^2.2.6",
4747
"medium-editor": "^5.23.3",
48+
"rc-tween-one": "^2.4.1",
4849
"react-beautiful-dnd": "^11.0.3",
49-
"simple-evaluate": "^1.2.0",
50-
"schema-util": "^3.4.2"
50+
"react-color": "^2.17.3",
51+
"schemas-utile": "^1.0.0",
52+
"simple-evaluate": "^1.2.0"
5153
},
5254
"devDependencies": {
5355
"@types/enzyme": "^3.9.3",

src/components/ArrayType.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { Icon } from 'antd';
33
import classnames from 'classnames';
4-
import mock from 'schema-util/lib/mock';
4+
import mock from 'schemas-utile/lib/mock';
55
import evaluate from 'simple-evaluate';
66
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
77
/* import Comp from './Comp'; */

0 commit comments

Comments
 (0)