We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15861
    • 24 Posts
    I’m trying to integrate Mozilla’s Bespin editor as an RTE, but am having issues understanding the correct process. Here’s the plugin that I’ve got so far... I’ll expand to other editing areas once I get this working...

    $event_name = $modx->event->name;
    $asset_path = '/assets/components/spinner/';
    
    /* Handle event */
    switch ($event_name) {
        case 'OnRichTextEditorRegister': /* register the name */
            $modx->event->output('Spinner');
            break;
    
        case 'OnRichTextEditorInit':
        	
        	if ($modx->getOption('use_editor',null,false) && $modx->getOption('which_editor') == 'Spinner')
        	{
        		// Attach our css and js
    			$modx->regClientStartupScript($asset_path . 'BespinEmbedded.js');
    			$modx->regClientCSS($asset_path . 'BespinEmbedded.css');
        		
        		//$html = '';	// Our output will go here.
        		
        		//$modx->event->output($html);
        	}
        	break;
    
       default: break;
    }
    return;
    


    The tutorials that I found on the wiki mention a $elements object, but it doesn’t seem to be working for me in other tests. All that bespin says it needs is a

    <div class="bespin"></div>
    


    It’s loading the js and css fine, but I’m not sure how to replace the textarea that’s inserted, or to add a class to the existing one. I’ve looked through the TinyMCE plugin but it’s doing so much more than what I’m needing to do here.

    How do I take care of this next step and get the proper code in here? That’s one area where the docs seem to be lacking.

    Thanks!