@pie-lib/editable-html-tip-tap 1.0.20 → 1.0.21-next.6057

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.
Files changed (103) hide show
  1. package/CHANGELOG.md +7 -73
  2. package/LICENSE.md +5 -0
  3. package/NEXT.CHANGELOG.json +1 -0
  4. package/lib/components/CharacterPicker.js +20 -60
  5. package/lib/components/CharacterPicker.js.map +1 -1
  6. package/lib/components/EditableHtml.js +50 -121
  7. package/lib/components/EditableHtml.js.map +1 -1
  8. package/lib/components/MenuBar.js +96 -128
  9. package/lib/components/MenuBar.js.map +1 -1
  10. package/lib/components/TiptapContainer.js +162 -45
  11. package/lib/components/TiptapContainer.js.map +1 -1
  12. package/lib/components/characters/characterUtils.js +4 -7
  13. package/lib/components/characters/characterUtils.js.map +1 -1
  14. package/lib/components/characters/custom-popper.js +22 -51
  15. package/lib/components/characters/custom-popper.js.map +1 -1
  16. package/lib/components/common/done-button.js +17 -36
  17. package/lib/components/common/done-button.js.map +1 -1
  18. package/lib/components/common/toolbar-buttons.js +57 -107
  19. package/lib/components/common/toolbar-buttons.js.map +1 -1
  20. package/lib/components/icons/CssIcon.js +14 -26
  21. package/lib/components/icons/CssIcon.js.map +1 -1
  22. package/lib/components/icons/RespArea.js +23 -46
  23. package/lib/components/icons/RespArea.js.map +1 -1
  24. package/lib/components/icons/TableIcons.js +20 -36
  25. package/lib/components/icons/TableIcons.js.map +1 -1
  26. package/lib/components/icons/TextAlign.js +16 -53
  27. package/lib/components/icons/TextAlign.js.map +1 -1
  28. package/lib/components/image/AltDialog.js +18 -49
  29. package/lib/components/image/AltDialog.js.map +1 -1
  30. package/lib/components/image/ImageToolbar.js +50 -90
  31. package/lib/components/image/ImageToolbar.js.map +1 -1
  32. package/lib/components/image/InsertImageHandler.js +17 -35
  33. package/lib/components/image/InsertImageHandler.js.map +1 -1
  34. package/lib/components/media/MediaDialog.js +195 -309
  35. package/lib/components/media/MediaDialog.js.map +1 -1
  36. package/lib/components/media/MediaToolbar.js +39 -66
  37. package/lib/components/media/MediaToolbar.js.map +1 -1
  38. package/lib/components/media/MediaWrapper.js +30 -56
  39. package/lib/components/media/MediaWrapper.js.map +1 -1
  40. package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js +21 -36
  41. package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js.map +1 -1
  42. package/lib/components/respArea/DragInTheBlank/choice.js +215 -262
  43. package/lib/components/respArea/DragInTheBlank/choice.js.map +1 -1
  44. package/lib/components/respArea/ExplicitConstructedResponse.js +11 -33
  45. package/lib/components/respArea/ExplicitConstructedResponse.js.map +1 -1
  46. package/lib/components/respArea/InlineDropdown.js +19 -41
  47. package/lib/components/respArea/InlineDropdown.js.map +1 -1
  48. package/lib/components/respArea/ToolbarIcon.js +21 -45
  49. package/lib/components/respArea/ToolbarIcon.js.map +1 -1
  50. package/lib/constants.js +3 -5
  51. package/lib/constants.js.map +1 -1
  52. package/lib/extensions/component.js +94 -148
  53. package/lib/extensions/component.js.map +1 -1
  54. package/lib/extensions/css.js +9 -44
  55. package/lib/extensions/css.js.map +1 -1
  56. package/lib/extensions/custom-toolbar-wrapper.js +66 -94
  57. package/lib/extensions/custom-toolbar-wrapper.js.map +1 -1
  58. package/lib/extensions/extended-table.js +2 -6
  59. package/lib/extensions/extended-table.js.map +1 -1
  60. package/lib/extensions/image.js +4 -17
  61. package/lib/extensions/image.js.map +1 -1
  62. package/lib/extensions/index.js +13 -23
  63. package/lib/extensions/index.js.map +1 -1
  64. package/lib/extensions/math.js +45 -96
  65. package/lib/extensions/math.js.map +1 -1
  66. package/lib/extensions/media.js +21 -59
  67. package/lib/extensions/media.js.map +1 -1
  68. package/lib/extensions/responseArea.js +43 -89
  69. package/lib/extensions/responseArea.js.map +1 -1
  70. package/lib/index.js +9 -11
  71. package/lib/index.js.map +1 -1
  72. package/lib/styles/editorContainerStyles.js +2 -7
  73. package/lib/styles/editorContainerStyles.js.map +1 -1
  74. package/lib/theme.js +2 -3
  75. package/lib/theme.js.map +1 -1
  76. package/lib/utils/size.js +2 -10
  77. package/lib/utils/size.js.map +1 -1
  78. package/package.json +15 -13
  79. package/src/components/EditableHtml.jsx +21 -33
  80. package/src/components/MenuBar.jsx +66 -37
  81. package/src/components/TiptapContainer.jsx +133 -34
  82. package/src/components/characters/custom-popper.js +18 -28
  83. package/src/components/common/done-button.jsx +15 -26
  84. package/src/components/common/toolbar-buttons.jsx +28 -44
  85. package/src/components/icons/CssIcon.jsx +11 -13
  86. package/src/components/icons/RespArea.jsx +16 -16
  87. package/src/components/icons/TableIcons.jsx +15 -16
  88. package/src/components/icons/TextAlign.jsx +3 -3
  89. package/src/components/image/AltDialog.jsx +6 -6
  90. package/src/components/image/ImageToolbar.jsx +28 -29
  91. package/src/components/media/MediaDialog.js +61 -78
  92. package/src/components/media/MediaToolbar.jsx +30 -37
  93. package/src/components/media/MediaWrapper.jsx +12 -16
  94. package/src/components/respArea/DragInTheBlank/DragInTheBlank.jsx +5 -4
  95. package/src/components/respArea/DragInTheBlank/choice.jsx +191 -185
  96. package/src/components/respArea/ToolbarIcon.jsx +13 -15
  97. package/src/extensions/component.jsx +61 -89
  98. package/src/extensions/css.js +6 -5
  99. package/src/extensions/custom-toolbar-wrapper.jsx +61 -81
  100. package/src/extensions/index.js +2 -2
  101. package/src/index.jsx +2 -2
  102. package/lib/__tests__/utils.js +0 -106
  103. package/src/__tests__/utils.js +0 -36
