@pie-lib/editable-html 9.4.1 → 9.5.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/CHANGELOG.md +11 -0
- package/lib/plugins/image/component.js +3 -3
- package/lib/plugins/image/component.js.map +1 -1
- package/lib/plugins/media/media-dialog.js +6 -6
- package/lib/plugins/media/media-dialog.js.map +1 -1
- package/lib/plugins/media/media-toolbar.js +2 -2
- package/lib/plugins/media/media-toolbar.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/choice.js +2 -2
- package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
- package/lib/plugins/respArea/icons/index.js +14 -12
- package/lib/plugins/respArea/icons/index.js.map +1 -1
- package/lib/plugins/respArea/utils.js.map +1 -1
- package/lib/plugins/table/index.js.map +1 -1
- package/lib/plugins/toolbar/editor-and-toolbar.js +111 -108
- package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
- package/package.json +3 -3
- package/playground/image/index.jsx +3 -0
- package/playground/mathquill/index.jsx +15 -0
- package/playground/prod-test/index.jsx +1 -0
- package/playground/schema-override/image-plugin.jsx +1 -0
- package/playground/schema-override/index.jsx +2 -1
- package/playground/serialization/image-plugin.jsx +1 -0
- package/src/plugins/image/component.jsx +6 -3
- package/src/plugins/media/media-dialog.js +6 -6
- package/src/plugins/media/media-toolbar.jsx +2 -2
- package/src/plugins/respArea/drag-in-the-blank/choice.jsx +2 -2
- package/src/plugins/respArea/icons/index.jsx +6 -3
- package/src/plugins/respArea/utils.jsx +2 -0
- package/src/plugins/table/index.jsx +7 -0
- package/src/plugins/toolbar/editor-and-toolbar.jsx +5 -5
|
@@ -217,14 +217,17 @@ export class Component extends React.Component {
|
|
|
217
217
|
justifyContent = 'flex-start';
|
|
218
218
|
margin = '0';
|
|
219
219
|
break;
|
|
220
|
+
|
|
220
221
|
case 'center':
|
|
221
222
|
justifyContent = 'center';
|
|
222
223
|
margin = '0 auto';
|
|
223
224
|
break;
|
|
225
|
+
|
|
224
226
|
case 'right':
|
|
225
227
|
justifyContent = 'flex-end';
|
|
226
228
|
margin = 'auto 0 0 auto ';
|
|
227
229
|
break;
|
|
230
|
+
|
|
228
231
|
default:
|
|
229
232
|
justifyContent = 'flex-start';
|
|
230
233
|
margin = '0';
|
|
@@ -280,11 +283,11 @@ const styles = (theme) => ({
|
|
|
280
283
|
transition: 'opacity 200ms linear',
|
|
281
284
|
},
|
|
282
285
|
floatingButtonRow: {
|
|
283
|
-
backgroundColor:
|
|
286
|
+
backgroundColor: theme.palette.background.paper,
|
|
284
287
|
borderRadius: '1px',
|
|
285
288
|
display: 'flex',
|
|
286
289
|
padding: '10px',
|
|
287
|
-
border:
|
|
290
|
+
border: `solid 1px ${theme.palette.grey[200]}`,
|
|
288
291
|
boxShadow:
|
|
289
292
|
'0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)',
|
|
290
293
|
},
|
|
@@ -306,7 +309,7 @@ const styles = (theme) => ({
|
|
|
306
309
|
},
|
|
307
310
|
root: {
|
|
308
311
|
position: 'relative',
|
|
309
|
-
border:
|
|
312
|
+
border: `solid 1px ${theme.palette.common.white}`,
|
|
310
313
|
display: 'flex',
|
|
311
314
|
transition: 'opacity 200ms linear',
|
|
312
315
|
},
|
|
@@ -508,7 +508,7 @@ export class MediaDialog extends React.Component {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
const styles = () => ({
|
|
511
|
+
const styles = (theme) => ({
|
|
512
512
|
paper: {
|
|
513
513
|
minWidth: '500px',
|
|
514
514
|
},
|
|
@@ -520,7 +520,7 @@ const styles = () => ({
|
|
|
520
520
|
flexDirection: 'space-between',
|
|
521
521
|
},
|
|
522
522
|
rowItem: {
|
|
523
|
-
marginRight:
|
|
523
|
+
marginRight: theme.spacing.unit * 1.5,
|
|
524
524
|
cursor: 'pointer',
|
|
525
525
|
},
|
|
526
526
|
active: {
|
|
@@ -528,14 +528,14 @@ const styles = () => ({
|
|
|
528
528
|
borderBottom: `2px solid ${color.primary()}`,
|
|
529
529
|
},
|
|
530
530
|
uploadInput: {
|
|
531
|
-
marginTop:
|
|
531
|
+
marginTop: theme.spacing.unit * 1.5,
|
|
532
532
|
},
|
|
533
533
|
error: {
|
|
534
|
-
marginTop:
|
|
535
|
-
color:
|
|
534
|
+
marginTop: theme.spacing.unit * 1.5,
|
|
535
|
+
color: theme.palette.error.main,
|
|
536
536
|
},
|
|
537
537
|
deleteIcon: {
|
|
538
|
-
marginLeft:
|
|
538
|
+
marginLeft: theme.spacing.unit * 1.5,
|
|
539
539
|
},
|
|
540
540
|
});
|
|
541
541
|
|
|
@@ -8,7 +8,7 @@ const useStyles = withStyles((theme) => ({
|
|
|
8
8
|
bottom: '5px',
|
|
9
9
|
left: 0,
|
|
10
10
|
width: '100%',
|
|
11
|
-
background:
|
|
11
|
+
background: theme.palette.common.white,
|
|
12
12
|
display: 'inline-flex',
|
|
13
13
|
padding: '5px',
|
|
14
14
|
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
|
|
@@ -16,7 +16,7 @@ const useStyles = withStyles((theme) => ({
|
|
|
16
16
|
editContainer: {
|
|
17
17
|
cursor: 'pointer',
|
|
18
18
|
flex: 3,
|
|
19
|
-
border:
|
|
19
|
+
border: `solid ${theme.palette.common.black}`,
|
|
20
20
|
textAlign: 'right',
|
|
21
21
|
borderWidth: '0 2px 0 0',
|
|
22
22
|
marginRight: '5px',
|
|
@@ -17,10 +17,10 @@ const useStyles = withStyles((theme) => ({
|
|
|
17
17
|
minWidth: '90px',
|
|
18
18
|
},
|
|
19
19
|
correct: {
|
|
20
|
-
border:
|
|
20
|
+
border: `solid 1px ${color.correct()}`,
|
|
21
21
|
},
|
|
22
22
|
incorrect: {
|
|
23
|
-
border:
|
|
23
|
+
border: `solid 1px ${theme.palette.error.main}`,
|
|
24
24
|
},
|
|
25
25
|
selected: {
|
|
26
26
|
border: `2px solid ${color.primaryDark()} !important`,
|
|
@@ -8,10 +8,13 @@ const getRotate = (direction) => {
|
|
|
8
8
|
switch (direction) {
|
|
9
9
|
case 'down':
|
|
10
10
|
return 90;
|
|
11
|
+
|
|
11
12
|
case 'up':
|
|
12
13
|
return -90;
|
|
14
|
+
|
|
13
15
|
case 'left':
|
|
14
16
|
return 180;
|
|
17
|
+
|
|
15
18
|
default:
|
|
16
19
|
return 0;
|
|
17
20
|
}
|
|
@@ -53,10 +56,10 @@ GripIcon.propTypes = {
|
|
|
53
56
|
style: PropTypes.object,
|
|
54
57
|
};
|
|
55
58
|
|
|
56
|
-
export const ToolbarIcon = withStyles({
|
|
59
|
+
export const ToolbarIcon = withStyles((theme) => ({
|
|
57
60
|
icon: {
|
|
58
61
|
fontFamily: 'Cerebri Sans !important',
|
|
59
|
-
fontSize:
|
|
62
|
+
fontSize: theme.typography.fontSize,
|
|
60
63
|
fontWeight: 'bold',
|
|
61
64
|
lineHeight: '14px',
|
|
62
65
|
position: 'relative',
|
|
@@ -65,4 +68,4 @@ export const ToolbarIcon = withStyles({
|
|
|
65
68
|
height: '28px',
|
|
66
69
|
whiteSpace: 'nowrap',
|
|
67
70
|
},
|
|
68
|
-
})(({ classes }) => <div className={classes.icon}>+ Response Area</div>);
|
|
71
|
+
}))(({ classes }) => <div className={classes.icon}>+ Response Area</div>);
|
|
@@ -68,8 +68,10 @@ export const getDefaultElement = (opts, index) => {
|
|
|
68
68
|
switch (opts.type) {
|
|
69
69
|
case 'explicit-constructed-response':
|
|
70
70
|
return defaultECR(index);
|
|
71
|
+
|
|
71
72
|
case 'drag-in-the-blank':
|
|
72
73
|
return defaultDIB(opts, index);
|
|
74
|
+
|
|
73
75
|
default:
|
|
74
76
|
// inline-dropdown
|
|
75
77
|
return defaultIDD(index);
|
|
@@ -377,6 +377,7 @@ export const serialization = {
|
|
|
377
377
|
data: attributes.reduce(attributesToMap(el), {}),
|
|
378
378
|
};
|
|
379
379
|
}
|
|
380
|
+
|
|
380
381
|
case 'th': {
|
|
381
382
|
return {
|
|
382
383
|
object: 'block',
|
|
@@ -385,6 +386,7 @@ export const serialization = {
|
|
|
385
386
|
data: cellAttributes.reduce(attributesToMap(el), { header: true }),
|
|
386
387
|
};
|
|
387
388
|
}
|
|
389
|
+
|
|
388
390
|
case 'tr': {
|
|
389
391
|
return {
|
|
390
392
|
object: 'block',
|
|
@@ -392,6 +394,7 @@ export const serialization = {
|
|
|
392
394
|
nodes: next(Array.from(el.children)),
|
|
393
395
|
};
|
|
394
396
|
}
|
|
397
|
+
|
|
395
398
|
case 'td': {
|
|
396
399
|
return {
|
|
397
400
|
object: 'block',
|
|
@@ -410,18 +413,22 @@ export const serialization = {
|
|
|
410
413
|
switch (object.type) {
|
|
411
414
|
case 'table': {
|
|
412
415
|
const attributes = dataToAttributes(object.data);
|
|
416
|
+
|
|
413
417
|
return (
|
|
414
418
|
<table {...attributes}>
|
|
415
419
|
<tbody>{children}</tbody>
|
|
416
420
|
</table>
|
|
417
421
|
);
|
|
418
422
|
}
|
|
423
|
+
|
|
419
424
|
case 'table_row': {
|
|
420
425
|
return <tr>{children}</tr>;
|
|
421
426
|
}
|
|
427
|
+
|
|
422
428
|
case 'table_cell': {
|
|
423
429
|
const attributes = dataToAttributes(object.data);
|
|
424
430
|
delete attributes.header;
|
|
431
|
+
|
|
425
432
|
if (object.data.get('header')) {
|
|
426
433
|
return <th {...attributes}>{children}</th>;
|
|
427
434
|
} else {
|
|
@@ -122,7 +122,7 @@ export class EditorAndToolbar extends React.Component {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
const style = {
|
|
125
|
+
const style = (theme) => ({
|
|
126
126
|
root: {
|
|
127
127
|
position: 'relative',
|
|
128
128
|
padding: '0px',
|
|
@@ -178,7 +178,7 @@ const style = {
|
|
|
178
178
|
'&:hover': {
|
|
179
179
|
'&::after': {
|
|
180
180
|
transform: 'scaleX(1)',
|
|
181
|
-
backgroundColor:
|
|
181
|
+
backgroundColor: theme.palette.common.black,
|
|
182
182
|
height: '2px',
|
|
183
183
|
},
|
|
184
184
|
},
|
|
@@ -220,7 +220,7 @@ const style = {
|
|
|
220
220
|
'&:hover': {
|
|
221
221
|
'&::after': {
|
|
222
222
|
transform: 'scaleX(0)',
|
|
223
|
-
backgroundColor:
|
|
223
|
+
backgroundColor: theme.palette.common.black,
|
|
224
224
|
height: '2px',
|
|
225
225
|
},
|
|
226
226
|
},
|
|
@@ -238,7 +238,7 @@ const style = {
|
|
|
238
238
|
},
|
|
239
239
|
},
|
|
240
240
|
error: {
|
|
241
|
-
border:
|
|
241
|
+
border: `2px solid ${theme.palette.error.main}`,
|
|
242
242
|
},
|
|
243
243
|
noBorder: {
|
|
244
244
|
border: 'none',
|
|
@@ -246,6 +246,6 @@ const style = {
|
|
|
246
246
|
noPadding: {
|
|
247
247
|
padding: 0,
|
|
248
248
|
},
|
|
249
|
-
};
|
|
249
|
+
});
|
|
250
250
|
|
|
251
251
|
export default withStyles(style)(EditorAndToolbar);
|