Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions packages/drag-in-the-blank/configure/src/choice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { choiceIsEmpty } from './markupUtils';

const GripIcon = ({ style }) => (
<span style={style}>
<MoreVert style={{ margin: '0 -16px' }}/>
<MoreVert/>
<MoreVert style={{ margin: '0 -16px' }} />
<MoreVert />
</span>
);

Expand All @@ -32,7 +32,11 @@ const StyledChoice = styled('div', {
cursor: 'grab',
border: `1px solid ${error ? '#f44336' : '#C0C3CF'}`,
'& img': {
display: 'flex'
display: 'flex',
},
// browser adds extra marrgin for p tags by default
'& p': {
margin: 0,
},
'& mjx-frac': {
fontSize: '120% !important',
Expand All @@ -53,12 +57,7 @@ const StyledDeleteIcon = styled(Delete)(({ theme }) => ({

export const BlankContent = (props) => {
const { choice, onClick, onRemoveChoice, error, instanceId, disabled } = props;
const {
attributes,
listeners,
setNodeRef,
isDragging,
} = useDraggable({
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
id: `choice-${choice.id}-${instanceId || 'default'}`,
data: {
type: 'drag-in-the-blank-choice',
Expand All @@ -67,7 +66,6 @@ export const BlankContent = (props) => {
instanceId: instanceId,
},
disabled: disabled || choiceIsEmpty(choice),

});

const handleDragStart = (e) => {
Expand Down
7 changes: 3 additions & 4 deletions packages/drag-in-the-blank/configure/src/choices.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { styled } from '@mui/material/styles';

import Choice from './choice';
import { choiceIsEmpty } from './markupUtils';
import { renderMath } from "@pie-lib/math-rendering";
import { renderMath } from '@pie-lib/math-rendering';

const StyledDesign = styled('div')(({ theme }) => ({
display: 'flex',
Expand Down Expand Up @@ -150,9 +150,7 @@ export class Choices extends React.Component {
} = this.props;

// find the maximum existing id and add 1 to generate the new id so we avoid duplicates
const maxId = oldChoices.length > 0
? Math.max(...oldChoices.map(choice => parseInt(choice.id, 10) || 0))
: -1;
const maxId = oldChoices.length > 0 ? Math.max(...oldChoices.map((choice) => parseInt(choice.id, 10) || 0)) : -1;
const newId = `${maxId + 1}`;

this.setState(
Expand Down Expand Up @@ -243,6 +241,7 @@ export class Choices extends React.Component {
>
<EditableHtml
ref={(ref) => (this.focusedNodeRef = ref)}
autoFocus
imageSupport={imageSupport}
markup={choice.value}
pluginProps={pluginProps}
Expand Down
Loading