@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
|
@@ -2,19 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import debug from 'debug';
|
|
4
4
|
import { color } from '@pie-lib/render-ui';
|
|
5
|
-
import {
|
|
6
|
-
import Button from '@material
|
|
7
|
-
import Dialog from '@material
|
|
8
|
-
import MuiTabs from '@material
|
|
9
|
-
import MuiTab from '@material
|
|
10
|
-
import DialogTitle from '@material
|
|
11
|
-
import DialogContent from '@material
|
|
12
|
-
import DialogContentText from '@material
|
|
13
|
-
import DialogActions from '@material
|
|
14
|
-
import TextField from '@material
|
|
15
|
-
import Typography from '@material
|
|
16
|
-
import IconButton from '@material
|
|
17
|
-
import ActionDelete from '@
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
import Dialog from '@mui/material/Dialog';
|
|
8
|
+
import MuiTabs from '@mui/material/Tabs';
|
|
9
|
+
import MuiTab from '@mui/material/Tab';
|
|
10
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
11
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
12
|
+
import DialogContentText from '@mui/material/DialogContentText';
|
|
13
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
14
|
+
import TextField from '@mui/material/TextField';
|
|
15
|
+
import Typography from '@mui/material/Typography';
|
|
16
|
+
import IconButton from '@mui/material/IconButton';
|
|
17
|
+
import ActionDelete from '@mui/icons-material/Delete';
|
|
18
18
|
|
|
19
19
|
const log = debug('@pie-lib:editable-html:plugins:media:dialog');
|
|
20
20
|
|
|
@@ -82,9 +82,38 @@ const tabsTypeMap = {
|
|
|
82
82
|
insertUrl: 'insert-url',
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
const StyledDialog = styled(Dialog)(({ theme }) => ({
|
|
86
|
+
'& .MuiDialog-paper': {
|
|
87
|
+
minWidth: '500px',
|
|
88
|
+
},
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
|
|
92
|
+
padding: 0,
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
const StyledRow = styled('div')(({ theme }) => ({
|
|
96
|
+
display: 'flex',
|
|
97
|
+
flexDirection: 'space-between',
|
|
98
|
+
}));
|
|
99
|
+
|
|
100
|
+
const StyledUploadInput = styled('div')(({ theme }) => ({
|
|
101
|
+
marginTop: theme.spacing(1.5),
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
const StyledInput = styled('input')(({ theme }) => ({}));
|
|
105
|
+
|
|
106
|
+
const StyledError = styled(Typography)(({ theme }) => ({
|
|
107
|
+
marginTop: theme.spacing(1.5),
|
|
108
|
+
color: theme.palette.error.main,
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
const StyledIconButton = styled(IconButton)(({ theme }) => ({
|
|
112
|
+
marginLeft: theme.spacing(1.5),
|
|
113
|
+
}));
|
|
114
|
+
|
|
85
115
|
export class MediaDialog extends React.Component {
|
|
86
116
|
static propTypes = {
|
|
87
|
-
classes: PropTypes.object.isRequired,
|
|
88
117
|
open: PropTypes.bool,
|
|
89
118
|
edit: PropTypes.bool,
|
|
90
119
|
disablePortal: PropTypes.bool,
|
|
@@ -404,7 +433,7 @@ export class MediaDialog extends React.Component {
|
|
|
404
433
|
};
|
|
405
434
|
|
|
406
435
|
render() {
|
|
407
|
-
const {
|
|
436
|
+
const { open, disablePortal, type, edit, uploadSoundSupport } = this.props;
|
|
408
437
|
const {
|
|
409
438
|
ends,
|
|
410
439
|
height,
|
|
@@ -427,10 +456,7 @@ export class MediaDialog extends React.Component {
|
|
|
427
456
|
const showUploadFile = uploadSoundSupport?.add && uploadSoundSupport?.delete && type !== 'video';
|
|
428
457
|
|
|
429
458
|
return (
|
|
430
|
-
<
|
|
431
|
-
classes={{
|
|
432
|
-
paper: classes.paper,
|
|
433
|
-
}}
|
|
459
|
+
<StyledDialog
|
|
434
460
|
disablePortal={disablePortal}
|
|
435
461
|
open={open}
|
|
436
462
|
onClose={() => this.handleDone(false)}
|
|
@@ -439,7 +465,7 @@ export class MediaDialog extends React.Component {
|
|
|
439
465
|
<DialogTitle id="form-dialog-title">Insert {typeMap[type]}</DialogTitle>
|
|
440
466
|
<DialogContent>
|
|
441
467
|
<div>
|
|
442
|
-
<
|
|
468
|
+
<StyledRow>
|
|
443
469
|
<MuiTabs
|
|
444
470
|
indicatorColor="primary"
|
|
445
471
|
value={tabValue}
|
|
@@ -453,7 +479,7 @@ export class MediaDialog extends React.Component {
|
|
|
453
479
|
label={type === 'video' ? 'Insert YouTube, Vimeo, or Google Drive URL' : 'Insert SoundCloud URL'}
|
|
454
480
|
/>
|
|
455
481
|
</MuiTabs>
|
|
456
|
-
</
|
|
482
|
+
</StyledRow>
|
|
457
483
|
{isInsertURL && (
|
|
458
484
|
<div>
|
|
459
485
|
<TextField
|
|
@@ -470,11 +496,7 @@ export class MediaDialog extends React.Component {
|
|
|
470
496
|
fullWidth
|
|
471
497
|
/>
|
|
472
498
|
{type === 'video' && (
|
|
473
|
-
<
|
|
474
|
-
classes={{
|
|
475
|
-
root: classes.properties,
|
|
476
|
-
}}
|
|
477
|
-
>
|
|
499
|
+
<StyledDialogContent>
|
|
478
500
|
<DialogContentText>Video Properties</DialogContentText>
|
|
479
501
|
<TextField
|
|
480
502
|
autoFocus
|
|
@@ -496,7 +518,7 @@ export class MediaDialog extends React.Component {
|
|
|
496
518
|
value={height}
|
|
497
519
|
onChange={this.changeHandler('height')}
|
|
498
520
|
/>
|
|
499
|
-
</
|
|
521
|
+
</StyledDialogContent>
|
|
500
522
|
)}
|
|
501
523
|
{formattedUrl && (
|
|
502
524
|
<iframe
|
|
@@ -510,11 +532,7 @@ export class MediaDialog extends React.Component {
|
|
|
510
532
|
)}
|
|
511
533
|
{type === 'video' && (formattedUrl || updating) && !invalid && (
|
|
512
534
|
<React.Fragment>
|
|
513
|
-
<
|
|
514
|
-
classes={{
|
|
515
|
-
root: classes.properties,
|
|
516
|
-
}}
|
|
517
|
-
>
|
|
535
|
+
<StyledDialogContent>
|
|
518
536
|
<TextField
|
|
519
537
|
autoFocus
|
|
520
538
|
margin="dense"
|
|
@@ -537,24 +555,24 @@ export class MediaDialog extends React.Component {
|
|
|
537
555
|
onChange={this.changeHandler('ends')}
|
|
538
556
|
/>
|
|
539
557
|
)}
|
|
540
|
-
</
|
|
558
|
+
</StyledDialogContent>
|
|
541
559
|
</React.Fragment>
|
|
542
560
|
)}
|
|
543
561
|
</div>
|
|
544
562
|
)}
|
|
545
563
|
{isUploadMedia && (
|
|
546
|
-
<
|
|
564
|
+
<StyledUploadInput>
|
|
547
565
|
<div>
|
|
548
566
|
{fileUpload.url ? (
|
|
549
567
|
<>
|
|
550
|
-
<
|
|
568
|
+
<StyledRow>
|
|
551
569
|
<audio controls="controls" controlsList="nodownload">
|
|
552
570
|
<source type={mimeType} src={fileUpload.url} />
|
|
553
571
|
</audio>
|
|
554
|
-
<
|
|
572
|
+
<StyledIconButton aria-label="delete" onClick={this.handleRemoveFile}>
|
|
555
573
|
<ActionDelete />
|
|
556
|
-
</
|
|
557
|
-
</
|
|
574
|
+
</StyledIconButton>
|
|
575
|
+
</StyledRow>
|
|
558
576
|
{!fileUpload.scheduled && fileUpload.loading ? (
|
|
559
577
|
<Typography variant="subheading">Loading...</Typography>
|
|
560
578
|
) : null}
|
|
@@ -565,15 +583,11 @@ export class MediaDialog extends React.Component {
|
|
|
565
583
|
) : null}
|
|
566
584
|
</>
|
|
567
585
|
) : !fileUpload.loading ? (
|
|
568
|
-
<
|
|
586
|
+
<StyledInput accept="audio/*" onChange={this.handleUploadFile} type="file" />
|
|
569
587
|
) : null}
|
|
570
|
-
{!!fileUpload.error &&
|
|
571
|
-
<Typography className={classes.error} variant="caption">
|
|
572
|
-
{fileUpload.error}
|
|
573
|
-
</Typography>
|
|
574
|
-
)}
|
|
588
|
+
{!!fileUpload.error && <StyledError variant="caption">{fileUpload.error}</StyledError>}
|
|
575
589
|
</div>
|
|
576
|
-
</
|
|
590
|
+
</StyledUploadInput>
|
|
577
591
|
)}
|
|
578
592
|
</div>
|
|
579
593
|
</DialogContent>
|
|
@@ -585,40 +599,9 @@ export class MediaDialog extends React.Component {
|
|
|
585
599
|
{edit ? 'Update' : 'Insert'}
|
|
586
600
|
</Button>
|
|
587
601
|
</DialogActions>
|
|
588
|
-
</
|
|
602
|
+
</StyledDialog>
|
|
589
603
|
);
|
|
590
604
|
}
|
|
591
605
|
}
|
|
592
606
|
|
|
593
|
-
|
|
594
|
-
paper: {
|
|
595
|
-
minWidth: '500px',
|
|
596
|
-
},
|
|
597
|
-
properties: {
|
|
598
|
-
padding: 0,
|
|
599
|
-
},
|
|
600
|
-
row: {
|
|
601
|
-
display: 'flex',
|
|
602
|
-
flexDirection: 'space-between',
|
|
603
|
-
},
|
|
604
|
-
rowItem: {
|
|
605
|
-
marginRight: theme.spacing.unit * 1.5,
|
|
606
|
-
cursor: 'pointer',
|
|
607
|
-
},
|
|
608
|
-
active: {
|
|
609
|
-
color: color.primary(),
|
|
610
|
-
borderBottom: `2px solid ${color.primary()}`,
|
|
611
|
-
},
|
|
612
|
-
uploadInput: {
|
|
613
|
-
marginTop: theme.spacing.unit * 1.5,
|
|
614
|
-
},
|
|
615
|
-
error: {
|
|
616
|
-
marginTop: theme.spacing.unit * 1.5,
|
|
617
|
-
color: theme.palette.error.main,
|
|
618
|
-
},
|
|
619
|
-
deleteIcon: {
|
|
620
|
-
marginLeft: theme.spacing.unit * 1.5,
|
|
621
|
-
},
|
|
622
|
-
});
|
|
623
|
-
|
|
624
|
-
export default withStyles(styles)(MediaDialog);
|
|
607
|
+
export default MediaDialog;
|
|
@@ -1,56 +1,49 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
|
|
15
|
-
},
|
|
16
|
-
editContainer: {
|
|
17
|
-
cursor: 'pointer',
|
|
18
|
-
flex: 3,
|
|
19
|
-
border: `solid ${theme.palette.common.black}`,
|
|
20
|
-
textAlign: 'right',
|
|
21
|
-
borderWidth: '0 2px 0 0',
|
|
22
|
-
marginRight: '5px',
|
|
23
|
-
paddingRight: '5px',
|
|
24
|
-
},
|
|
25
|
-
removeContainer: {
|
|
26
|
-
cursor: 'pointer',
|
|
27
|
-
},
|
|
5
|
+
const StyledRoot = styled('span')(({ theme }) => ({
|
|
6
|
+
position: 'relative',
|
|
7
|
+
bottom: '5px',
|
|
8
|
+
left: 0,
|
|
9
|
+
width: '100%',
|
|
10
|
+
background: theme.palette.common.white,
|
|
11
|
+
display: 'inline-flex',
|
|
12
|
+
padding: '5px',
|
|
13
|
+
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
|
|
28
14
|
}));
|
|
29
15
|
|
|
16
|
+
const StyledEditContainer = styled('span')(({ theme }) => ({
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
flex: 3,
|
|
19
|
+
border: `solid ${theme.palette.common.black}`,
|
|
20
|
+
textAlign: 'right',
|
|
21
|
+
borderWidth: '0 2px 0 0',
|
|
22
|
+
marginRight: '5px',
|
|
23
|
+
paddingRight: '5px',
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
const StyledRemoveContainer = styled('span')({
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
30
|
class MediaToolbar extends React.Component {
|
|
31
31
|
static propTypes = {
|
|
32
|
-
classes: PropTypes.object,
|
|
33
32
|
onEdit: PropTypes.func,
|
|
34
33
|
hideEdit: PropTypes.bool,
|
|
35
34
|
onRemove: PropTypes.func,
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
render() {
|
|
39
|
-
const {
|
|
38
|
+
const { hideEdit, onEdit, onRemove } = this.props;
|
|
40
39
|
|
|
41
40
|
return (
|
|
42
|
-
<
|
|
43
|
-
{hideEdit ? null :
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</span>
|
|
47
|
-
)}
|
|
48
|
-
<span className={classes.removeContainer} onClick={onRemove}>
|
|
49
|
-
Remove
|
|
50
|
-
</span>
|
|
51
|
-
</span>
|
|
41
|
+
<StyledRoot>
|
|
42
|
+
{hideEdit ? null : <StyledEditContainer onClick={onEdit}>Edit Settings</StyledEditContainer>}
|
|
43
|
+
<StyledRemoveContainer onClick={onRemove}>Remove</StyledRemoveContainer>
|
|
44
|
+
</StyledRoot>
|
|
52
45
|
);
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
export default
|
|
49
|
+
export default MediaToolbar;
|
|
@@ -1,43 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
editor
|
|
5
|
+
const StyledWrapper = styled('span', {
|
|
6
|
+
shouldForwardProp: (prop) => prop !== 'editor',
|
|
7
|
+
})(({ editor }) => ({
|
|
8
|
+
position: 'relative',
|
|
9
|
+
...(editor && {
|
|
11
10
|
display: 'inline-block',
|
|
12
11
|
overflow: 'hidden',
|
|
13
|
-
},
|
|
12
|
+
}),
|
|
14
13
|
}));
|
|
15
14
|
|
|
16
15
|
class MediaWrapper extends React.Component {
|
|
17
16
|
static propTypes = {
|
|
18
|
-
classes: PropTypes.object,
|
|
19
17
|
children: PropTypes.array,
|
|
20
18
|
editor: PropTypes.bool,
|
|
21
19
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
render() {
|
|
25
|
-
const { editor,
|
|
23
|
+
const { editor, children, width, ...rest } = this.props;
|
|
26
24
|
|
|
27
25
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
[classes.editor]: editor,
|
|
31
|
-
})}
|
|
26
|
+
<StyledWrapper
|
|
27
|
+
editor={editor}
|
|
32
28
|
{...rest}
|
|
33
29
|
style={{
|
|
34
30
|
width: width || 300,
|
|
35
31
|
}}
|
|
36
32
|
>
|
|
37
33
|
{children}
|
|
38
|
-
</
|
|
34
|
+
</StyledWrapper>
|
|
39
35
|
);
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
|
|
43
|
-
export default
|
|
39
|
+
export default MediaWrapper;
|
|
@@ -10,17 +10,17 @@ export const onValueChange = (editor, node, pos, choice) => {
|
|
|
10
10
|
// Merge old and new attributes
|
|
11
11
|
tr.setNodeMarkup(pos, undefined, {
|
|
12
12
|
...node.attrs,
|
|
13
|
-
...choice,
|
|
13
|
+
...choice.value,
|
|
14
14
|
});
|
|
15
15
|
tr.isDone = true;
|
|
16
16
|
editor.view.dispatch(tr);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const onRemoveResponse = (editor, node,
|
|
19
|
+
export const onRemoveResponse = (editor, node, choice) => {
|
|
20
20
|
const { tr } = editor.state;
|
|
21
21
|
|
|
22
22
|
// Merge old and new attributes
|
|
23
|
-
tr.setNodeMarkup(pos, undefined, omit(node.attrs, ['value', 'id']));
|
|
23
|
+
tr.setNodeMarkup(choice.pos, undefined, omit(node.attrs, ['value', 'id']));
|
|
24
24
|
tr.isDone = true;
|
|
25
25
|
editor.view.dispatch(tr);
|
|
26
26
|
};
|
|
@@ -49,10 +49,11 @@ const DragDrop = (props) => {
|
|
|
49
49
|
n={attributes}
|
|
50
50
|
dragKey={attributes.id}
|
|
51
51
|
targetId="0"
|
|
52
|
+
pos={pos}
|
|
52
53
|
value={attributes}
|
|
53
54
|
duplicates={options.duplicates}
|
|
54
55
|
onChange={(choice) => onValueChange(editor, node, pos, choice)}
|
|
55
|
-
removeResponse={() => onRemoveResponse(editor, node,
|
|
56
|
+
removeResponse={(choice) => onRemoveResponse(editor, node, choice)}
|
|
56
57
|
></DragDropTile>
|
|
57
58
|
</span>
|
|
58
59
|
</NodeViewWrapper>
|