@@ -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 { withStyles } from '@material-ui/core/styles';
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 { classes, alignment, imageLoaded, disableImageAlignmentButtons } = this.props;
77
+ const { alignment, imageLoaded, disableImageAlignmentButtons } = this.props;
61
78
  return (
62
- <div className={classes.holder}>
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
- <span
71
- className={classNames({
72
- [classes.disabled]: !imageLoaded,
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
- </span>
79
- </div>
93
+ </StyledAltText>
94
+ </StyledHolder>
80
95
  );
81
96
  }
82
97
  }
83
98
 
84
- const styles = (theme) => ({
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;
@@ -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 { withStyles } from '@material-ui/core/styles';
6
- import Button from '@material-ui/core/Button';
7
- import Dialog from '@material-ui/core/Dialog';
8
- import MuiTabs from '@material-ui/core/Tabs';
9
- import MuiTab from '@material-ui/core/Tab';
10
- import DialogTitle from '@material-ui/core/DialogTitle';
11
- import DialogContent from '@material-ui/core/DialogContent';
12
- import DialogContentText from '@material-ui/core/DialogContentText';
13
- import DialogActions from '@material-ui/core/DialogActions';
14
- import TextField from '@material-ui/core/TextField';
15
- import Typography from '@material-ui/core/Typography';
16
- import IconButton from '@material-ui/core/IconButton';
17
- import ActionDelete from '@material-ui/icons/Delete';
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 { classes, open, disablePortal, type, edit, uploadSoundSupport } = this.props;
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
- <Dialog
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
- <div className={classes.row}>
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
- </div>
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
- <DialogContent
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
- </DialogContent>
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
- <DialogContent
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
- </DialogContent>
558
+ </StyledDialogContent>
541
559
  </React.Fragment>
542
560
  )}
543
561
  </div>
544
562
  )}
545
563
  {isUploadMedia && (
546
- <div className={classes.uploadInput}>
564
+ <StyledUploadInput>
547
565
  <div>
548
566
  {fileUpload.url ? (
549
567
  <>
550
- <div className={classes.row}>
568
+ <StyledRow>
551
569
  <audio controls="controls" controlsList="nodownload">
552
570
  <source type={mimeType} src={fileUpload.url} />
553
571
  </audio>
554
- <IconButton aria-label="delete" className={classes.deleteIcon} onClick={this.handleRemoveFile}>
572
+ <StyledIconButton aria-label="delete" onClick={this.handleRemoveFile}>
555
573
  <ActionDelete />
556
- </IconButton>
557
- </div>
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
- <input accept="audio/*" className={classes.input} onChange={this.handleUploadFile} type="file" />
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
- </div>
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
- </Dialog>
602
+ </StyledDialog>
589
603
  );
590
604
  }
591
605
  }
592
606
 
593
- const styles = (theme) => ({
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 { withStyles } from '@material-ui/core/styles';
3
+ import { styled } from '@mui/material/styles';
4
4
 
5
- const useStyles = withStyles((theme) => ({
6
- root: {
7
- position: 'relative',
8
- bottom: '5px',
9
- left: 0,
10
- width: '100%',
11
- background: theme.palette.common.white,
12
- display: 'inline-flex',
13
- padding: '5px',
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 { classes, hideEdit, onEdit, onRemove } = this.props;
38
+ const { hideEdit, onEdit, onRemove } = this.props;
40
39
 
41
40
  return (
42
- <span className={classes.root}>
43
- {hideEdit ? null : (
44
- <span className={classes.editContainer} onClick={onEdit}>
45
- Edit Settings
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 useStyles(MediaToolbar);
49
+ export default MediaToolbar;
@@ -1,43 +1,39 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
- import { withStyles } from '@material-ui/core/styles';
3
+ import { styled } from '@mui/material/styles';
5
4
 
6
- const useStyles = withStyles(() => ({
7
- root: {
8
- position: 'relative',
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, classes, children, width, ...rest } = this.props;
23
+ const { editor, children, width, ...rest } = this.props;
26
24
 
27
25
  return (
28
- <span
29
- className={classNames(classes.root, {
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
- </span>
34
+ </StyledWrapper>
39
35
  );
40
36
  }
41
37
  }
42
38
 
43
- export default useStyles(MediaWrapper);
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, pos) => {
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, pos)}
56
+ removeResponse={(choice) => onRemoveResponse(editor, node, choice)}
56
57
  ></DragDropTile>
57
58
  </span>
58
59
  </NodeViewWrapper>