ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

rich text editor tool api

March 15, 2013 10:33am

Subscribe [2]
  • #1 / Mar 15, 2013 10:33am

    heaversm

    197 posts

    I’m trying to follow along with the rich text editor documentation in expression engine, but it’s a little unclear to me:

    http://ellislab.com/expressionengine/user-guide/development/rte_tools.html

    I created a php file like this:

    Class center_text {
    
        public $info = array(
            'name'        => 'Center Text',
            'version'     => '1.0',
            'description' => 'Center Aligns Text',
            'cp_only'     => 'y'
        );
    
        private $EE;
    
        /**
         *  Constructor
         */
        function __construct()
        {
            // Make a local reference of the ExpressionEngine super object
            $this->EE =& get_instance();
        }
    
        /**
         *  Globals we need defined
         */
        function globals()
        {
            $this->EE->lang->loadfile('center_text');
            return array(
                'rte.center_text.label' => lang('center_text')
            );
        }
    
    
        /**
         *  RTE tool Definition
         */
        function definition()
        {
            return '
    
            WysiHat.addButton('center_text', {
                label: EE.rte.center_text.label,
                handler: function()
                {
                    // Button Logic
                }
            });
    
            ';
        }
    
    }
    // END center_text_rte class
    
    /* End of file rte.center_text.php */
    /* Location: ./system/expressionengine/third_party/center_text/rte.center_text.php */

    Named and placed as mentioned in the comments. I realize that this wouldn’t exactly do anything just yet (I still don’t know how to make that happen) - but I would expect it to show up as an option now in the toolset of the rich text editor, but it’s not.

    Does anyone have an example tool they’ve built for the RTE, or can point me to the default tools so I can see how they’re set up. All I really want to do is define some very simple styles that CMS users can apply to their text, and the css will handle the rest (such as center, left, or right aligning text).

    Thanks for any help or clarification on this.

  • #2 / Apr 15, 2013 2:38pm

    trevororr

    2 posts

    I am having the exact same issue, were to able to get this to work?  if so could you let me know what you did?

  • #3 / Apr 15, 2013 2:58pm

    heaversm

    197 posts

  • #4 / Apr 15, 2013 7:58pm

    trevororr

    2 posts

    That is exactly what I needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases