Skip to content

Conversation

@KyryloKireiev
Copy link

Description

  • Added Plugin Slots for HTML and Problem editors;
  • Added usage examples;
  • Added configuration examples;

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Dec 11, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Dec 11, 2025

Thanks for the pull request, @KyryloKireiev!

This repository is currently maintained by @bradenmacdonald.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Dec 11, 2025
@KyryloKireiev KyryloKireiev marked this pull request as draft December 11, 2025 11:10
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Dec 11, 2025
Copy link
Contributor

@PKulkoRaccoonGang PKulkoRaccoonGang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll review this in more detail later, but based on a quick pass, the following updates are needed:

  • Remove AILab-146 from the PR title.
  • Consider my suggestion about using import aliases for the new imports introduced in this PR’s diff.
  • Review the proposal regarding avoiding the use of React.FC<>.


import { selectors } from '../../../../data/redux';
import { selectors, actions } from '../../../../data/redux';
import { getDataFromOlx } from '../../../../data/redux/thunkActions/problem';
Copy link
Contributor

@PKulkoRaccoonGang PKulkoRaccoonGang Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use frontend-aliases for new imports in this PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently additional imports removed due to ProblemEditorPluginSlot refactored

Comment on lines 23 to 26
export const TextEditorPluginSlot: React.FC<TextEditorPluginSlotProps> = ({
updateContent,
blockType,
}) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional]: I’m not a big fan of declaring types using React.FC. Also, looking at the other slots in this repository, they are defined without FC. To keep things consistent, I suggest following the same pattern:

Suggested change
export const TextEditorPluginSlot: React.FC<TextEditorPluginSlotProps> = ({
updateContent,
blockType,
}) => (
export const TextEditorPluginSlot = ({
updateContent,
blockType,
}: TextEditorPluginSlotProps) => (

https://github.com/raccoongang/frontend-app-authoring/blob/kireiev/AILab-146/feat/add_plugin_slots/src/plugin-slots/CourseAuthoringOutlineSidebarSlot/index.tsx

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied

updateContent={(newOLX) => {
// Parse and update the problem state
const rawSettings = {
weight: problemState.settings?.scoring?.weight || 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the default height 1 and not 0?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateContent removed from plugin slot and moved in Plugin implementation.

by default we use weight == 1 for Problem xBlock

showanswer: problemState.settings?.showAnswer?.on || null,
show_reset_button: problemState.settings?.showResetButton || null,
rerandomize: problemState.settings?.randomization || null,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[important]: You are using ||, which means that valid falsy values ​​(0, false) will be replaced with defaults

weight: 0 -> 1

showAnswer.on: false-> null

Let's use nullish coalescing (??) instead of logical OR ||

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also moved to AIAssistantWidget component.

Changed to ?? in AIAssistantWidget component.

) : (
<span className="flex-grow-1 mb-5">
<ProblemEditorPluginSlot
updateContent={(newOLX) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional]: In this file, I didn’t notice this, but it would be good to introduce a new updateProblemEditorContent function and move all logic related to updating the content for ProblemEditorPluginSlot into it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function updateContent removed from ProblemEditorPluginSlot

<>
<TextEditorPluginSlot
updateContent={(newContent) => {
// Update the editor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that, based on the updateContent prop name, it’s already clear that this is responsible for updating the content. So let’s remove this comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

updateContent function also removed from TextEditorPluginSlot

) : (
<>
<TextEditorPluginSlot
updateContent={(newContent) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional]: In this file, I didn’t notice this, but it would be good to introduce a new updateTextEditorContent function and move all logic related to updating the content for TextEditorPluginSlot into it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateContent removed

- The `blockType` prop may be in different formats:
- API format: `problem-single-select`, `problem-multi-select`, etc.
- OLX format: `multiplechoiceresponse`, `choiceresponse`, etc.
- Generic: `problem`, `advanced`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be some code example here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed entirely, because ProblemEditorPluginSlot and TextEditorPluginSlot know nothing about possible backend implementation inserted plugin

@@ -0,0 +1,36 @@
import { PluginSlot } from '@openedx/frontend-plugin-framework/dist';
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this React import?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 4 to 9
interface TextEditorPluginSlotProps {
/** Function to update editor content with new content */
updateContent: (content: string) => void;
/** Block type (e.g., 'html') */
blockType: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interface TextEditorPluginSlotProps {
/** Function to update editor content with new content */
updateContent: (content: string) => void;
/** Block type (e.g., 'html') */
blockType: string;
}
interface TextEditorPluginSlotProps {
updateContent: (content: string) => void;
blockType: string;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored

Comment on lines 11 to 22
/**
* Plugin slot for Text Editor (HTML xBlocks)
*
* Slot ID: `org.openedx.frontend.authoring.text_editor_plugin.v1`
*
* This slot allows plugins to add custom widgets to the HTML/text editor.
* By default, the slot is empty. Add widgets via `env.config.jsx`.
*
* Plugin Props:
* - `updateContent`: Function to update editor content with new content
* - `blockType`: Block type (e.g., 'html')
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed several other plugin slots in this repository and didn’t find similar descriptive comments being added. I suggest removing this, since we already have a README.md file next to this plugin slot that documents all the necessary information about the plugin slot API.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed


## Example: Screenshot with custom implementation

![Screenshot with custom implementation](./images/custom_ai_assistant_html.png) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the documentation for this plugin slot, let’s also follow the same structure used by other plugin slots in this repository. Images should be placed under a heading with the name of the corresponding example.

@KyryloKireiev KyryloKireiev changed the title feat: [AILab-146] HTML and Problem plugin slots feat: Add HTML and Problem editors plugin slots Dec 15, 2025
@KyryloKireiev KyryloKireiev marked this pull request as ready for review December 15, 2025 10:36
- **Advanced/Raw Editor Mode**: Where the widget can generate raw OLX or Markdown content that is directly inserted into the CodeMirror editor.

## Example: Adding the AI Content Assistant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don’t want to mention anything about the AI Assistant, should we update the other description as well?

![Screenshot with custom implementation](./images/default_problem_editor.png)

### Example: Screenshots with passed component into plugin slot for Problem editor
![Screenshot with hidden AIAssistantWidget](./images/problem_editor_slot.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these images be placed under the corresponding usage example? And do we want to mention the AI Assistant Widget?

blockType: string;
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this extra space?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed


## Description

The slot is positioned in the Text Editor modal window for HTML XBlocks. It is suitable for adding AI-powered content generation tools or other editor enhancements.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we write the plugin slot description in a more general way? I don’t think we need to focus on “AI-powered content generation tools,” since this slot can be used for anything.


### Example: Screenshot with default HTML Editor

![Screenshot with custom implementation](./images/default_html_editor.png) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these images be placed under the usage example heading, following the pattern used in the documentation for other plugin slots?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks. I forgot a lot of the artifacts that were left over from the previous description, which included AI Assistant Widget. Now I deleted all artifacts and rewrite docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants