From c45211980f8caa56ea66821cab1d4981157e0432 Mon Sep 17 00:00:00 2001 From: KristinAoki Date: Fri, 19 Jul 2024 09:36:52 -0400 Subject: [PATCH 1/3] fix: bump frontend-lib-content-components to 2.5.1 --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 27edb9c579..7756977540 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@edx/frontend-component-footer": "^13.0.2", "@edx/frontend-component-header": "^5.1.0", "@edx/frontend-enterprise-hotjar": "^2.0.0", - "@edx/frontend-lib-content-components": "^2.1.11", + "@edx/frontend-lib-content-components": "^2.5.1", "@edx/frontend-platform": "7.0.1", "@edx/openedx-atlas": "^0.6.0", "@fortawesome/fontawesome-svg-core": "1.2.36", @@ -2580,9 +2580,9 @@ } }, "node_modules/@edx/frontend-lib-content-components": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/@edx/frontend-lib-content-components/-/frontend-lib-content-components-2.1.11.tgz", - "integrity": "sha512-vzDpneZIXmjFo5sZxxZiVjt1zgczfEkJhT2h/sg2mcJ0m7Zuo9dPJeilATqB0pSTjZnNsIbX+NfT/Dx/mSJciQ==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@edx/frontend-lib-content-components/-/frontend-lib-content-components-2.5.1.tgz", + "integrity": "sha512-qxSGCF6GxDaeszW/f3ikf8V0j9yR6r1sohV15fHURrNvV0JPF860EIVgbPHR1FKjL1Iwo16Q/KWc0uY+HVwBYA==", "dependencies": { "@codemirror/lang-html": "^6.0.0", "@codemirror/lang-xml": "^6.0.0", @@ -2621,7 +2621,7 @@ "xmlchecker": "^0.1.0" }, "peerDependencies": { - "@edx/frontend-platform": "^7.0.1", + "@edx/frontend-platform": "^7.0.1 || ^8.0.0", "@openedx/paragon": "^21.5.7 || ^22.0.0", "prop-types": "^15.5.10", "react": "^16.14.0 || ^17.0.0", diff --git a/package.json b/package.json index 5a8b9a1e10..d812266f97 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@edx/frontend-component-footer": "^13.0.2", "@edx/frontend-component-header": "^5.1.0", "@edx/frontend-enterprise-hotjar": "^2.0.0", - "@edx/frontend-lib-content-components": "^2.1.11", + "@edx/frontend-lib-content-components": "^2.5.1", "@edx/frontend-platform": "7.0.1", "@edx/openedx-atlas": "^0.6.0", "@fortawesome/fontawesome-svg-core": "1.2.36", From f5bd00b883e5fbb241c6a4079a815497afa7bdac Mon Sep 17 00:00:00 2001 From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:44:12 -0400 Subject: [PATCH 2/3] fix: update mapToStateProps to match changes in TinyMceWidget (#1133) --- .../update-form/UpdateForm.test.jsx | 36 ++++++++++++++----- src/generic/WysiwygEditor.jsx | 9 ++--- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/course-updates/update-form/UpdateForm.test.jsx b/src/course-updates/update-form/UpdateForm.test.jsx index 569efb7252..37389996ca 100644 --- a/src/course-updates/update-form/UpdateForm.test.jsx +++ b/src/course-updates/update-form/UpdateForm.test.jsx @@ -5,14 +5,18 @@ import { waitFor, act, } from '@testing-library/react'; +import { AppProvider } from '@edx/frontend-platform/react'; import { IntlProvider } from '@edx/frontend-platform/i18n'; +import { initializeMockApp } from '@edx/frontend-platform'; import moment from 'moment/moment'; +import initializeStore from '../../store'; import { REQUEST_TYPES } from '../constants'; import { courseHandoutsMock, courseUpdatesMock } from '../__mocks__'; import UpdateForm from './UpdateForm'; import messages from './messages'; +let store; const closeMock = jest.fn(); const onSubmitMock = jest.fn(); const addNewUpdateMock = { id: 0, date: moment().utc().toDate(), content: 'Some content' }; @@ -48,18 +52,32 @@ const courseUpdatesInitialValues = (requestType) => { }; const renderComponent = ({ requestType }) => render( - - - , + + + + + , ); describe('', () => { + beforeEach(() => { + initializeMockApp({ + authenticatedUser: { + userId: 3, + username: 'abc123', + administrator: true, + roles: [], + }, + }); + + store = initializeStore(); + }); it('render Add new update form correctly', async () => { const { getByText, getByDisplayValue, getByRole } = renderComponent({ requestType: REQUEST_TYPES.add_new_update }); const { date } = courseUpdatesInitialValues(REQUEST_TYPES.add_new_update); diff --git a/src/generic/WysiwygEditor.jsx b/src/generic/WysiwygEditor.jsx index e89b3b6859..b506b74ba5 100644 --- a/src/generic/WysiwygEditor.jsx +++ b/src/generic/WysiwygEditor.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { connect, Provider } from 'react-redux'; +import { connect, Provider, useSelector } from 'react-redux'; import { createStore } from 'redux'; import { getConfig } from '@edx/frontend-platform'; import { @@ -18,20 +18,20 @@ export const SUPPORTED_TEXT_EDITORS = { }; const mapStateToProps = () => ({ - assets: {}, + images: {}, lmsEndpointUrl: getConfig().LMS_BASE_URL, studioEndpointUrl: getConfig().STUDIO_BASE_URL, isLibrary: true, onEditorChange: () => ({}), }); - const Editor = connect(mapStateToProps)(TinyMceWidget); export const WysiwygEditor = ({ initialValue, editorType, onChange, minHeight, }) => { + // const courseId = "course+test+test+test" const { editorRef, refReady, setEditorRef } = prepareEditorRef(); - + const { courseId } = useSelector((state) => state.courseDetail); const isEquivalentCodeExtraSpaces = (first, second) => { // Utils allows to compare code extra spaces const removeWhitespace = (str) => str.replace(/\s/g, ''); @@ -75,6 +75,7 @@ export const WysiwygEditor = ({ setEditorRef={setEditorRef} onChange={handleUpdate} initializeEditor={() => ({})} + learningContextId={courseId} /> ); From 9813a25dc2c22b5663e655cd3acb8ff52b61cd24 Mon Sep 17 00:00:00 2001 From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:39:26 -0400 Subject: [PATCH 3/3] fix: remove commented out code Co-authored-by: Kyle McCormick --- src/generic/WysiwygEditor.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/generic/WysiwygEditor.jsx b/src/generic/WysiwygEditor.jsx index b506b74ba5..175da2082e 100644 --- a/src/generic/WysiwygEditor.jsx +++ b/src/generic/WysiwygEditor.jsx @@ -29,7 +29,6 @@ const Editor = connect(mapStateToProps)(TinyMceWidget); export const WysiwygEditor = ({ initialValue, editorType, onChange, minHeight, }) => { - // const courseId = "course+test+test+test" const { editorRef, refReady, setEditorRef } = prepareEditorRef(); const { courseId } = useSelector((state) => state.courseDetail); const isEquivalentCodeExtraSpaces = (first, second) => {