Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ShannonC 9 posts 81 karma points
    Aug 24, 2021 @ 14:16
    ShannonC
    1

    Add Text color to TinyMce Rich Text Editor in Umbraco 9?

    Hello, I am trying to get textcolor plugin added to the rich text editor. I have tried this in appsettings.json and no luck.

     "Umbraco": {
        "CMS": {
          "Hosting": {
            "Debug": false
          },
          "Global": {
            "Id": "92b75f99..."
          },
          "RichTextEditor": {
            "Plugins": ["textcolor"]
          }
        }
      }
    
  • Matty 34 posts 148 karma points
    Oct 29, 2021 @ 11:55
    Matty
    2

    Hi ShannonC,

    I wrote a blog post about this, but the tl;dr is this:

    "RichTextEditor": {
      "Commands": [
        {
          "alias": "forecolor",
          "name": "Change Color",
          "mode": "Selection"
        },
        {
          "alias": "fontselect",
          "name": "Change Font Family",
          "mode": "Selection"
        },
        {
          "alias": "fontsizeselect",
          "name": "Change Font Size",
          "mode": "Selection"
        }
      ],
      "Plugins": [
        "textcolor",
        "colorpicker"
      ]
    }
    

    This will give you access to font colour, font size and font type.

  • ShannonC 9 posts 81 karma points
    Nov 18, 2021 @ 18:24
    ShannonC
    0

    Thank you very much for this. Working on adding specific colors now, will update with progress.

  • Kerox 2 posts 84 karma points
    May 11, 2022 @ 14:45
    Kerox
    2

    Hello, have you managed to add custom colors to the RTE? I can't find anything related to this for Umbraco 9, thanks!

    Edit: I got it to work, this is the syntax:

    "RichTextEditor": {
        "CustomConfig": {
                  "textcolor_map": "[ \"000000\", \"Black\", \"e31c79\", \"Pink\" ]"
                }
     }
    

    So basically the array must be in quotes and the values escaped.

  • Craig100 1136 posts 2523 karma points c-trib
    Apr 03, 2023 @ 10:02
    Craig100
    0

    I have this in my appsettings.json but only see the ordinary colour picker under the Text Colour changer. I don't see my custom colours. In fact I'd prefer it if we could see ONLY the custom colours.

    "RichTextEditor": {
            "Commands": [
              {
                "alias": "forecolor",
                "name": "Change Colour",
                "mode": "Selection"
              },
              {
                "alias": "fontselect",
                "name": "Change Font Family",
                "mode": "Selection"
              },
              {
                "alias": "fontsizeselect",
                "name": "Change Font Size",
                "mode": "Selection"
              }
            ],
            "CustomConfig": {
              "entity_encoding": "raw",
              "textcolor_map": "[ \"000000\", \"Black\", \"a4b69c\", \"Green\" ]"
            },
            "InvalidElements": "",
            "Plugins": [
              "textcolor",
              "colorpicker"
            ],
            "ValidElements": "*[*]"
          }
    

    Any advice appreciated :)

  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    Apr 03, 2023 @ 11:06
    Huw Reddick
    0

    mmm, that works for me

    enter image description here

  • David Armitage 510 posts 2081 karma points
    May 16, 2023 @ 07:29
    David Armitage
    0

    Hi All,

    Just opening this ticket back up for Umbraco 11. Some of this stuff does not seem to be working for that version.

    -. The colour picker still works. But I cant get the colours to show using the textcolor_map.

    -. The fontsize no longer works but I managed to check the TinyMCE documentation. The alias has changed to....

     {
                "alias": "fontsize",
                "name": "Font Size",
                "mode": "Selection"
              }
    

    With that said though I have no idea how to set the font sizes. Anything I have found does not work which makes this pretty useless.

    -. The font family just doesn't work. I checked the TinyMCE docs and it looks like the commend alias is slightly different but that still didn't seem to work

    I assume I would still then have the same issues with the CustomConfig trying to set the available fonts.

    Has anyone got this to work in Umbraco 11 and can you share your config? I am looking to get Colour, Font Size, font Family working with pre-configured values for each.

    https://www.tiny.cloud/docs/advanced/editor-command-identifiers/#executablecommands

     "RichTextEditor": {
            "Commands": [
              {
                "alias": "forecolor",
                "name": "Change Color",
                "mode": "Selection"
              },
              {
                "alias": "fontsize",
                "name": "Font Size",
                "mode": "Selection"
              }
            ],
            "CustomConfig": {
              "entity_encoding": "raw",
              "textcolor_map": "[ \"000000\", \"Black\", \"a4b69c\", \"Green\" ]"
            },
            "InvalidElements": "",
            "Plugins": [
              "textcolor",
              "colorpicker"
            ],
            "ValidElements": "*[*]"
          },
    
  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    May 16, 2023 @ 11:35
    Huw Reddick
    0

    I have not tried in 11 but I have this working ok in 10.5

          "RichTextEditor": {
        "Commands": [
          {
            "Alias": "codesample",
            "Name": "Code Sample",
            "Mode": "Insert"
          },
          {
            "Alias": "emoticons",
            "Name": "Emoticons",
            "Mode": "Insert"
          },
          {
            "Alias": "forecolor",
            "Name": "Change Color",
            "mode": "Selection"
          },
          {
            "Alias": "fontselect",
            "Name": "Change Font Family",
            "Mode": "Selection"
          },
          {
            "Alias": "fontsizeselect",
            "Name": "Change Font Size",
            "Mode": "Selection"
          }
        ],
        "Plugins": [
          "codesample",
          "emoticons",
          "textcolor",
          "colorpicker"
        ],
        "CustomConfig": {
          "textcolor_map": "[ \"000000\", \"Black\", \"a4b69c\", \"Green\" ]"
        }
      },
    
  • D1835 7 posts 77 karma points
    Feb 15, 2024 @ 10:22
    D1835
    0

    Does anyone know how to get the textcolor_map working as of today? I have tried all the above and the colors don't show up, I just get the default ones

  • Ihor Leleka 1 post 71 karma points
    Jun 17, 2024 @ 15:29
    Ihor Leleka
    0

    Property name inside CustomConfig has to be changed from textcolor_map to color_map:

    "RichTextEditor": {
        "Commands": [
          {
            "Alias": "forecolor",
            "Name": "Change Color",
            "Mode": "Selection"
          },
          {
            "Alias": "backcolor",
            "Name": "Change Background Color",
            "Mode": "Selection"
          }
        ],
        "CustomConfig": {
          "color_map": "[ \"#ffffff\", \"White\", \"#000000\", \"Black\"]"
        }
      }
    }
    
  • Naor C 17 posts 126 karma points
    1 week ago
    Naor C
    0

    Does anyone know how to make it work in Umbraco 13? I can't set any color or font size.

  • Ruud Aalders 2 posts 72 karma points
    5 days ago
    Ruud Aalders
    0

    Huw Reddicks' solution works just add it to your appsettings.json.

    Just put it between your cms tags in the json file.

    At least that worked for me on umbraco 13.6.0.

    Hope it helps you any further!

    Regards,

    Ruud

  • Naor C 17 posts 126 karma points
    4 days ago
    Naor C
    0

    Hello Ruud,

    What I did is - I just took the data and threw it on appsettings.json. What I did NOT do is - put it under "Umbraco" => "Cms" in the appsettings :D

    After switching it to the right place under the json it worked well.

    Thank you!

  • Ruud Aalders 2 posts 72 karma points
    4 days ago
    Ruud Aalders
    0

    Apologies for typing too fast :)

    What you did is exactly what i did. When you put tthe snippet where i say to put it then Umbraco crashes:)

    Again my apologies and glad to hear it send you to the right direction.

    Regards.

Please Sign in or register to post replies

Write your reply to:

Draft