Copied to clipboard

Flag this post as spam?

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


  • Ben Palmer 176 posts 842 karma points c-trib
    Oct 23, 2015 @ 11:12
    Ben Palmer
    0

    Using Function in TinyMCE CustomConfig

    I have an Umbraco site which makes use of rich text editors in the backend and I'm attempting to 'hook' in to the TinyMCE onchange_callback.

    I've been fumbling around hoping to come across something and I found the tinyMCEConfig.config file which allows you to set custom settings from the tinyMCE configuration settings - http://www.tinymce.com/wiki.php/Configuration3x

    I dropped in a 'height' setting of 1500 as a test and this works perfectly. However, I'm also trying to use both oninit and the onchange_callback settings to call a function so that I can hopefully grab the content of the editor.

    <customConfig>
        <!--    <config key="myKey">mySetting</config>-->
        <config key="entity_encoding">raw</config>
        <config key="height">1500</config>
        <config key="oninit">testfunc</config>
        <config key="onchange_callback">testfunc</config>
        <config key="codemirror">
          {
            "indentOnInit": false,
            "path": "../../../../lib/codemirror",
            "config": {
          },
          "jsFiles": [
          ],
          "cssFiles": [
          ]
        }
      </config>
    </customConfig>
    

    I have a test function set up in a file which I'm including in the backend through a custom package.manifest file:

    {
        "css": [
            "/assets/css/admin.css"
        ],
        "javascript": [
            "/assets/js/admin.js"
        ]
    }
    

    The javascript file/function:

    var testfunc = function () {
        alert('test h');
    }
    

    All pretty simple but I get an error for the onit setting (thrown from tinyMCE):

    Uncaught TypeError: n.apply is not a function
    

    Where am I going wrong here?

Please Sign in or register to post replies

Write your reply to:

Draft