We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11335
    • 1 Posts
    Ok, so I saw netnoise’s syntax highlighter, and although it worked, I wanted something more integrated (like TinyMCE). I had integrated EditArea into a php File Manager in the past, and was quite happy with the result, so I decided to write my first MODx plugin.

    NOTE:

    a) This plugin is not 100% functional at the moment, but I thought I would post, so others could use it and maybe help me figure out what I am doing wrong. (Before you get scared off, it does not error out or anything, and is about 90% working!)

    b) This plugin requires you to modify some of the core MODx files. As a sidenote to those who have the power, do you think that we could get the core MODx files, to include "ID" tags in items such as textareas (and not just name tags) in a future release?


    Instructions on how to install:

    1. In the "manager\actions\" folder, you must replace ’name="post"’ with ’name="post" id="post"’ in the following five files:
    mutate_htmlsnippet.dynamic.php Line 186
    mutate_module.dynamic.php Line 406
    mutate_plugin.dynamic.php Line 320
    mutate_snippet.dynamic.php Line 321
    mutate_templates.dynamic.php Line 177

    P.S. - If you dont want to modify the files, and if you use IE, I have included a hack that will work.

    2. Get the latest EditArea code from http://www.cdolivet.net/index.php?page=editArea

    3. Extract that into the following directory ’assets/plugins/edit_area’

    4. Check to make sure you did #3 correctly, do you have a file ’assets/plugins/edit_area/edit_area/edit_area_full.js’?

    5. Create the EditArea Plugin, using the ’plugin.edit_area.tpl’ file for the php Plugin code

    6. Register the plugin with the following system events:
    OnSnipFormRender
    OnChunkFormRender
    OnPluginFormRender
    OnModFormRender
    OnTempFormRender
    OnRichTextEditorRegister
    OnRichTextEditorInit
    OnInterfaceSettingsRender

    If all is well, the plugin will work with Templates, Snippits, Plugins, and you will see the editor choice with Chunks (and anywhere the TinyMCE can be used). However, this is where things are broken.... sad I tried to mimic the TinyMCE plugin code, and it registers itself properly, and when I select it, it places the necessary code in the html, but I do not see the editor. So, does anyone have any idea what I am doing wrong?

    TODOs:
    1. Get working as an alternative RichTextEditor to TinyMCE
    2. Look into using the PHP compressor version so the the entire code is gziped and the d/l is only 24k rather than 104k.

    Please let me know your comments, etc. I am looking forward to hearing people’s feedback, etc. (And to writing more Plugins, etc... tongue)

    THX!
    -gerry.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      . As a sidenote to those who have the power, do you think that we could get the core MODx files, to include "ID" tags in items such as textareas (and not just name tags) in a future release?
      In a "future release" the manager will be built on the parsing engine just as the front-end pages are, so you’ll be able to use any template style you like.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 27376
        • 576 Posts
        Very well done! With a little more work this plugin should be packaged with MODx.

        As for suggestions, I’ll have to play around with it more to see what’s going on.

        Thanks a bunch for this plugin!
          • 23491 ☆ A M B ☆
          • 1,056 Posts
          Quote from: sirlancelot at Jan 04, 2007, 05:46 PM

          Very well done! With a little more work this plugin should be packaged with MODx.

          As for suggestions, I’ll have to play around with it more to see what’s going on.

          Thanks a bunch for this plugin!

          I agree that EditArea (or similar) should definitely come in a pre-packaged version of MODx. (Possibly as a disabled plugin by default that could simply be toggled ON and you’re good to go...)

          However, the aforementioned implementation is not specifically a plugin, as you’re still having to modify the core distribution files.

          In this thread that I started, you’ll see an alternate approach using dynamic JavaScript to reference and ID the text editor. Just a few simply steps, and you’ll have EditArea functioning as a true MODx plugin wink

          (Nice post!)
            Mike Reid - www.pixelchutes.com
            MODx Ambassador / Contributor
            [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
            ________________________________
            Where every pixel matters.