Skip to content

Commit

Permalink
fix: paste button on unit page wasn't working (#1724)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido authored Mar 7, 2025
1 parent 49fbe76 commit 17ebb90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/course-unit/CourseUnit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ const CourseUnit = ({ courseId }) => {
{showPasteXBlock && canPasteComponent && isUnitVerticalType && (
<PasteComponent
clipboardData={sharedClipboardData}
onClick={handleCreateNewCourseXBlock}
onClick={
() => handleCreateNewCourseXBlock({ stagedContent: 'clipboard', parentLocator: blockId })
}
text={intl.formatMessage(messages.pasteButtonText)}
/>
)}
Expand Down
5 changes: 3 additions & 2 deletions src/generic/clipboard/paste-component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const PasteComponent = ({
const [showPopover, togglePopover] = useState(false);
const popoverElementRef = useRef(null);

const handlePopoverToggle = (isOpen) => togglePopover(isOpen);
const handlePopoverToggle = (isOpen: boolean) => togglePopover(isOpen);

const renderPopover = () => (
const renderPopover = (props) => (
<div role="link" ref={popoverElementRef} tabIndex={0}>
<Popover
className="clipboard-popover"
Expand All @@ -28,6 +28,7 @@ const PasteComponent = ({
onMouseLeave={() => handlePopoverToggle(false)}
onFocus={() => handlePopoverToggle(true)}
onBlur={() => handlePopoverToggle(false)}
{...props}
>
<PopoverContent clipboardData={clipboardData} />
</Popover>
Expand Down

0 comments on commit 17ebb90

Please sign in to comment.