Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37186

Allow arbitrary TinyMCE setting changes

    Details

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

      1/ add new advance tinymce setting such as:

      {"theme": "simple"}

      2/ verify the new setting is in effect when editing anything
      3/ verify green icon next to the setting
      4/ break the JSON somehow and verify red icon next to the textarea

      Show
      1/ add new advance tinymce setting such as: {"theme": "simple"} 2/ verify the new setting is in effect when editing anything 3/ verify green icon next to the setting 4/ break the JSON somehow and verify red icon next to the textarea
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w51_MDL-37186_m25_tinymceconfig

      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

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            skodak Petr Skoda 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
            skodak Petr Skoda 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
            skodak Petr Skoda 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
            skodak Petr Skoda 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
            skodak Petr Skoda 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
            skodak Petr Skoda 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
            skodak Petr Skoda 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
            skodak Petr Skoda 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
            skodak Petr Skoda added a comment -

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

            {"theme_advanced_toolbar_location" : "bottom"}

            Show
            skodak Petr Skoda added a comment - If you want to move the toolbar to the bottom use: {"theme_advanced_toolbar_location" : "bottom"}
            Hide
            stronk7 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
            stronk7 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
            stronk7 Eloy Lafuente (stronk7) added a comment -

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

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Tried the theme and the styles examples, and also borking the json. Everything works as expected, thanks!
            Hide
            stronk7 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
            stronk7 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
            marycooch 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
            marycooch 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:
                  Fix Release Date:
                  14/Jan/13