@pie-lib/editable-html-tip-tap 0.1.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/dist/components/CharacterPicker.d.ts +31 -0
- package/dist/components/CharacterPicker.d.ts.map +1 -0
- package/dist/components/CharacterPicker.js +129 -0
- package/dist/components/EditableHtml.d.ts +11 -0
- package/dist/components/EditableHtml.d.ts.map +1 -0
- package/dist/components/EditableHtml.js +270 -0
- package/dist/components/MenuBar.d.ts +11 -0
- package/dist/components/MenuBar.d.ts.map +1 -0
- package/dist/components/MenuBar.js +460 -0
- package/dist/components/TiptapContainer.d.ts +11 -0
- package/dist/components/TiptapContainer.d.ts.map +1 -0
- package/dist/components/TiptapContainer.js +157 -0
- package/dist/components/characters/characterUtils.d.ts +36 -0
- package/dist/components/characters/characterUtils.d.ts.map +1 -0
- package/dist/components/characters/characterUtils.js +465 -0
- package/dist/components/characters/custom-popper.d.ts +14 -0
- package/dist/components/characters/custom-popper.d.ts.map +1 -0
- package/dist/components/characters/custom-popper.js +32 -0
- package/dist/components/common/done-button.d.ts +30 -0
- package/dist/components/common/done-button.d.ts.map +1 -0
- package/dist/components/common/done-button.js +26 -0
- package/dist/components/common/toolbar-buttons.d.ts +39 -0
- package/dist/components/common/toolbar-buttons.d.ts.map +1 -0
- package/dist/components/common/toolbar-buttons.js +91 -0
- package/dist/components/icons/CssIcon.d.ts +11 -0
- package/dist/components/icons/CssIcon.d.ts.map +1 -0
- package/dist/components/icons/CssIcon.js +14 -0
- package/dist/components/icons/RespArea.d.ts +26 -0
- package/dist/components/icons/RespArea.d.ts.map +1 -0
- package/dist/components/icons/RespArea.js +42 -0
- package/dist/components/icons/TableIcons.d.ts +14 -0
- package/dist/components/icons/TableIcons.d.ts.map +1 -0
- package/dist/components/icons/TableIcons.js +32 -0
- package/dist/components/icons/TextAlign.d.ts +18 -0
- package/dist/components/icons/TextAlign.d.ts.map +1 -0
- package/dist/components/icons/TextAlign.js +134 -0
- package/dist/components/image/AltDialog.d.ts +23 -0
- package/dist/components/image/AltDialog.d.ts.map +1 -0
- package/dist/components/image/AltDialog.js +61 -0
- package/dist/components/image/ImageToolbar.d.ts +25 -0
- package/dist/components/image/ImageToolbar.d.ts.map +1 -0
- package/dist/components/image/ImageToolbar.js +80 -0
- package/dist/components/image/InsertImageHandler.d.ts +33 -0
- package/dist/components/image/InsertImageHandler.d.ts.map +1 -0
- package/dist/components/image/InsertImageHandler.js +55 -0
- package/dist/components/media/MediaDialog.d.ts +44 -0
- package/dist/components/media/MediaDialog.d.ts.map +1 -0
- package/dist/components/media/MediaDialog.js +389 -0
- package/dist/components/media/MediaToolbar.d.ts +20 -0
- package/dist/components/media/MediaToolbar.d.ts.map +1 -0
- package/dist/components/media/MediaToolbar.js +41 -0
- package/dist/components/media/MediaWrapper.d.ts +20 -0
- package/dist/components/media/MediaWrapper.d.ts.map +1 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +23 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts.map +1 -0
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +58 -0
- package/dist/components/respArea/DragInTheBlank/choice.d.ts +56 -0
- package/dist/components/respArea/DragInTheBlank/choice.d.ts.map +1 -0
- package/dist/components/respArea/DragInTheBlank/choice.js +156 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts.map +1 -0
- package/dist/components/respArea/ExplicitConstructedResponse.js +67 -0
- package/dist/components/respArea/InlineDropdown.d.ts +18 -0
- package/dist/components/respArea/InlineDropdown.d.ts.map +1 -0
- package/dist/components/respArea/InlineDropdown.js +91 -0
- package/dist/components/respArea/MathTemplated.d.ts +19 -0
- package/dist/components/respArea/MathTemplated.d.ts.map +1 -0
- package/dist/components/respArea/MathTemplated.js +97 -0
- package/dist/components/respArea/ToolbarIcon.d.ts +14 -0
- package/dist/components/respArea/ToolbarIcon.d.ts.map +1 -0
- package/dist/components/respArea/ToolbarIcon.js +17 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/extensions/css.d.ts +12 -0
- package/dist/extensions/css.d.ts.map +1 -0
- package/dist/extensions/css.js +115 -0
- package/dist/extensions/custom-toolbar-wrapper.d.ts +11 -0
- package/dist/extensions/custom-toolbar-wrapper.d.ts.map +1 -0
- package/dist/extensions/custom-toolbar-wrapper.js +58 -0
- package/dist/extensions/div-node.d.ts +11 -0
- package/dist/extensions/div-node.d.ts.map +1 -0
- package/dist/extensions/div-node.js +25 -0
- package/dist/extensions/extended-table.d.ts +11 -0
- package/dist/extensions/extended-table.d.ts.map +1 -0
- package/dist/extensions/extended-table.js +15 -0
- package/dist/extensions/image-component.d.ts +22 -0
- package/dist/extensions/image-component.d.ts.map +1 -0
- package/dist/extensions/image-component.js +200 -0
- package/dist/extensions/image.d.ts +11 -0
- package/dist/extensions/image.d.ts.map +1 -0
- package/dist/extensions/image.js +42 -0
- package/dist/extensions/index.d.ts +17 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +65 -0
- package/dist/extensions/math.d.ts +15 -0
- package/dist/extensions/math.d.ts.map +1 -0
- package/dist/extensions/math.js +150 -0
- package/dist/extensions/media.d.ts +19 -0
- package/dist/extensions/media.d.ts.map +1 -0
- package/dist/extensions/media.js +147 -0
- package/dist/extensions/responseArea.d.ts +28 -0
- package/dist/extensions/responseArea.d.ts.map +1 -0
- package/dist/extensions/responseArea.js +259 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/styles/editorContainerStyles.d.ts +135 -0
- package/dist/styles/editorContainerStyles.d.ts.map +1 -0
- package/dist/theme.d.ts +10 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/utils/helper.d.ts +10 -0
- package/dist/utils/helper.d.ts.map +1 -0
- package/dist/utils/helper.js +7 -0
- package/dist/utils/size.d.ts +10 -0
- package/dist/utils/size.d.ts.map +1 -0
- package/dist/utils/size.js +14 -0
- package/package.json +71 -0
- package/src/components/CharacterPicker.tsx +210 -0
- package/src/components/EditableHtml.tsx +416 -0
- package/src/components/MenuBar.tsx +558 -0
- package/src/components/TiptapContainer.tsx +228 -0
- package/src/components/characters/characterUtils.ts +457 -0
- package/src/components/characters/custom-popper.tsx +48 -0
- package/src/components/common/done-button.tsx +37 -0
- package/src/components/common/toolbar-buttons.tsx +132 -0
- package/src/components/icons/CssIcon.tsx +25 -0
- package/src/components/icons/RespArea.tsx +81 -0
- package/src/components/icons/TableIcons.tsx +62 -0
- package/src/components/icons/TextAlign.tsx +124 -0
- package/src/components/image/AltDialog.tsx +92 -0
- package/src/components/image/ImageToolbar.tsx +109 -0
- package/src/components/image/InsertImageHandler.ts +121 -0
- package/src/components/media/MediaDialog.tsx +606 -0
- package/src/components/media/MediaToolbar.tsx +59 -0
- package/src/components/media/MediaWrapper.tsx +49 -0
- package/src/components/respArea/DragInTheBlank/DragInTheBlank.tsx +86 -0
- package/src/components/respArea/DragInTheBlank/choice.tsx +266 -0
- package/src/components/respArea/ExplicitConstructedResponse.tsx +122 -0
- package/src/components/respArea/InlineDropdown.tsx +152 -0
- package/src/components/respArea/MathTemplated.tsx +134 -0
- package/src/components/respArea/ToolbarIcon.tsx +76 -0
- package/src/constants.ts +15 -0
- package/src/extensions/css.tsx +230 -0
- package/src/extensions/custom-toolbar-wrapper.tsx +88 -0
- package/src/extensions/div-node.tsx +46 -0
- package/src/extensions/extended-table.ts +34 -0
- package/src/extensions/image-component.tsx +303 -0
- package/src/extensions/image.tsx +64 -0
- package/src/extensions/index.tsx +91 -0
- package/src/extensions/math.tsx +285 -0
- package/src/extensions/media.tsx +198 -0
- package/src/extensions/responseArea.tsx +404 -0
- package/src/index.tsx +15 -0
- package/src/styles/editorContainerStyles.ts +155 -0
- package/src/theme.ts +11 -0
- package/src/utils/helper.tsx +27 -0
- package/src/utils/size.ts +42 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/characters/custom-popper.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { styled } from '@mui/material/styles';
|
|
13
|
+
import Popper from '@mui/material/Popper';
|
|
14
|
+
import Typography from '@mui/material/Typography';
|
|
15
|
+
|
|
16
|
+
const StyledPopper: any = styled(Popper)({
|
|
17
|
+
background: '#fff',
|
|
18
|
+
padding: '10px',
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
zIndex: 99999,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const StyledTypography: any = styled(Typography)({
|
|
24
|
+
fontSize: 50,
|
|
25
|
+
textAlign: 'center',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const CustomPopper = ({ children, ...props }) => (
|
|
29
|
+
<StyledPopper
|
|
30
|
+
id="mouse-over-popover"
|
|
31
|
+
open
|
|
32
|
+
anchorOrigin={{
|
|
33
|
+
vertical: 'bottom',
|
|
34
|
+
horizontal: 'left',
|
|
35
|
+
}}
|
|
36
|
+
transformOrigin={{
|
|
37
|
+
vertical: 'top',
|
|
38
|
+
horizontal: 'left',
|
|
39
|
+
}}
|
|
40
|
+
disableRestoreFocus
|
|
41
|
+
disableAutoFocus
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<StyledTypography>{children}</StyledTypography>
|
|
45
|
+
</StyledPopper>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export default CustomPopper;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/common/done-button.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
import IconButton from '@mui/material/IconButton';
|
|
14
|
+
import Check from '@mui/icons-material/Check';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import PropTypes from 'prop-types';
|
|
17
|
+
|
|
18
|
+
const StyledIconButton: any = styled(IconButton)({
|
|
19
|
+
verticalAlign: 'top',
|
|
20
|
+
width: '28px',
|
|
21
|
+
height: '28px',
|
|
22
|
+
color: 'var(--editable-html-toolbar-check, #00bb00)',
|
|
23
|
+
padding: '4px',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const RawDoneButton = ({ onClick, doneButtonRef }) => (
|
|
27
|
+
<StyledIconButton aria-label="Done" buttonRef={doneButtonRef} onClick={onClick}>
|
|
28
|
+
<Check />
|
|
29
|
+
</StyledIconButton>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
RawDoneButton.propTypes = {
|
|
33
|
+
onClick: PropTypes.func,
|
|
34
|
+
doneButtonRef: PropTypes.func,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const DoneButton = RawDoneButton;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/common/toolbar-buttons.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import debug from 'debug';
|
|
13
|
+
import { styled } from '@mui/material/styles';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
15
|
+
|
|
16
|
+
const StyledButton: any = styled('button', {
|
|
17
|
+
shouldForwardProp: (prop) => !['active', 'disabled', 'extraStyles'].includes(prop),
|
|
18
|
+
})(({ theme, active, disabled }) => ({
|
|
19
|
+
color: active ? 'black' : 'grey',
|
|
20
|
+
display: 'inline-flex',
|
|
21
|
+
padding: '2px',
|
|
22
|
+
background: 'none',
|
|
23
|
+
border: 'none',
|
|
24
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
25
|
+
'&:hover': {
|
|
26
|
+
color: disabled ? 'grey' : 'black',
|
|
27
|
+
},
|
|
28
|
+
'&:focus': {
|
|
29
|
+
outline: `2px solid ${theme.palette.grey[700]}`,
|
|
30
|
+
},
|
|
31
|
+
...(disabled && {
|
|
32
|
+
opacity: 0.7,
|
|
33
|
+
}),
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
const log = debug('pie-elements:editable-html:raw-button');
|
|
37
|
+
|
|
38
|
+
export class RawButton extends React.Component {
|
|
39
|
+
static propTypes = {
|
|
40
|
+
onClick: PropTypes.func.isRequired,
|
|
41
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
42
|
+
active: PropTypes.bool,
|
|
43
|
+
disabled: PropTypes.bool,
|
|
44
|
+
extraStyles: PropTypes.object,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
constructor(props) {
|
|
48
|
+
super(props);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onClick: any = (e) => {
|
|
52
|
+
log('[onClick]');
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
const { onClick } = this.props;
|
|
55
|
+
onClick(e);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
onKeyDown: any = (e) => {
|
|
59
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
60
|
+
log('[onKeyDown]');
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
const { onClick } = this.props;
|
|
63
|
+
onClick(e);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
render() {
|
|
68
|
+
const { active, children, disabled, extraStyles, ariaLabel } = this.props;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<StyledButton
|
|
72
|
+
style={extraStyles}
|
|
73
|
+
active={active}
|
|
74
|
+
disabled={disabled}
|
|
75
|
+
onMouseDown={this.onClick}
|
|
76
|
+
onKeyDown={this.onKeyDown}
|
|
77
|
+
aria-label={ariaLabel}
|
|
78
|
+
aria-pressed={active}
|
|
79
|
+
tabIndex={0}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</StyledButton>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const Button = RawButton;
|
|
88
|
+
|
|
89
|
+
export class RawMarkButton extends React.Component {
|
|
90
|
+
static propTypes = {
|
|
91
|
+
onToggle: PropTypes.func.isRequired,
|
|
92
|
+
mark: PropTypes.string,
|
|
93
|
+
label: PropTypes.string.isRequired,
|
|
94
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
95
|
+
active: PropTypes.bool,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
constructor(props) {
|
|
99
|
+
super(props);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
onToggle: any = (e) => {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
this.props.onToggle(this.props.mark);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
onKeyDown: any = (e) => {
|
|
108
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
this.props.onToggle(this.props.mark);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
render() {
|
|
115
|
+
const { children, active, label } = this.props;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<StyledButton
|
|
119
|
+
active={active}
|
|
120
|
+
onMouseDown={this.onToggle}
|
|
121
|
+
aria-pressed={active}
|
|
122
|
+
onKeyDown={this.onKeyDown}
|
|
123
|
+
aria-label={label}
|
|
124
|
+
tabIndex={0}
|
|
125
|
+
>
|
|
126
|
+
{children}
|
|
127
|
+
</StyledButton>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const MarkButton = RawMarkButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/icons/CssIcon.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { styled } from '@mui/material/styles';
|
|
13
|
+
|
|
14
|
+
const StyledCssIcon: any = styled('div')(({ theme }) => ({
|
|
15
|
+
fontFamily: 'Cerebri Sans, Arial, sans-serif',
|
|
16
|
+
fontSize: theme.typography.fontSize,
|
|
17
|
+
fontWeight: 'bold',
|
|
18
|
+
lineHeight: '14px',
|
|
19
|
+
position: 'relative',
|
|
20
|
+
whiteSpace: 'nowrap',
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const CssIcon = () => <StyledCssIcon>CSS</StyledCssIcon>;
|
|
24
|
+
|
|
25
|
+
export default CssIcon;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/icons/RespArea.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import ChevronRight from '@mui/icons-material/ChevronRight';
|
|
14
|
+
import MoreVert from '@mui/icons-material/MoreVert';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
|
|
17
|
+
const getRotate = (direction) => {
|
|
18
|
+
switch (direction) {
|
|
19
|
+
case 'down':
|
|
20
|
+
return 90;
|
|
21
|
+
|
|
22
|
+
case 'up':
|
|
23
|
+
return -90;
|
|
24
|
+
|
|
25
|
+
case 'left':
|
|
26
|
+
return 180;
|
|
27
|
+
|
|
28
|
+
default:
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Chevron = (props) => {
|
|
34
|
+
const { direction, style } = props;
|
|
35
|
+
const rotate = getRotate(direction);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<ChevronRight
|
|
39
|
+
style={{
|
|
40
|
+
transform: `rotate(${rotate}deg)`,
|
|
41
|
+
...style,
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
Chevron.propTypes = {
|
|
48
|
+
direction: PropTypes.string,
|
|
49
|
+
style: PropTypes.object,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const GripIcon = ({ style }) => {
|
|
53
|
+
return (
|
|
54
|
+
<span style={style}>
|
|
55
|
+
<MoreVert
|
|
56
|
+
style={{
|
|
57
|
+
margin: '0 -16px',
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
<MoreVert />
|
|
61
|
+
</span>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
GripIcon.propTypes = {
|
|
66
|
+
style: PropTypes.object,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const StyledToolbarIcon: any = styled('div')(({ theme }) => ({
|
|
70
|
+
fontFamily: 'Cerebri Sans !important',
|
|
71
|
+
fontSize: theme.typography.fontSize,
|
|
72
|
+
fontWeight: 'bold',
|
|
73
|
+
lineHeight: '14px',
|
|
74
|
+
position: 'relative',
|
|
75
|
+
top: '7px',
|
|
76
|
+
width: '110px',
|
|
77
|
+
height: '28px',
|
|
78
|
+
whiteSpace: 'nowrap',
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
export const ToolbarIcon = () => <StyledToolbarIcon>+ Response Area</StyledToolbarIcon>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/icons/TableIcons.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { styled } from '@mui/material/styles';
|
|
13
|
+
|
|
14
|
+
const StyledPath: any = styled('path')({
|
|
15
|
+
fill: 'grey',
|
|
16
|
+
'&:hover': {
|
|
17
|
+
fill: 'black',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const SvgIcon = (Component) => {
|
|
22
|
+
return (props) => (
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="24" height="24" viewBox="0 0 24 24">
|
|
24
|
+
<Component {...props} />
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const AddRow = SvgIcon((props) => (
|
|
30
|
+
<StyledPath
|
|
31
|
+
{...props}
|
|
32
|
+
d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z"
|
|
33
|
+
/>
|
|
34
|
+
));
|
|
35
|
+
|
|
36
|
+
export const RemoveRow = SvgIcon((props) => (
|
|
37
|
+
<StyledPath
|
|
38
|
+
{...props}
|
|
39
|
+
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"
|
|
40
|
+
/>
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
export const AddColumn = SvgIcon((props) => (
|
|
44
|
+
<StyledPath
|
|
45
|
+
{...props}
|
|
46
|
+
d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z"
|
|
47
|
+
/>
|
|
48
|
+
));
|
|
49
|
+
|
|
50
|
+
export const RemoveColumn = SvgIcon((props) => (
|
|
51
|
+
<StyledPath
|
|
52
|
+
{...props}
|
|
53
|
+
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"
|
|
54
|
+
/>
|
|
55
|
+
));
|
|
56
|
+
|
|
57
|
+
export const RemoveTable = SvgIcon((props) => (
|
|
58
|
+
<StyledPath
|
|
59
|
+
{...props}
|
|
60
|
+
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"
|
|
61
|
+
/>
|
|
62
|
+
));
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/icons/TextAlign.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import Collapse from '@mui/material/Collapse';
|
|
13
|
+
import List from '@mui/material/List';
|
|
14
|
+
import ListItem from '@mui/material/ListItem';
|
|
15
|
+
|
|
16
|
+
export const AlignLeft = () => (
|
|
17
|
+
<svg width="20" height="20" viewBox="0 0 66 66" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
18
|
+
<path
|
|
19
|
+
d="M42.1875 4.75C42.1875 7.38672 39.9902 9.4375 37.5 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H37.5C39.9902 0.0625 42.1875 2.25977 42.1875 4.75ZM42.1875 42.25C42.1875 44.8867 39.9902 46.9375 37.5 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H37.5C39.9902 37.5625 42.1875 39.7598 42.1875 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z"
|
|
20
|
+
fill="currentColor"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const AlignRight = () => (
|
|
26
|
+
<svg width="20" height="20" viewBox="0 0 66 66" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
27
|
+
<path
|
|
28
|
+
d="M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H28.125C25.4883 9.4375 23.4375 7.38672 23.4375 4.75C23.4375 2.25977 25.4883 0.0625 28.125 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H28.125C25.4883 46.9375 23.4375 44.8867 23.4375 42.25C23.4375 39.7598 25.4883 37.5625 28.125 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z"
|
|
29
|
+
fill="currentColor"
|
|
30
|
+
/>
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const AlignCenter = () => (
|
|
35
|
+
<svg width="20" height="20" viewBox="0 0 66 66" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
36
|
+
<path
|
|
37
|
+
d="M51.5625 4.75C51.5625 7.38672 49.3652 9.4375 46.875 9.4375H18.75C16.1133 9.4375 14.0625 7.38672 14.0625 4.75C14.0625 2.25977 16.1133 0.0625 18.75 0.0625H46.875C49.3652 0.0625 51.5625 2.25977 51.5625 4.75ZM65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5ZM0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61ZM51.5625 42.25C51.5625 44.8867 49.3652 46.9375 46.875 46.9375H18.75C16.1133 46.9375 14.0625 44.8867 14.0625 42.25C14.0625 39.7598 16.1133 37.5625 18.75 37.5625H46.875C49.3652 37.5625 51.5625 39.7598 51.5625 42.25Z"
|
|
38
|
+
fill="currentColor"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const AlignJustify = () => (
|
|
44
|
+
<svg width="20" height="20" viewBox="0 0 66 66" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
45
|
+
<path
|
|
46
|
+
d="M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z"
|
|
47
|
+
fill="currentColor"
|
|
48
|
+
/>
|
|
49
|
+
</svg>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export default ({ editor, onChange }) => {
|
|
53
|
+
const [open, setOpen] = useState(false);
|
|
54
|
+
|
|
55
|
+
let icon;
|
|
56
|
+
|
|
57
|
+
switch (true) {
|
|
58
|
+
case editor.isActive({ textAlign: 'right' }):
|
|
59
|
+
icon = <AlignRight />;
|
|
60
|
+
break;
|
|
61
|
+
case editor.isActive({ textAlign: 'center' }):
|
|
62
|
+
icon = <AlignCenter />;
|
|
63
|
+
break;
|
|
64
|
+
case editor.isActive({ textAlign: 'justify' }):
|
|
65
|
+
icon = <AlignJustify />;
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
icon = <AlignLeft />;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const applyAlignment = (event) => {
|
|
73
|
+
const alignType = event.currentTarget?.getAttribute('value');
|
|
74
|
+
|
|
75
|
+
if (alignType) {
|
|
76
|
+
editor.commands.setTextAlign(alignType);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
setOpen(false);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const onMouseDown = (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
setOpen(!open);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div>
|
|
90
|
+
<div style={{ display: 'flex', alignItems: 'center' }} onClick={onMouseDown}>
|
|
91
|
+
{icon}
|
|
92
|
+
<span style={{ marginLeft: '5px', fontSize: '8px' }}>▼</span>
|
|
93
|
+
</div>
|
|
94
|
+
<Collapse in={open} timeout="auto" unmountOnExit style={{ position: 'absolute' }}>
|
|
95
|
+
<List
|
|
96
|
+
component="div"
|
|
97
|
+
disablePadding
|
|
98
|
+
style={{
|
|
99
|
+
background: '#fff',
|
|
100
|
+
display: 'flex',
|
|
101
|
+
flexDirection: 'row',
|
|
102
|
+
padding: 0,
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
<ListItem button type="submit" value="left" aria-label="Align text left" onClick={applyAlignment}>
|
|
106
|
+
<AlignLeft />
|
|
107
|
+
</ListItem>
|
|
108
|
+
|
|
109
|
+
<ListItem button type="submit" value="center" aria-label="Align text center" onClick={applyAlignment}>
|
|
110
|
+
<AlignCenter />
|
|
111
|
+
</ListItem>
|
|
112
|
+
|
|
113
|
+
<ListItem button type="submit" value="right" aria-label="Align text right" onClick={applyAlignment}>
|
|
114
|
+
<AlignRight />
|
|
115
|
+
</ListItem>
|
|
116
|
+
|
|
117
|
+
<ListItem button type="submit" value="justify" aria-label="Justify text" onClick={applyAlignment}>
|
|
118
|
+
<AlignJustify />
|
|
119
|
+
</ListItem>
|
|
120
|
+
</List>
|
|
121
|
+
</Collapse>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/editable-html-tip-tap/src/components/image/AltDialog.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
13
|
+
import ArrowBackIos from '@mui/icons-material/ArrowBackIos';
|
|
14
|
+
import TextField from '@mui/material/TextField';
|
|
15
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
16
|
+
import Button from '@mui/material/Button';
|
|
17
|
+
import Dialog from '@mui/material/Dialog';
|
|
18
|
+
import PropTypes from 'prop-types';
|
|
19
|
+
|
|
20
|
+
export class AltDialog extends React.Component {
|
|
21
|
+
static propTypes = {
|
|
22
|
+
onDone: PropTypes.func.isRequired,
|
|
23
|
+
alt: PropTypes.string,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
|
|
29
|
+
const { alt } = props;
|
|
30
|
+
|
|
31
|
+
this.state = {
|
|
32
|
+
value: alt,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
closeDialog: any = () => {
|
|
37
|
+
const allDialogs = document.querySelectorAll('#text-dialog');
|
|
38
|
+
|
|
39
|
+
allDialogs.forEach(function (s) {
|
|
40
|
+
return s.remove();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
onDone: any = () => {
|
|
45
|
+
const { onDone } = this.props;
|
|
46
|
+
const { value } = this.state;
|
|
47
|
+
|
|
48
|
+
onDone(value);
|
|
49
|
+
this.closeDialog();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
handleOverflow: any = () => {
|
|
53
|
+
document.body.style.removeProperty('overflow');
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
render() {
|
|
57
|
+
const { value } = this.state;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Dialog
|
|
61
|
+
open
|
|
62
|
+
disablePortal
|
|
63
|
+
onClose={this.closeDialog}
|
|
64
|
+
id="text-dialog"
|
|
65
|
+
hideBackdrop
|
|
66
|
+
disableScrollLock
|
|
67
|
+
onEntered={this.handleOverflow}
|
|
68
|
+
>
|
|
69
|
+
<DialogContent>
|
|
70
|
+
<div style={{ display: 'flex' }}>
|
|
71
|
+
<ArrowBackIos style={{ paddingTop: '6px' }} />
|
|
72
|
+
<TextField
|
|
73
|
+
multiline
|
|
74
|
+
placeholder={'Enter an Alt Text description of this image'}
|
|
75
|
+
helperText={
|
|
76
|
+
'Users with visual limitations rely on Alt Text, since screen readers cannot otherwise describe the contents of an image.'
|
|
77
|
+
}
|
|
78
|
+
value={value}
|
|
79
|
+
onChange={(event) => this.setState({ value: event.target.value })}
|
|
80
|
+
FormHelperTextProps={{ style: { fontSize: 14 } }}
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</DialogContent>
|
|
84
|
+
<DialogActions>
|
|
85
|
+
<Button onClick={this.onDone}>Done</Button>
|
|
86
|
+
</DialogActions>
|
|
87
|
+
</Dialog>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default AltDialog;
|