Moodle
  1. Moodle
  2. MDL-37186

Allow arbitrary TinyMCE setting changes

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.5
    • Fix Version/s: 2.4.1
    • Component/s: HTML Editor (TinyMCE)
    • Labels:
    • Rank:
      46761

      Description

      TinyMCE supports custom formats (see http://www.tinymce.com/wiki.php/Configuration:formats)

      Users can apply these custom formats using the 'formatselect' item on the editor toolbar.

      Default formats are paragraph, address, preformatted, and headings 1-6.

      It would be nice to be able to edit these custom formats in the same way that you can edit the available font list.

      Possible uses include:

      • Advice that applies to the exam (consistent formatting makes the information more recognizable)
      • 'Stretch and Challenge' material
      • 'Did you know?' boxes

        Issue Links

          Activity

          Hide
          Petr Škoda added a comment -

          Hello, thanks a lot for the report. While trying to implement this I have realised that we could support any JSON formatted TinyMCE parameters. I am testing a patch right now, it looks very promising...

          Show
          Petr Škoda added a comment - Hello, thanks a lot for the report. While trying to implement this I have realised that we could support any JSON formatted TinyMCE parameters. I am testing a patch right now, it looks very promising...
          Hide
          Petr Škoda added a comment -

          I think this should be backported to 2.4.x because it is very safe change and it could help very many admins that want to customise TinyMCE without adding new plugin or code modification.

          Show
          Petr Škoda added a comment - I think this should be backported to 2.4.x because it is very safe change and it could help very many admins that want to customise TinyMCE without adding new plugin or code modification.
          Hide
          Petr Škoda added a comment -

          If this gets accepted into integration we could create a special docs page describing useful TinyMCE options such as custom formats or custom styles.

          The only potential problem is that TinyMCE docs contains JS parameters that are not valid JSON (JSON is a subset of JavaScript - no trailing commas and all identifies must be quoted).

          Show
          Petr Škoda added a comment - If this gets accepted into integration we could create a special docs page describing useful TinyMCE options such as custom formats or custom styles. The only potential problem is that TinyMCE docs contains JS parameters that are not valid JSON (JSON is a subset of JavaScript - no trailing commas and all identifies must be quoted).
          Hide
          Petr Škoda added a comment -

          custom styles example:
          1/ add "styleselect" button to your toolbar
          2/ add following custom setting:

          {"style_formats" : [
            {"title" : "Bold text", "inline" : "b"},
            {"title" : "Red text", "inline" : "span", "styles" : {"color" : "#ff0000"}},
            {"title" : "Red header", "block" : "h1", "styles" : {"color" : "#ff0000"}}
          ]}
          
          Show
          Petr Škoda added a comment - custom styles example: 1/ add "styleselect" button to your toolbar 2/ add following custom setting: { "style_formats" : [ { "title" : "Bold text" , "inline" : "b" }, { "title" : "Red text" , "inline" : "span" , "styles" : { "color" : "#ff0000" }}, { "title" : "Red header" , "block" : "h1" , "styles" : { "color" : "#ff0000" }} ]}
          Hide
          Petr Škoda added a comment -

          If you want to move the toolbar to the bottom use:

          {"theme_advanced_toolbar_location" : "bottom"}
          
          Show
          Petr Škoda added a comment - If you want to move the toolbar to the bottom use: { "theme_advanced_toolbar_location" : "bottom" }
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated (24 & master), thanks!

          PS: it would we great to have some nice examples in the docs and/or point to some page containing a complete(r) list.

          PS2: Until the back-porting strategy is decided by the integration team, I'm going to continue back-porting safe improvements to latest stable while minor version < 2. Once decided, this behavior will change, for sure.

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated (24 & master), thanks! PS: it would we great to have some nice examples in the docs and/or point to some page containing a complete(r) list. PS2: Until the back-porting strategy is decided by the integration team, I'm going to continue back-porting safe improvements to latest stable while minor version < 2. Once decided, this behavior will change, for sure.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Tried the theme and the styles examples, and also borking the json. Everything works as expected, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Tried the theme and the styles examples, and also borking the json. Everything works as expected, thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          And your fantastic code has met core, hope they become good friends for a long period.

          Closing, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - And your fantastic code has met core, hope they become good friends for a long period. Closing, thanks!
          Hide
          Mary Cooch added a comment -

          Removing docs_required label as I've added a few screenshots with examples and with reference to the relevant pages in the TinyMCE documentation to both 2.4 and 2.5 http://docs.moodle.org/en/Text_editor

          Show
          Mary Cooch added a comment - Removing docs_required label as I've added a few screenshots with examples and with reference to the relevant pages in the TinyMCE documentation to both 2.4 and 2.5 http://docs.moodle.org/en/Text_editor

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: