Skip to content

Conversation

@tecoholic
Copy link
Contributor

@tecoholic tecoholic commented Nov 18, 2022

Description

TinyMCE used in WYSWIG edit windows of the XBlocks can be configured with custom plugins by defining them in the Studio settings (ref). This PR extends that functionality to allow overriding the TinyMCE's configuration.

For eg., using the following configuration, the default set of colors in the color picker can be changed from the default set of 12 colors to a custom set of just 3.

JS_ENV_EXTRA_CONFIG = {
    "TINYMCE_CONFIG_OVERRIDES": {
        "color_map": ["000000", "Black", "FF0000", "Red", "00FF00", "Green"]
    }
}

Useful information to include:

  • Which edX user roles will this change impact? - Course Authors
  • Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable).
    This change allows overriding all of the TinyMCE's initial configuration. The screenshots below show how the colors in the color-picker for text-color has been changed based on the example configuration given above:

Default
image

With color_map override
image

Supporting information

Testing instructions (for devstack)

  1. Check out to the PR Branch
  2. Add some configuration changes to TinyMCE in cms/envs/private.py
    JS_ENV_EXTRA_CONFIG = {
        "TINYMCE_CONFIG_OVERRIDES": {... your config here ...}
    
  3. Rebuild the static files for Studio using make studio-static or make dev.static.studio
  4. Open any unit which has editable text content in Studio and verify that the TinyMCE has the overrides applied as expected.

Deadline

"None"

Other information

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 18, 2022
@openedx-webhooks
Copy link

Thanks for the pull request, @tecoholic! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

The TinyMCE's configuration can be overridden by defining the
TINYMCE_CONFIG_OVERRIDES key in the JS_ENV_EXTRA_CONFIG.
@tecoholic tecoholic force-pushed the tecoholic/allow-overriding-tinymce-config-in-xblocks branch from abf23af to e7ebe6a Compare November 18, 2022 16:35
Copy link
Member

@Agrendalath Agrendalath left a comment

Choose a reason for hiding this comment

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

👍

  • I tested this: checked that TinyMCE configuration overrides are applied correctly
  • I read through the code
  • I checked for accessibility issues: n/a
  • Includes documentation: n/a
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository: n/a

@Agrendalath Agrendalath merged commit 54507c1 into openedx:master Nov 23, 2022
@Agrendalath Agrendalath deleted the tecoholic/allow-overriding-tinymce-config-in-xblocks branch November 23, 2022 18:55
@openedx-webhooks
Copy link

@tecoholic 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

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

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants