@pie-lib/editable-html 11.18.6-esmbeta.0 → 11.19.0-mui-update.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 +37 -0
- package/lib/block-tags.js +2 -3
- package/lib/block-tags.js.map +1 -1
- package/lib/constants.js +3 -6
- package/lib/constants.js.map +1 -1
- package/lib/editor.js +302 -450
- package/lib/editor.js.map +1 -1
- package/lib/index.js +19 -77
- package/lib/index.js.map +1 -1
- package/lib/parse-html.js +7 -7
- package/lib/parse-html.js.map +1 -1
- package/lib/plugins/characters/custom-popper.js +24 -44
- package/lib/plugins/characters/custom-popper.js.map +1 -1
- package/lib/plugins/characters/index.js +9 -60
- package/lib/plugins/characters/index.js.map +1 -1
- package/lib/plugins/characters/utils.js +3 -6
- package/lib/plugins/characters/utils.js.map +1 -1
- package/lib/plugins/css/icons/index.js +13 -25
- package/lib/plugins/css/icons/index.js.map +1 -1
- package/lib/plugins/css/index.js +22 -88
- package/lib/plugins/css/index.js.map +1 -1
- package/lib/plugins/customPlugin/index.js +10 -26
- package/lib/plugins/customPlugin/index.js.map +1 -1
- package/lib/plugins/html/icons/index.js +14 -26
- package/lib/plugins/html/icons/index.js.map +1 -1
- package/lib/plugins/html/index.js +4 -13
- package/lib/plugins/html/index.js.map +1 -1
- package/lib/plugins/image/alt-dialog.js +20 -49
- package/lib/plugins/image/alt-dialog.js.map +1 -1
- package/lib/plugins/image/component.js +119 -190
- package/lib/plugins/image/component.js.map +1 -1
- package/lib/plugins/image/image-toolbar.js +44 -86
- package/lib/plugins/image/image-toolbar.js.map +1 -1
- package/lib/plugins/image/index.js +6 -46
- package/lib/plugins/image/index.js.map +1 -1
- package/lib/plugins/image/insert-image-handler.js +10 -31
- package/lib/plugins/image/insert-image-handler.js.map +1 -1
- package/lib/plugins/index.js +44 -106
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/list/index.js +27 -73
- package/lib/plugins/list/index.js.map +1 -1
- package/lib/plugins/math/index.js +64 -116
- package/lib/plugins/math/index.js.map +1 -1
- package/lib/plugins/media/index.js +23 -81
- package/lib/plugins/media/index.js.map +1 -1
- package/lib/plugins/media/media-dialog.js +192 -307
- package/lib/plugins/media/media-dialog.js.map +1 -1
- package/lib/plugins/media/media-toolbar.js +40 -65
- package/lib/plugins/media/media-toolbar.js.map +1 -1
- package/lib/plugins/media/media-wrapper.js +20 -49
- package/lib/plugins/media/media-wrapper.js.map +1 -1
- package/lib/plugins/rendering/index.js +5 -15
- package/lib/plugins/rendering/index.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/choice.js +175 -249
- package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/index.js +39 -29
- package/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -1
- package/lib/plugins/respArea/explicit-constructed-response/index.js +3 -10
- package/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -1
- package/lib/plugins/respArea/icons/index.js +22 -45
- package/lib/plugins/respArea/icons/index.js.map +1 -1
- package/lib/plugins/respArea/index.js +5 -59
- package/lib/plugins/respArea/index.js.map +1 -1
- package/lib/plugins/respArea/inline-dropdown/index.js +2 -10
- package/lib/plugins/respArea/inline-dropdown/index.js.map +1 -1
- package/lib/plugins/respArea/math-templated/index.js +92 -109
- package/lib/plugins/respArea/math-templated/index.js.map +1 -1
- package/lib/plugins/respArea/utils.js +8 -40
- package/lib/plugins/respArea/utils.js.map +1 -1
- package/lib/plugins/table/CustomTablePlugin.js +24 -41
- package/lib/plugins/table/CustomTablePlugin.js.map +1 -1
- package/lib/plugins/table/icons/index.js +19 -35
- package/lib/plugins/table/icons/index.js.map +1 -1
- package/lib/plugins/table/index.js +41 -118
- package/lib/plugins/table/index.js.map +1 -1
- package/lib/plugins/table/table-toolbar.js +37 -87
- package/lib/plugins/table/table-toolbar.js.map +1 -1
- package/lib/plugins/textAlign/icons/index.js +18 -64
- package/lib/plugins/textAlign/icons/index.js.map +1 -1
- package/lib/plugins/textAlign/index.js +1 -6
- package/lib/plugins/textAlign/index.js.map +1 -1
- package/lib/plugins/toolbar/default-toolbar.js +30 -79
- package/lib/plugins/toolbar/default-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/done-button.js +16 -34
- package/lib/plugins/toolbar/done-button.js.map +1 -1
- package/lib/plugins/toolbar/editor-and-toolbar.js +174 -201
- package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/index.js +0 -5
- package/lib/plugins/toolbar/index.js.map +1 -1
- package/lib/plugins/toolbar/toolbar-buttons.js +57 -107
- package/lib/plugins/toolbar/toolbar-buttons.js.map +1 -1
- package/lib/plugins/toolbar/toolbar.js +95 -161
- package/lib/plugins/toolbar/toolbar.js.map +1 -1
- package/lib/plugins/utils.js +5 -25
- package/lib/plugins/utils.js.map +1 -1
- package/lib/serialization.js +44 -150
- package/lib/serialization.js.map +1 -1
- package/lib/shared/alert-dialog.js +23 -42
- package/lib/theme.js +1 -2
- package/lib/theme.js.map +1 -1
- package/package.json +15 -21
- package/src/__tests__/utils.js +1 -1
- package/src/editor.jsx +110 -108
- package/src/plugins/characters/custom-popper.js +20 -25
- package/src/plugins/css/icons/index.jsx +11 -13
- package/src/plugins/css/index.jsx +3 -5
- package/src/plugins/html/icons/index.jsx +12 -14
- package/src/plugins/image/alt-dialog.jsx +9 -8
- package/src/plugins/image/component.jsx +67 -87
- package/src/plugins/image/image-toolbar.jsx +26 -26
- package/src/plugins/image/index.jsx +1 -1
- package/src/plugins/index.jsx +10 -10
- package/src/plugins/math/index.jsx +1 -1
- package/src/plugins/media/index.jsx +2 -2
- package/src/plugins/media/media-dialog.js +65 -76
- package/src/plugins/media/media-toolbar.jsx +32 -33
- package/src/plugins/media/media-wrapper.jsx +10 -13
- package/src/plugins/respArea/drag-in-the-blank/choice.jsx +193 -180
- package/src/plugins/respArea/drag-in-the-blank/index.jsx +58 -22
- package/src/plugins/respArea/icons/index.jsx +16 -16
- package/src/plugins/respArea/math-templated/index.jsx +88 -89
- package/src/plugins/respArea/utils.jsx +1 -1
- package/src/plugins/table/icons/index.jsx +14 -16
- package/src/plugins/table/index.jsx +27 -19
- package/src/plugins/table/table-toolbar.jsx +17 -19
- package/src/plugins/textAlign/icons/index.jsx +3 -3
- package/src/plugins/toolbar/__tests__/default-toolbar.test.jsx +1 -1
- package/src/plugins/toolbar/__tests__/toolbar.test.jsx +1 -1
- package/src/plugins/toolbar/default-toolbar.jsx +18 -21
- package/src/plugins/toolbar/done-button.jsx +16 -22
- package/src/plugins/toolbar/editor-and-toolbar.jsx +134 -157
- package/src/plugins/toolbar/toolbar-buttons.jsx +29 -46
- package/src/plugins/toolbar/toolbar.jsx +60 -78
- package/esm/index.js +0 -111560
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import ChevronRight from '@
|
|
4
|
-
import MoreVert from '@
|
|
5
|
-
import {
|
|
3
|
+
import ChevronRight from '@mui/icons-material/ChevronRight';
|
|
4
|
+
import MoreVert from '@mui/icons-material/MoreVert';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
6
|
|
|
7
7
|
const getRotate = (direction) => {
|
|
8
8
|
switch (direction) {
|
|
@@ -56,16 +56,16 @@ GripIcon.propTypes = {
|
|
|
56
56
|
style: PropTypes.object,
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
const StyledToolbarIcon = styled('div')(({ theme }) => ({
|
|
60
|
+
fontFamily: 'Cerebri Sans !important',
|
|
61
|
+
fontSize: theme.typography.fontSize,
|
|
62
|
+
fontWeight: 'bold',
|
|
63
|
+
lineHeight: '14px',
|
|
64
|
+
position: 'relative',
|
|
65
|
+
top: '7px',
|
|
66
|
+
width: '110px',
|
|
67
|
+
height: '28px',
|
|
68
|
+
whiteSpace: 'nowrap',
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
export const ToolbarIcon = () => <StyledToolbarIcon>+ Response Area</StyledToolbarIcon>;
|
|
@@ -1,104 +1,103 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { mq } from '@pie-lib/math-input';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const StyledSpanContainer = styled('span')(({ theme }) => ({
|
|
7
|
+
display: 'inline-flex',
|
|
8
|
+
border: '1px solid #C0C3CF',
|
|
9
|
+
margin: '1px 5px',
|
|
10
|
+
cursor: 'pointer',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
minWidth: '50px',
|
|
14
|
+
minHeight: '36px',
|
|
15
|
+
height: 'fit-content',
|
|
16
|
+
}));
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const StyledResponseBox = styled('div')(({ theme }) => ({
|
|
19
|
+
background: theme.palette.grey['A100'],
|
|
20
|
+
color: theme.palette.grey['A700'],
|
|
21
|
+
display: 'inline-flex',
|
|
22
|
+
borderRight: '2px solid #C0C3CF',
|
|
23
|
+
boxSizing: 'border-box',
|
|
24
|
+
overflow: 'hidden',
|
|
25
|
+
fontSize: '12px',
|
|
26
|
+
minHeight: '36px',
|
|
27
|
+
height: '100%',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
fontFamily: 'Symbola, Times New Roman, serif',
|
|
30
|
+
padding: '0 2px',
|
|
31
|
+
}));
|
|
21
32
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
fontFamily: 'Symbola, Times New Roman, serif',
|
|
35
|
-
padding: '0 2px',
|
|
33
|
+
const StyledMathBlock = styled('div')(() => ({
|
|
34
|
+
flex: 8,
|
|
35
|
+
color: 'var(--pie-text, black)',
|
|
36
|
+
padding: '4px !important',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
backgroundColor: 'var(--pie-background, rgba(255, 255, 255, 0))',
|
|
41
|
+
'& > .mq-math-mode sup.mq-nthroot': {
|
|
42
|
+
fontSize: '70% !important',
|
|
43
|
+
verticalAlign: '1em !important',
|
|
36
44
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
justifyContent: 'center',
|
|
44
|
-
minWidth: '50px',
|
|
45
|
-
minHeight: '36px',
|
|
46
|
-
height: 'fit-content',
|
|
45
|
+
'& > .mq-math-mode .mq-sqrt-stem': {
|
|
46
|
+
borderTop: '0.07em solid',
|
|
47
|
+
marginLeft: '-1.5px',
|
|
48
|
+
marginTop: '-2px !important',
|
|
49
|
+
paddingTop: '5px !important',
|
|
47
50
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
fontSize: '70% !important',
|
|
58
|
-
verticalAlign: '1em !important',
|
|
59
|
-
},
|
|
60
|
-
'& > .mq-math-mode .mq-sqrt-stem': {
|
|
61
|
-
borderTop: '0.07em solid',
|
|
62
|
-
marginLeft: '-1.5px',
|
|
63
|
-
marginTop: '-2px !important',
|
|
64
|
-
paddingTop: '5px !important',
|
|
65
|
-
},
|
|
66
|
-
'& .mq-overarrow-inner': {
|
|
67
|
-
paddingTop: '0 !important',
|
|
68
|
-
border: 'none !important',
|
|
51
|
+
'& .mq-overarrow-inner': {
|
|
52
|
+
paddingTop: '0 !important',
|
|
53
|
+
border: 'none !important',
|
|
54
|
+
},
|
|
55
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
56
|
+
marginTop: '0px',
|
|
57
|
+
minWidth: '1.23em',
|
|
58
|
+
'& *': {
|
|
59
|
+
lineHeight: '1 !important',
|
|
69
60
|
},
|
|
70
|
-
'
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
'& *': {
|
|
74
|
-
lineHeight: '1 !important',
|
|
75
|
-
},
|
|
76
|
-
'&:before': {
|
|
77
|
-
top: '-0.4em',
|
|
78
|
-
left: '-1px',
|
|
79
|
-
},
|
|
80
|
-
'&:after': {
|
|
81
|
-
top: '0px !important',
|
|
82
|
-
position: 'absolute !important',
|
|
83
|
-
right: '-2px',
|
|
84
|
-
},
|
|
85
|
-
'&.mq-empty:after': {
|
|
86
|
-
top: '-0.45em',
|
|
87
|
-
},
|
|
61
|
+
'&:before': {
|
|
62
|
+
top: '-0.4em',
|
|
63
|
+
left: '-1px',
|
|
88
64
|
},
|
|
89
|
-
'
|
|
90
|
-
'
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
65
|
+
'&:after': {
|
|
66
|
+
top: '0px !important',
|
|
67
|
+
position: 'absolute !important',
|
|
68
|
+
right: '-2px',
|
|
94
69
|
},
|
|
95
|
-
'
|
|
96
|
-
|
|
70
|
+
'&.mq-empty:after': {
|
|
71
|
+
top: '-0.45em',
|
|
97
72
|
},
|
|
98
|
-
|
|
99
|
-
|
|
73
|
+
},
|
|
74
|
+
'& .mq-overarrow.mq-arrow-right': {
|
|
75
|
+
'&:before': {
|
|
76
|
+
top: '-0.4em',
|
|
77
|
+
right: '-1px',
|
|
100
78
|
},
|
|
101
79
|
},
|
|
102
|
-
|
|
80
|
+
'& .mq-overarrow-inner-right': {
|
|
81
|
+
display: 'none !important',
|
|
82
|
+
},
|
|
83
|
+
'& .mq-overarrow-inner-left': {
|
|
84
|
+
display: 'none !important',
|
|
85
|
+
},
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
const MathTemplated = ({ attributes, value, keyToDisplay }) => (
|
|
89
|
+
<StyledSpanContainer {...attributes}>
|
|
90
|
+
<StyledResponseBox>{keyToDisplay}</StyledResponseBox>
|
|
91
|
+
<StyledMathBlock>
|
|
92
|
+
<mq.Static latex={value} />
|
|
93
|
+
</StyledMathBlock>
|
|
94
|
+
</StyledSpanContainer>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
MathTemplated.propTypes = {
|
|
98
|
+
attributes: PropTypes.object,
|
|
99
|
+
value: PropTypes.string,
|
|
100
|
+
keyToDisplay: PropTypes.string,
|
|
101
|
+
};
|
|
103
102
|
|
|
104
|
-
export default
|
|
103
|
+
export default MathTemplated;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import { Inline } from 'slate';
|
|
4
|
-
import Snackbar from '@material
|
|
4
|
+
import Snackbar from '@mui/material/Snackbar';
|
|
5
5
|
|
|
6
6
|
export const isNumber = (val) => !isNaN(parseFloat(val)) && isFinite(val);
|
|
7
7
|
|
|
@@ -1,52 +1,50 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'
|
|
8
|
-
fill: 'black',
|
|
9
|
-
},
|
|
4
|
+
const StyledPath = styled('path')({
|
|
5
|
+
fill: 'grey',
|
|
6
|
+
'&:hover': {
|
|
7
|
+
fill: 'black',
|
|
10
8
|
},
|
|
11
|
-
};
|
|
9
|
+
});
|
|
12
10
|
|
|
13
11
|
const SvgIcon = (Component) => {
|
|
14
|
-
return
|
|
12
|
+
return (props) => (
|
|
15
13
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="24" height="24" viewBox="0 0 24 24">
|
|
16
|
-
<Component
|
|
14
|
+
<Component {...props} />
|
|
17
15
|
</svg>
|
|
18
|
-
)
|
|
16
|
+
);
|
|
19
17
|
};
|
|
20
18
|
export const AddRow = SvgIcon((props) => (
|
|
21
|
-
<
|
|
19
|
+
<StyledPath
|
|
22
20
|
{...props}
|
|
23
21
|
d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z"
|
|
24
22
|
/>
|
|
25
23
|
));
|
|
26
24
|
|
|
27
25
|
export const RemoveRow = SvgIcon((props) => (
|
|
28
|
-
<
|
|
26
|
+
<StyledPath
|
|
29
27
|
{...props}
|
|
30
28
|
d="M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z"
|
|
31
29
|
/>
|
|
32
30
|
));
|
|
33
31
|
|
|
34
32
|
export const AddColumn = SvgIcon((props) => (
|
|
35
|
-
<
|
|
33
|
+
<StyledPath
|
|
36
34
|
{...props}
|
|
37
35
|
d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z"
|
|
38
36
|
/>
|
|
39
37
|
));
|
|
40
38
|
|
|
41
39
|
export const RemoveColumn = SvgIcon((props) => (
|
|
42
|
-
<
|
|
40
|
+
<StyledPath
|
|
43
41
|
{...props}
|
|
44
42
|
d="M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z"
|
|
45
43
|
/>
|
|
46
44
|
));
|
|
47
45
|
|
|
48
46
|
export const RemoveTable = SvgIcon((props) => (
|
|
49
|
-
<
|
|
47
|
+
<StyledPath
|
|
50
48
|
{...props}
|
|
51
49
|
d="M15.46,15.88L16.88,14.46L19,16.59L21.12,14.46L22.54,15.88L20.41,18L22.54,20.12L21.12,21.54L19,19.41L16.88,21.54L15.46,20.12L17.59,18L15.46,15.88M4,3H18A2,2 0 0,1 20,5V12.08C18.45,11.82 16.92,12.18 15.68,13H12V17H13.08C12.97,17.68 12.97,18.35 13.08,19H4A2,2 0 0,1 2,17V5A2,2 0 0,1 4,3M4,7V11H10V7H4M12,7V11H18V7H12M4,13V17H10V13H4Z"
|
|
52
50
|
/>
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Block } from 'slate';
|
|
3
3
|
import debug from 'debug';
|
|
4
|
-
import GridOn from '@
|
|
4
|
+
import GridOn from '@mui/icons-material/GridOn';
|
|
5
5
|
import TableToolbar from './table-toolbar';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import SlatePropTypes from 'slate-prop-types';
|
|
8
|
-
import {
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
9
9
|
import convert from 'react-attr-converter';
|
|
10
10
|
import { object as toStyleObject } from 'to-style';
|
|
11
11
|
import CustomTablePlugin from './CustomTablePlugin';
|
|
12
12
|
|
|
13
13
|
const log = debug('@pie-lib:editable-html:plugins:table');
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const StyledTable = styled('table')({});
|
|
16
|
+
|
|
17
|
+
const StyledTableCell = styled(({ node, ...props }) => {
|
|
18
|
+
const Tag = node.data.get('header') ? 'th' : 'td';
|
|
19
|
+
return <Tag {...props} />;
|
|
20
|
+
})({
|
|
21
|
+
'&': {
|
|
22
|
+
minWidth: '25px',
|
|
23
|
+
},
|
|
24
|
+
'&[data-cell-type="td"]': {
|
|
25
|
+
minWidth: '25px',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const Table = (props) => {
|
|
18
30
|
const nodeAttributes = dataToAttributes(props.node.data);
|
|
19
31
|
|
|
20
32
|
return (
|
|
21
|
-
<
|
|
22
|
-
className={props.classes.table}
|
|
33
|
+
<StyledTable
|
|
23
34
|
{...props.attributes}
|
|
24
35
|
{...nodeAttributes}
|
|
25
36
|
onFocus={props.onFocus}
|
|
26
37
|
onBlur={props.onBlur}
|
|
27
38
|
>
|
|
28
39
|
<tbody>{props.children}</tbody>
|
|
29
|
-
</
|
|
40
|
+
</StyledTable>
|
|
30
41
|
);
|
|
31
|
-
}
|
|
42
|
+
};
|
|
32
43
|
|
|
33
44
|
Table.propTypes = {
|
|
34
45
|
attributes: PropTypes.object,
|
|
@@ -47,29 +58,26 @@ TableRow.propTypes = {
|
|
|
47
58
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
48
59
|
};
|
|
49
60
|
|
|
50
|
-
const TableCell =
|
|
51
|
-
td: {
|
|
52
|
-
minWidth: '25px',
|
|
53
|
-
},
|
|
54
|
-
}))((props) => {
|
|
61
|
+
const TableCell = (props) => {
|
|
55
62
|
const Tag = props.node.data.get('header') ? 'th' : 'td';
|
|
56
|
-
|
|
57
63
|
const nodeAttributes = dataToAttributes(props.node.data);
|
|
58
64
|
delete nodeAttributes.header;
|
|
59
65
|
|
|
60
66
|
return (
|
|
61
|
-
<
|
|
67
|
+
<StyledTableCell
|
|
68
|
+
as={Tag}
|
|
69
|
+
node={props.node}
|
|
62
70
|
{...props.attributes}
|
|
63
71
|
{...nodeAttributes}
|
|
64
72
|
colSpan={props.node.data.get('colspan')}
|
|
65
|
-
|
|
73
|
+
data-cell-type={Tag}
|
|
66
74
|
onFocus={props.onFocus}
|
|
67
75
|
onBlur={props.onBlur}
|
|
68
76
|
>
|
|
69
77
|
{props.children}
|
|
70
|
-
</
|
|
78
|
+
</StyledTableCell>
|
|
71
79
|
);
|
|
72
|
-
}
|
|
80
|
+
};
|
|
73
81
|
|
|
74
82
|
TableCell.propTypes = {
|
|
75
83
|
attributes: PropTypes.object,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
3
|
import { Button } from '../toolbar/toolbar-buttons';
|
|
4
4
|
import { DoneButton } from '../toolbar/done-button';
|
|
5
|
-
import BorderAll from '@
|
|
5
|
+
import BorderAll from '@mui/icons-material/BorderAll';
|
|
6
6
|
import { ToolbarButton } from '../toolbar/default-toolbar';
|
|
7
7
|
|
|
8
8
|
import { AddRow, AddColumn, RemoveColumn, RemoveRow, RemoveTable } from './icons';
|
|
@@ -11,6 +11,16 @@ import debug from 'debug';
|
|
|
11
11
|
|
|
12
12
|
const log = debug('@pie-lib:editable-html:plugins:table-toolbar');
|
|
13
13
|
|
|
14
|
+
const TableToolbarContainer = styled('div')({
|
|
15
|
+
width: '100%',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
justifyContent: 'space-between',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const ToolbarButtons = styled('div')({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
});
|
|
23
|
+
|
|
14
24
|
export class TableToolbar extends React.Component {
|
|
15
25
|
static propTypes = {
|
|
16
26
|
plugins: PropTypes.array.isRequired,
|
|
@@ -24,7 +34,6 @@ export class TableToolbar extends React.Component {
|
|
|
24
34
|
onToggleBorder: PropTypes.func.isRequired,
|
|
25
35
|
hasBorder: PropTypes.bool,
|
|
26
36
|
onDone: PropTypes.func.isRequired,
|
|
27
|
-
classes: PropTypes.object.isRequired,
|
|
28
37
|
};
|
|
29
38
|
|
|
30
39
|
static defaultProps = {
|
|
@@ -52,7 +61,6 @@ export class TableToolbar extends React.Component {
|
|
|
52
61
|
onRemoveTable,
|
|
53
62
|
onToggleBorder,
|
|
54
63
|
hasBorder,
|
|
55
|
-
classes,
|
|
56
64
|
} = this.props;
|
|
57
65
|
log('[render] hasBorder:', hasBorder);
|
|
58
66
|
|
|
@@ -78,8 +86,8 @@ export class TableToolbar extends React.Component {
|
|
|
78
86
|
);
|
|
79
87
|
|
|
80
88
|
return (
|
|
81
|
-
<
|
|
82
|
-
<
|
|
89
|
+
<TableToolbarContainer>
|
|
90
|
+
<ToolbarButtons>
|
|
83
91
|
<Button onClick={onAddRow}>
|
|
84
92
|
<AddRow />
|
|
85
93
|
</Button>
|
|
@@ -107,7 +115,7 @@ export class TableToolbar extends React.Component {
|
|
|
107
115
|
<Button onClick={onToggleBorder} active={hasBorder}>
|
|
108
116
|
<BorderAll />
|
|
109
117
|
</Button>
|
|
110
|
-
</
|
|
118
|
+
</ToolbarButtons>
|
|
111
119
|
{filteredPlugins.respAreaPlugin && (
|
|
112
120
|
<ToolbarButton
|
|
113
121
|
key={'plugin-response-area'}
|
|
@@ -118,19 +126,9 @@ export class TableToolbar extends React.Component {
|
|
|
118
126
|
/>
|
|
119
127
|
)}
|
|
120
128
|
<DoneButton onClick={this.onDone} />
|
|
121
|
-
</
|
|
129
|
+
</TableToolbarContainer>
|
|
122
130
|
);
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
133
|
|
|
126
|
-
|
|
127
|
-
tableToolbar: {
|
|
128
|
-
width: '100%',
|
|
129
|
-
display: 'flex',
|
|
130
|
-
justifyContent: 'space-between',
|
|
131
|
-
},
|
|
132
|
-
toolbarButtons: {
|
|
133
|
-
display: 'flex',
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
export default withStyles(styles)(TableToolbar);
|
|
134
|
+
export default TableToolbar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import Collapse from '@material
|
|
3
|
-
import List from '@material
|
|
4
|
-
import ListItem from '@material
|
|
2
|
+
import Collapse from '@mui/material/Collapse';
|
|
3
|
+
import List from '@mui/material/List';
|
|
4
|
+
import ListItem from '@mui/material/ListItem';
|
|
5
5
|
|
|
6
6
|
export const AlignLeft = () => (
|
|
7
7
|
<svg width="20" height="20" viewBox="0 0 66 66" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -10,7 +10,7 @@ import renderer from 'react-test-renderer';
|
|
|
10
10
|
|
|
11
11
|
mockMathInput();
|
|
12
12
|
|
|
13
|
-
jest.mock('@material
|
|
13
|
+
jest.mock('@mui/material/IconButton', () => {
|
|
14
14
|
return (props) => <div className={props.className} style={props.style} ariaLabel={props['aria-label']} />;
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -9,7 +9,7 @@ import renderer from 'react-test-renderer';
|
|
|
9
9
|
|
|
10
10
|
mockMathInput();
|
|
11
11
|
|
|
12
|
-
jest.mock('@material
|
|
12
|
+
jest.mock('@mui/material/IconButton', () => {
|
|
13
13
|
return (props) => <div className={props.className} style={props.style} ariaLabel={props['aria-label']} />;
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -4,13 +4,25 @@ import React from 'react';
|
|
|
4
4
|
import SlatePropTypes from 'slate-prop-types';
|
|
5
5
|
|
|
6
6
|
import { hasBlock, hasMark } from '../utils';
|
|
7
|
-
import {
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
8
8
|
|
|
9
9
|
import { Button, MarkButton } from './toolbar-buttons';
|
|
10
10
|
import debug from 'debug';
|
|
11
11
|
|
|
12
12
|
const log = debug('@pie-lib:editable-html:plugins:toolbar');
|
|
13
13
|
|
|
14
|
+
const DefaultToolbarContainer = styled('div')({
|
|
15
|
+
display: 'flex',
|
|
16
|
+
width: '100%',
|
|
17
|
+
justifyContent: 'space-between',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const ButtonsContainer = styled('div')({
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
display: 'flex',
|
|
23
|
+
width: '100%',
|
|
24
|
+
});
|
|
25
|
+
|
|
14
26
|
export const ToolbarButton = (props) => {
|
|
15
27
|
const onToggle = () => {
|
|
16
28
|
const c = props.onToggle(props.value.change(), props);
|
|
@@ -89,7 +101,6 @@ export const DefaultToolbar = ({
|
|
|
89
101
|
onChange,
|
|
90
102
|
getFocusedValue,
|
|
91
103
|
onDone,
|
|
92
|
-
classes,
|
|
93
104
|
showDone,
|
|
94
105
|
deletable,
|
|
95
106
|
isHtmlMode,
|
|
@@ -149,8 +160,8 @@ export const DefaultToolbar = ({
|
|
|
149
160
|
};
|
|
150
161
|
|
|
151
162
|
return (
|
|
152
|
-
<
|
|
153
|
-
<
|
|
163
|
+
<DefaultToolbarContainer onFocus={handleFocus} tabIndex="1" onBlur={onBlur}>
|
|
164
|
+
<ButtonsContainer>
|
|
154
165
|
{filtered.map((p, index) => {
|
|
155
166
|
return (
|
|
156
167
|
<ToolbarButton
|
|
@@ -163,14 +174,13 @@ export const DefaultToolbar = ({
|
|
|
163
174
|
/>
|
|
164
175
|
);
|
|
165
176
|
})}
|
|
166
|
-
</
|
|
177
|
+
</ButtonsContainer>
|
|
167
178
|
{showDone && !deletable && <DoneButton doneButtonRef={doneButtonRef} onClick={onDone} />}
|
|
168
|
-
</
|
|
179
|
+
</DefaultToolbarContainer>
|
|
169
180
|
);
|
|
170
181
|
};
|
|
171
182
|
|
|
172
183
|
DefaultToolbar.propTypes = {
|
|
173
|
-
classes: PropTypes.object.isRequired,
|
|
174
184
|
plugins: PropTypes.array.isRequired,
|
|
175
185
|
pluginProps: PropTypes.object,
|
|
176
186
|
value: SlatePropTypes.value.isRequired,
|
|
@@ -190,17 +200,4 @@ DefaultToolbar.defaultProps = {
|
|
|
190
200
|
pluginProps: {},
|
|
191
201
|
};
|
|
192
202
|
|
|
193
|
-
|
|
194
|
-
defaultToolbar: {
|
|
195
|
-
display: 'flex',
|
|
196
|
-
width: '100%',
|
|
197
|
-
justifyContent: 'space-between',
|
|
198
|
-
},
|
|
199
|
-
buttonsContainer: {
|
|
200
|
-
alignItems: 'center',
|
|
201
|
-
display: 'flex',
|
|
202
|
-
width: '100%',
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
export default withStyles(toolbarStyles)(DefaultToolbar);
|
|
203
|
+
export default DefaultToolbar;
|
|
@@ -1,38 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import IconButton from '@material
|
|
4
|
-
import Check from '@
|
|
5
|
-
import {
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
|
+
import Check from '@mui/icons-material/Check';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const StyledIconButton = styled(IconButton)({
|
|
9
|
+
verticalAlign: 'top',
|
|
10
|
+
width: '28px',
|
|
11
|
+
height: '28px',
|
|
12
|
+
color: 'var(--editable-html-toolbar-check, #00bb00)',
|
|
13
|
+
padding: '4px',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const RawDoneButton = ({ onClick, doneButtonRef }) => (
|
|
17
|
+
<StyledIconButton
|
|
10
18
|
aria-label="Done"
|
|
11
|
-
className={classes.iconRoot}
|
|
12
19
|
buttonRef={doneButtonRef}
|
|
13
20
|
onClick={onClick}
|
|
14
|
-
|
|
15
|
-
label: classes.label,
|
|
16
|
-
root: classes.iconRoot,
|
|
17
|
-
}}
|
|
21
|
+
size="large"
|
|
18
22
|
>
|
|
19
23
|
<Check />
|
|
20
|
-
</
|
|
24
|
+
</StyledIconButton>
|
|
21
25
|
);
|
|
22
26
|
|
|
23
27
|
RawDoneButton.propTypes = {
|
|
24
|
-
classes: PropTypes.object.isRequired,
|
|
25
28
|
onClick: PropTypes.func,
|
|
26
29
|
doneButtonRef: PropTypes.func,
|
|
27
30
|
};
|
|
28
31
|
|
|
29
|
-
const
|
|
30
|
-
iconRoot: {
|
|
31
|
-
verticalAlign: 'top',
|
|
32
|
-
width: '28px',
|
|
33
|
-
height: '28px',
|
|
34
|
-
color: 'var(--editable-html-toolbar-check, #00bb00)',
|
|
35
|
-
padding: '4px',
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
export const DoneButton = withStyles(styles)(RawDoneButton);
|
|
32
|
+
export const DoneButton = RawDoneButton;
|