Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
add a button in tinymce/JCE editor for geshi tags (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: add a button in tinymce/JCE editor for geshi tags
#471
shoulders (User)
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
add a button in tinymce/JCE editor for geshi tags 3 Years, 1 Month ago Karma: 0  
I know this might not be your area but i will give it a try. Is there a turtorial or an easy way to add a custom button to tinymce or JCE editor to add your geshibot tags. this would be an excellent addition.

thanks

shoulders
 
Report to moderator   Logged Logged  
 
  The administrator has disabled public write access.
#473
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:add a button in tinymce/JCE editor for geshi tags 3 Years, 1 Month ago Karma: 10  
The readmore button is a good example.

/plugins/editors-xtd/

<?php
/**
 * @version		$Id: readmore.php 10571 2008-07-21 01:27:35Z pasamio $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.plugin.plugin' );

/**
 * Editor Readmore buton
 *
 * @author Johan Janssens <johan.janssens @ joomla.org>
 * @package Editors-xtd
 * @since 1.5
 */
class plgButtonReadmore extends JPlugin
{
	/**
	 * Constructor
	 *
	 * For php4 compatability we must not use the __constructor as a constructor for plugins
	 * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
	 * This causes problems with cross-referencing necessary for the observer design pattern.
	 *
	 * @param 	object $subject The object to observe
	 * @param 	array  $config  An array that holds the plugin configuration
	 * @since 1.5
	 */
	function plgButtonReadmore(& $subject, $config)
	{
		parent::__construct($subject, $config);
	}

	/**
	 * readmore button
	 * @return array A two element array of ( imageName, textToInsert )
	 */
	function onDisplay($name)
	{
		global $mainframe;

		$doc 		=& JFactory::getDocument();
		$template 	= $mainframe->getTemplate();

		// button is not active in specific content components

		$getContent = $this->_subject->getContent($name);
		$present = JText::_('ALREADY EXISTS', true) ;
		$js = "
			function insertReadmore(editor) {
				var content = $getContent
				if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) {
					alert('$present');
					return false;
				} else {
					jInsertEditorText('<hr id=\"system-readmore\" />', editor);
				}
			}
			";

		$doc->addScriptDeclaration($js);

		$button = new JObject();
		$button->set('modal', false);
		$button->set('onclick', 'insertReadmore(\''.$name.'\');return false;');
		$button->set('text', JText::_('Readmore'));
		$button->set('name', 'readmore');
		// TODO: The button writer needs to take into account the javascript directive
		//$button->set('link', 'javascript:void(0)');
		$button->set('link', '#');

		return $button;
	}
}
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/12/20 01:41 By admin.
  The administrator has disabled public write access.
#478
shoulders (User)
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
Re:add a button in tinymce/JCE editor for geshi tags 3 Years, 1 Month ago Karma: 0  
Thanks for this, i am not a programmer but will look into it. It will give me something to do. lol

I assume i can just edit this button and then upload the changed files to the folder you mentioned. I did not even think about the buttons at the bottom of the editor, the joomla ones. This means the buttons when setup will work cross editor.

I have looked at easytemplate. this is a plugin that adds one button on to the bottom of the editor and allows you to pick from multiple snippets you have installed.
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,4301/Itemid,35/

it will do just for now.

cheers
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/12/20 13:50 By shoulders.
 
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.