Copied to clipboard

Flag this post as spam?

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


  • Vyacheslav 13 posts 113 karma points
    May 10, 2023 @ 07:46
    Vyacheslav
    0

    Why TinyMCE custom config doesn't work?

    Hi!
    I tried to use custom config for adding format styles with submenus.
    This is example of my config:

    <?xml version="1.0" encoding="utf-8"?>
    <DataType Key="47ab957d-f317-474a-bb22-334067cbcc27" Alias="NewRichTextEditor" Level="2">
      <Info>
        <Name>NewRichTextEditor</Name>
        <EditorAlias>Umbraco.TinyMCE</EditorAlias>
        <DatabaseType>Ntext</DatabaseType>
        <Folder>RTE</Folder>
      </Info>
      <Config><![CDATA[{
      "Editor": {
        "toolbar": [
          "ace",
          "removeformat",
          "styleselect",
          "bold",
          "italic",
          "underline",
          "strikethrough",
          "bullist",
          "numlist",
          "link",
          "unlink"
        ],
        "maxImageSize": 500,
        "mode": "classic"
      },
      "OverlaySize": null,
      "HideLabel": false,
      "IgnoreUserStartNodes": false,
      "MediaParentId": null
    }]]></Config>
        <customConfig>
            <config key="style_formats">
                [{"title":"Headers","items":[{"title":"Header 1 (H1)","block":"h1"},{"title":"H1 Lookalike","selector":"p,span","classes":"h1"},{"title":"Header 2 (H2)","block":"h2"},{"title":"H2 Lookalike","selector":"p,span","classes":"h2"},{"title":"Header 3 (H3)","block":"h3"},{"title":"H3 Lookalike","selector":"p,span","classes":"h3"}]},{"title":"Quotes","items":[{"title":"Style A","block":"blockquote","classes":"quote-a"},{"title":"Style B","block":"blockquote","classes":"quote-b"}]},{"title":"Links","items":[{"title":"CTA Loud","selector":"a","classes":"cta cta-loud"},{"title":"CTA Subtle","selector":"a","classes":"cta cta-subtle"},{"title":"Button look-a-like","selector":"a","classes":"btn btn-mimic"}]},{"title":"Inline colours","items":[{"title":"Orange","inline":"span","classes":"orange"},{"title":"Red","inline":"span","classes":"red"},{"title":"Blue","inline":"span","classes":"blue"}]}]
            </config>
        </customConfig>
    </DataType>
    

    But there is no my config.
    This formats looks like default. strange format styles

    What I did wrong? How I can set my format styles with sub-menus?

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    May 10, 2023 @ 08:10
    Marc Goodson
    100

    Hi Vyacheslav

    In V8, the CustomConfig setting for the styles dropdown needs to go file called tinymce.config located in

    /config/tinymce.config

    and it applies globally to all rich text editors in your backoffice.

    https://our.umbraco.com/Documentation/Reference/Configuration-for-Umbraco-7-and-8/tinyMceConfig/#tinymceconfig---rich-text-editor-configuration

    From your screenshot, it looks like you've added it to a uSync file? for a specific Rich Text Editor instance - unfortunately (be cool if it did) that's not how it works :-(

    If you find the /config/tinymce.config file and put your custom config in there, make sure the site is restarted (otherwise config changes aren't picked up) then you should have your grouped menu!

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft