@pie-lib/editable-html-tip-tap 1.0.20 → 1.0.21-next.6053
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 +7 -73
- package/LICENSE.md +5 -0
- package/NEXT.CHANGELOG.json +1 -0
- package/lib/components/CharacterPicker.js +20 -60
- package/lib/components/CharacterPicker.js.map +1 -1
- package/lib/components/EditableHtml.js +50 -121
- package/lib/components/EditableHtml.js.map +1 -1
- package/lib/components/MenuBar.js +96 -128
- package/lib/components/MenuBar.js.map +1 -1
- package/lib/components/TiptapContainer.js +162 -45
- package/lib/components/TiptapContainer.js.map +1 -1
- package/lib/components/characters/characterUtils.js +4 -7
- package/lib/components/characters/characterUtils.js.map +1 -1
- package/lib/components/characters/custom-popper.js +22 -51
- package/lib/components/characters/custom-popper.js.map +1 -1
- package/lib/components/common/done-button.js +17 -36
- package/lib/components/common/done-button.js.map +1 -1
- package/lib/components/common/toolbar-buttons.js +57 -107
- package/lib/components/common/toolbar-buttons.js.map +1 -1
- package/lib/components/icons/CssIcon.js +14 -26
- package/lib/components/icons/CssIcon.js.map +1 -1
- package/lib/components/icons/RespArea.js +23 -46
- package/lib/components/icons/RespArea.js.map +1 -1
- package/lib/components/icons/TableIcons.js +20 -36
- package/lib/components/icons/TableIcons.js.map +1 -1
- package/lib/components/icons/TextAlign.js +16 -53
- package/lib/components/icons/TextAlign.js.map +1 -1
- package/lib/components/image/AltDialog.js +18 -49
- package/lib/components/image/AltDialog.js.map +1 -1
- package/lib/components/image/ImageToolbar.js +50 -90
- package/lib/components/image/ImageToolbar.js.map +1 -1
- package/lib/components/image/InsertImageHandler.js +17 -35
- package/lib/components/image/InsertImageHandler.js.map +1 -1
- package/lib/components/media/MediaDialog.js +195 -309
- package/lib/components/media/MediaDialog.js.map +1 -1
- package/lib/components/media/MediaToolbar.js +39 -66
- package/lib/components/media/MediaToolbar.js.map +1 -1
- package/lib/components/media/MediaWrapper.js +30 -56
- package/lib/components/media/MediaWrapper.js.map +1 -1
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js +21 -36
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js.map +1 -1
- package/lib/components/respArea/DragInTheBlank/choice.js +215 -262
- package/lib/components/respArea/DragInTheBlank/choice.js.map +1 -1
- package/lib/components/respArea/ExplicitConstructedResponse.js +11 -33
- package/lib/components/respArea/ExplicitConstructedResponse.js.map +1 -1
- package/lib/components/respArea/InlineDropdown.js +19 -41
- package/lib/components/respArea/InlineDropdown.js.map +1 -1
- package/lib/components/respArea/ToolbarIcon.js +21 -45
- package/lib/components/respArea/ToolbarIcon.js.map +1 -1
- package/lib/constants.js +3 -5
- package/lib/constants.js.map +1 -1
- package/lib/extensions/component.js +94 -148
- package/lib/extensions/component.js.map +1 -1
- package/lib/extensions/css.js +9 -44
- package/lib/extensions/css.js.map +1 -1
- package/lib/extensions/custom-toolbar-wrapper.js +66 -94
- package/lib/extensions/custom-toolbar-wrapper.js.map +1 -1
- package/lib/extensions/extended-table.js +2 -6
- package/lib/extensions/extended-table.js.map +1 -1
- package/lib/extensions/image.js +4 -17
- package/lib/extensions/image.js.map +1 -1
- package/lib/extensions/index.js +11 -21
- package/lib/extensions/index.js.map +1 -1
- package/lib/extensions/math.js +45 -96
- package/lib/extensions/math.js.map +1 -1
- package/lib/extensions/media.js +21 -59
- package/lib/extensions/media.js.map +1 -1
- package/lib/extensions/responseArea.js +43 -89
- package/lib/extensions/responseArea.js.map +1 -1
- package/lib/index.js +3 -11
- package/lib/index.js.map +1 -1
- package/lib/styles/editorContainerStyles.js +2 -7
- package/lib/styles/editorContainerStyles.js.map +1 -1
- package/lib/theme.js +2 -3
- package/lib/theme.js.map +1 -1
- package/lib/utils/size.js +2 -10
- package/lib/utils/size.js.map +1 -1
- package/package.json +15 -13
- package/src/components/EditableHtml.jsx +21 -33
- package/src/components/MenuBar.jsx +66 -37
- package/src/components/TiptapContainer.jsx +133 -34
- package/src/components/characters/custom-popper.js +18 -28
- package/src/components/common/done-button.jsx +15 -26
- package/src/components/common/toolbar-buttons.jsx +28 -44
- package/src/components/icons/CssIcon.jsx +11 -13
- package/src/components/icons/RespArea.jsx +16 -16
- package/src/components/icons/TableIcons.jsx +15 -16
- package/src/components/icons/TextAlign.jsx +3 -3
- package/src/components/image/AltDialog.jsx +6 -6
- package/src/components/image/ImageToolbar.jsx +28 -29
- package/src/components/media/MediaDialog.js +61 -78
- package/src/components/media/MediaToolbar.jsx +30 -37
- package/src/components/media/MediaWrapper.jsx +12 -16
- package/src/components/respArea/DragInTheBlank/DragInTheBlank.jsx +5 -4
- package/src/components/respArea/DragInTheBlank/choice.jsx +191 -185
- package/src/components/respArea/ToolbarIcon.jsx +13 -15
- package/src/extensions/component.jsx +61 -89
- package/src/extensions/css.js +6 -5
- package/src/extensions/custom-toolbar-wrapper.jsx +61 -81
- package/lib/__tests__/utils.js +0 -106
- package/src/__tests__/utils.js +0 -36
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import Popper from '@material
|
|
4
|
-
import Typography from '@material
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import Popper from '@mui/material/Popper';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
zIndex: 99999,
|
|
12
|
-
},
|
|
13
|
-
paper: {
|
|
14
|
-
padding: 20,
|
|
15
|
-
height: 'auto',
|
|
16
|
-
width: 'auto',
|
|
17
|
-
},
|
|
18
|
-
typography: {
|
|
19
|
-
fontSize: 50,
|
|
20
|
-
textAlign: 'center',
|
|
21
|
-
},
|
|
6
|
+
const StyledPopper = styled(Popper)({
|
|
7
|
+
background: '#fff',
|
|
8
|
+
padding: '10px',
|
|
9
|
+
pointerEvents: 'none',
|
|
10
|
+
zIndex: 99999,
|
|
22
11
|
});
|
|
23
12
|
|
|
24
|
-
const
|
|
25
|
-
|
|
13
|
+
const StyledTypography = styled(Typography)({
|
|
14
|
+
fontSize: 50,
|
|
15
|
+
textAlign: 'center',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const CustomPopper = ({ children, ...props }) => (
|
|
19
|
+
<StyledPopper
|
|
26
20
|
id="mouse-over-popover"
|
|
27
21
|
open
|
|
28
|
-
className={classes.popover}
|
|
29
|
-
classes={{
|
|
30
|
-
paper: classes.paper,
|
|
31
|
-
}}
|
|
32
22
|
anchorOrigin={{
|
|
33
23
|
vertical: 'bottom',
|
|
34
24
|
horizontal: 'left',
|
|
@@ -41,8 +31,8 @@ const CustomPopper = withStyles(styles)(({ classes, children, ...props }) => (
|
|
|
41
31
|
disableAutoFocus
|
|
42
32
|
{...props}
|
|
43
33
|
>
|
|
44
|
-
<
|
|
45
|
-
</
|
|
46
|
-
)
|
|
34
|
+
<StyledTypography>{children}</StyledTypography>
|
|
35
|
+
</StyledPopper>
|
|
36
|
+
);
|
|
47
37
|
|
|
48
38
|
export default CustomPopper;
|
|
@@ -1,38 +1,27 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>
|
|
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 aria-label="Done" buttonRef={doneButtonRef} onClick={onClick}>
|
|
19
18
|
<Check />
|
|
20
|
-
</
|
|
19
|
+
</StyledIconButton>
|
|
21
20
|
);
|
|
22
21
|
|
|
23
22
|
RawDoneButton.propTypes = {
|
|
24
|
-
classes: PropTypes.object.isRequired,
|
|
25
23
|
onClick: PropTypes.func,
|
|
26
24
|
doneButtonRef: PropTypes.func,
|
|
27
25
|
};
|
|
28
26
|
|
|
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);
|
|
27
|
+
export const DoneButton = RawDoneButton;
|
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import debug from 'debug';
|
|
3
|
-
import {
|
|
4
|
-
import classNames from 'classnames';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'&:focus': {
|
|
19
|
-
outline: `2px solid ${theme.palette.grey[700]}`,
|
|
20
|
-
},
|
|
6
|
+
const StyledButton = styled('button', {
|
|
7
|
+
shouldForwardProp: (prop) => !['active', 'disabled', 'extraStyles'].includes(prop),
|
|
8
|
+
})(({ theme, active, disabled }) => ({
|
|
9
|
+
color: active ? 'black' : 'grey',
|
|
10
|
+
display: 'inline-flex',
|
|
11
|
+
padding: '2px',
|
|
12
|
+
background: 'none',
|
|
13
|
+
border: 'none',
|
|
14
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
15
|
+
'&:hover': {
|
|
16
|
+
color: disabled ? 'grey' : 'black',
|
|
21
17
|
},
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
'&:focus': {
|
|
19
|
+
outline: `2px solid ${theme.palette.grey[700]}`,
|
|
24
20
|
},
|
|
25
|
-
disabled
|
|
21
|
+
...(disabled && {
|
|
26
22
|
opacity: 0.7,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
color: 'grey',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
});
|
|
23
|
+
}),
|
|
24
|
+
}));
|
|
33
25
|
|
|
34
26
|
const log = debug('pie-elements:editable-html:raw-button');
|
|
35
27
|
|
|
36
28
|
export class RawButton extends React.Component {
|
|
37
29
|
static propTypes = {
|
|
38
30
|
onClick: PropTypes.func.isRequired,
|
|
39
|
-
classes: PropTypes.object.isRequired,
|
|
40
31
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
41
32
|
active: PropTypes.bool,
|
|
42
33
|
disabled: PropTypes.bool,
|
|
@@ -64,31 +55,26 @@ export class RawButton extends React.Component {
|
|
|
64
55
|
};
|
|
65
56
|
|
|
66
57
|
render() {
|
|
67
|
-
const { active,
|
|
68
|
-
|
|
69
|
-
const names = classNames(classes.button, {
|
|
70
|
-
[classes.active]: active,
|
|
71
|
-
[classes.disabled]: disabled,
|
|
72
|
-
});
|
|
58
|
+
const { active, children, disabled, extraStyles, ariaLabel } = this.props;
|
|
73
59
|
|
|
74
60
|
return (
|
|
75
|
-
<
|
|
61
|
+
<StyledButton
|
|
76
62
|
style={extraStyles}
|
|
77
|
-
|
|
63
|
+
active={active}
|
|
64
|
+
disabled={disabled}
|
|
78
65
|
onMouseDown={this.onClick}
|
|
79
66
|
onKeyDown={this.onKeyDown}
|
|
80
|
-
disabled={disabled}
|
|
81
67
|
aria-label={ariaLabel}
|
|
82
68
|
aria-pressed={active}
|
|
83
69
|
tabIndex={0}
|
|
84
70
|
>
|
|
85
71
|
{children}
|
|
86
|
-
</
|
|
72
|
+
</StyledButton>
|
|
87
73
|
);
|
|
88
74
|
}
|
|
89
75
|
}
|
|
90
76
|
|
|
91
|
-
export const Button =
|
|
77
|
+
export const Button = RawButton;
|
|
92
78
|
|
|
93
79
|
export class RawMarkButton extends React.Component {
|
|
94
80
|
static propTypes = {
|
|
@@ -96,7 +82,6 @@ export class RawMarkButton extends React.Component {
|
|
|
96
82
|
mark: PropTypes.string,
|
|
97
83
|
label: PropTypes.string.isRequired,
|
|
98
84
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
99
|
-
classes: PropTypes.object.isRequired,
|
|
100
85
|
active: PropTypes.bool,
|
|
101
86
|
};
|
|
102
87
|
|
|
@@ -117,12 +102,11 @@ export class RawMarkButton extends React.Component {
|
|
|
117
102
|
};
|
|
118
103
|
|
|
119
104
|
render() {
|
|
120
|
-
const {
|
|
105
|
+
const { children, active, label } = this.props;
|
|
121
106
|
|
|
122
|
-
const names = classNames(classes.button, active && classes.active);
|
|
123
107
|
return (
|
|
124
|
-
<
|
|
125
|
-
|
|
108
|
+
<StyledButton
|
|
109
|
+
active={active}
|
|
126
110
|
onMouseDown={this.onToggle}
|
|
127
111
|
aria-pressed={active}
|
|
128
112
|
onKeyDown={this.onKeyDown}
|
|
@@ -130,9 +114,9 @@ export class RawMarkButton extends React.Component {
|
|
|
130
114
|
tabIndex={0}
|
|
131
115
|
>
|
|
132
116
|
{children}
|
|
133
|
-
</
|
|
117
|
+
</StyledButton>
|
|
134
118
|
);
|
|
135
119
|
}
|
|
136
120
|
}
|
|
137
121
|
|
|
138
|
-
export const MarkButton =
|
|
122
|
+
export const MarkButton = RawMarkButton;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
});
|
|
4
|
+
const StyledCssIcon = styled('div')(({ theme }) => ({
|
|
5
|
+
fontFamily: 'Cerebri Sans, Arial, sans-serif',
|
|
6
|
+
fontSize: theme.typography.fontSize,
|
|
7
|
+
fontWeight: 'bold',
|
|
8
|
+
lineHeight: '14px',
|
|
9
|
+
position: 'relative',
|
|
10
|
+
whiteSpace: 'nowrap',
|
|
11
|
+
}));
|
|
14
12
|
|
|
15
|
-
const CssIcon = (
|
|
13
|
+
const CssIcon = () => <StyledCssIcon>CSS</StyledCssIcon>;
|
|
16
14
|
|
|
17
|
-
export default
|
|
15
|
+
export default CssIcon;
|
|
@@ -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,52 +1,51 @@
|
|
|
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
|
};
|
|
18
|
+
|
|
20
19
|
export const AddRow = SvgIcon((props) => (
|
|
21
|
-
<
|
|
20
|
+
<StyledPath
|
|
22
21
|
{...props}
|
|
23
22
|
d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z"
|
|
24
23
|
/>
|
|
25
24
|
));
|
|
26
25
|
|
|
27
26
|
export const RemoveRow = SvgIcon((props) => (
|
|
28
|
-
<
|
|
27
|
+
<StyledPath
|
|
29
28
|
{...props}
|
|
30
29
|
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
30
|
/>
|
|
32
31
|
));
|
|
33
32
|
|
|
34
33
|
export const AddColumn = SvgIcon((props) => (
|
|
35
|
-
<
|
|
34
|
+
<StyledPath
|
|
36
35
|
{...props}
|
|
37
36
|
d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z"
|
|
38
37
|
/>
|
|
39
38
|
));
|
|
40
39
|
|
|
41
40
|
export const RemoveColumn = SvgIcon((props) => (
|
|
42
|
-
<
|
|
41
|
+
<StyledPath
|
|
43
42
|
{...props}
|
|
44
43
|
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
44
|
/>
|
|
46
45
|
));
|
|
47
46
|
|
|
48
47
|
export const RemoveTable = SvgIcon((props) => (
|
|
49
|
-
<
|
|
48
|
+
<StyledPath
|
|
50
49
|
{...props}
|
|
51
50
|
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
51
|
/>
|
|
@@ -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">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import DialogContent from '@material
|
|
3
|
-
import ArrowBackIos from '@
|
|
4
|
-
import TextField from '@material
|
|
5
|
-
import DialogActions from '@material
|
|
6
|
-
import Button from '@material
|
|
7
|
-
import Dialog from '@material
|
|
2
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
3
|
+
import ArrowBackIos from '@mui/icons-material/ArrowBackIos';
|
|
4
|
+
import TextField from '@mui/material/TextField';
|
|
5
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
import Dialog from '@mui/material/Dialog';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
|
|
10
10
|
export class AltDialog extends React.Component {
|
|
@@ -2,14 +2,32 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import debug from 'debug';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
-
import {
|
|
6
|
-
import classNames from 'classnames';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
7
6
|
|
|
8
7
|
import AltDialog from './AltDialog';
|
|
9
8
|
import { MarkButton } from '../common/toolbar-buttons';
|
|
10
9
|
|
|
11
10
|
const log = debug('@pie-lib:editable-html:plugins:image:image-toolbar');
|
|
12
11
|
|
|
12
|
+
const StyledHolder = styled('div')(({ theme }) => ({
|
|
13
|
+
paddingLeft: theme.spacing.unit,
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const StyledAltText = styled('span', {
|
|
19
|
+
shouldForwardProp: (prop) => !['disabled', 'hasAlignmentButtons'].includes(prop),
|
|
20
|
+
})(({ disabled, hasAlignmentButtons }) => ({
|
|
21
|
+
...(disabled && {
|
|
22
|
+
opacity: 0.5,
|
|
23
|
+
}),
|
|
24
|
+
...(hasAlignmentButtons && {
|
|
25
|
+
borderLeft: '1px solid grey',
|
|
26
|
+
paddingLeft: 8,
|
|
27
|
+
marginLeft: 4,
|
|
28
|
+
}),
|
|
29
|
+
}));
|
|
30
|
+
|
|
13
31
|
const AlignmentButton = ({ alignment, active, onClick }) => {
|
|
14
32
|
return (
|
|
15
33
|
<MarkButton active={active} onToggle={() => onClick(alignment)} label={alignment}>
|
|
@@ -27,7 +45,6 @@ AlignmentButton.propTypes = {
|
|
|
27
45
|
export class ImageToolbar extends React.Component {
|
|
28
46
|
static propTypes = {
|
|
29
47
|
onChange: PropTypes.func.isRequired,
|
|
30
|
-
classes: PropTypes.object.isRequired,
|
|
31
48
|
alignment: PropTypes.string,
|
|
32
49
|
alt: PropTypes.string,
|
|
33
50
|
imageLoaded: PropTypes.bool,
|
|
@@ -57,9 +74,9 @@ export class ImageToolbar extends React.Component {
|
|
|
57
74
|
};
|
|
58
75
|
|
|
59
76
|
render() {
|
|
60
|
-
const {
|
|
77
|
+
const { alignment, imageLoaded, disableImageAlignmentButtons } = this.props;
|
|
61
78
|
return (
|
|
62
|
-
<
|
|
79
|
+
<StyledHolder>
|
|
63
80
|
{!disableImageAlignmentButtons && (
|
|
64
81
|
<>
|
|
65
82
|
<AlignmentButton alignment={'left'} active={alignment === 'left'} onClick={this.onAlignmentClick} />
|
|
@@ -67,34 +84,16 @@ export class ImageToolbar extends React.Component {
|
|
|
67
84
|
<AlignmentButton alignment={'right'} active={alignment === 'right'} onClick={this.onAlignmentClick} />
|
|
68
85
|
</>
|
|
69
86
|
)}
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
[classes.altButton]: !disableImageAlignmentButtons,
|
|
74
|
-
})}
|
|
87
|
+
<StyledAltText
|
|
88
|
+
disabled={!imageLoaded}
|
|
89
|
+
hasAlignmentButtons={!disableImageAlignmentButtons}
|
|
75
90
|
onMouseDown={(event) => imageLoaded && this.renderDialog(event)}
|
|
76
91
|
>
|
|
77
92
|
Alt text
|
|
78
|
-
</
|
|
79
|
-
</
|
|
93
|
+
</StyledAltText>
|
|
94
|
+
</StyledHolder>
|
|
80
95
|
);
|
|
81
96
|
}
|
|
82
97
|
}
|
|
83
98
|
|
|
84
|
-
|
|
85
|
-
holder: {
|
|
86
|
-
paddingLeft: theme.spacing.unit,
|
|
87
|
-
display: 'flex',
|
|
88
|
-
alignItems: 'center',
|
|
89
|
-
},
|
|
90
|
-
disabled: {
|
|
91
|
-
opacity: 0.5,
|
|
92
|
-
},
|
|
93
|
-
altButton: {
|
|
94
|
-
borderLeft: '1px solid grey',
|
|
95
|
-
paddingLeft: 8,
|
|
96
|
-
marginLeft: 4,
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export default withStyles(styles)(ImageToolbar);
|
|
99
|
+
export default ImageToolbar;
|