[DEV] TinyMCE WYSIWYG Editor In Posts

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
desiprints
Registered User
Posts: 95
Joined: Wed Sep 08, 2004 4:45 pm

[DEV] TinyMCE WYSIWYG Editor In Posts

Post by desiprints » Mon Jan 15, 2007 6:47 pm

im nearly their i just need to find out a way to enter the code into the posting to either parse the html from the editor to bbcode or on clicking the send post button it will convert the html to bbcode then send it.

if anyone has the code to insert for it to parse the code then it will be very good.

i have looked at many html to bbcode parsers and they really give me a headache as im not very good with php.

also i need a piece of code to insert so people can choose between using the editor or the standard phpbb posts.

im roughly 50% there as i have integrated the editor successfully and it works perfectly with html on in the board, but people don'y like this idea so im looking for a way to make it go into bbcode.

screenshots and a demo will shortly be up.

Demo

Click Here For A Demo

Code: Select all

Username: demo
Pass: demo
Screenshot

Image
Last edited by desiprints on Mon Jan 15, 2007 9:44 pm, edited 1 time in total.

desiprints
Registered User
Posts: 95
Joined: Wed Sep 08, 2004 4:45 pm

Post by desiprints » Mon Jan 15, 2007 9:40 pm

added demo

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Mon Jan 15, 2007 10:14 pm

...wow 8O


Awesome!
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

desiprints
Registered User
Posts: 95
Joined: Wed Sep 08, 2004 4:45 pm

Post by desiprints » Tue Jan 16, 2007 9:59 pm

added olympus style forum header, still working on it though.

added abit of a change to the wysiwyg editor, runs abit more smoothly now. :)

Selven
Registered User
Posts: 291
Joined: Fri Nov 08, 2002 7:28 am

Post by Selven » Tue Jan 16, 2007 10:20 pm

easy to do:

Code: Select all

#############################################################
## MOD Title:  			TinyMCE integration
## MOD Author:          Selven < lip81@libero.it > (N/A) N/A
## MOD Description:  	This add the powerfull tinyMCE editor to phpBB  		 			 
## MOD Version: 		0.1.0 
## Installation Level:  easy
## Installation Time:   2-3 Minutes
## Files To Edit:       includes/page_header.php, 
##                      templates/subsilver/overall_header.tpl 
## Included Files:		root/includes/functions_tiny.php,
## 						root/includes/shared/index.htm  
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/ 
## for the latest version of this MOD. Although MODs are checked 
## before being allowed in the MODs Database there is no guarantee 
## that there are no security problems within the MOD. No support 
## will be given for MODs not found within the MODs Database which 
## can be found at http://www.phpbb.com/mods/
############################################################## 
## Author Notes: 
##	This mod has written and tested with TinyMCE 2.0.61
##	The gzip function of tinyMCE is related to forum's one (if forum gzip is enabled tinyMCE gzip is enable)
##	For more information about tinyMCE gzip compressor please see documentation on compressor folder and on
##	http://tinymce.moxiecode.com/download.php, the compressor integrated with this mod is version 1.0.8
############################################################## 
## MOD History:
##	01/10/2006 - v. 0.1.0
##		First Release
##		There are problem with normal phpbb bbcode and smilies manager.
##		
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ COPY ]------------------------------------------ 
# 
copy root/includes/functions_tiny.php to includes/functions_tiny.php
copy root/includes/shared/index.htm to includes/shared/index.htm

#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
# 

Download tinyMCE from http://tinymce.moxiecode.com/download.php
Extract it and put jscripts folder to includes/shared/tinymce as it is
You need also to activate html and all needed tags in your board for use this!

# 
#-----[ OPEN ]------------------------------------------ 
#
includes/page_header.php

# 
#-----[ FIND ]------------------------------------------ 
# 
//
// Parse and show the overall header.
//

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
//
//Starting tinyMCE integration
//
if( file_exists($phpbb_root_path . 'includes/functions_tiny.' . $phpEx) & $board_config['allow_html'])
{
	$tiny_path = $phpbb_root_path . 'includes/shared/tinymce/jscripts/tiny_mce/';
	include($phpbb_root_path . 'includes/functions_tiny.' . $phpEx);
}

# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/overall_header.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
<!-- END switch_enable_pm_popup -->

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<!-- BEGIN tinyMCE -->
<script language="javascript" type="text/javascript" src="{tinyMCE.SCRIPT}"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init(
			{
			mode : "textareas",
			theme : "advanced",
			language : "{tinyMCE.LANG}",
			plugins : "table,advhr,advimage,advlink,emotions,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable",
						theme_advanced_buttons1_add_before : "newdocument,separator",
						theme_advanced_buttons1_add : "fontselect,fontsizeselect",
						theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
						theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
						theme_advanced_buttons3_add_before : "tablecontrols,separator",
						theme_advanced_buttons3_add : "emotions,flash,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_path_location : "bottom",
				      	content_css : "{tinyMCE.TEMPLATE}",
				      	relative_urls : false,
				      	extended_valid_elements : "td[*],div[*],form[*],input[*]"
			});
</script>
<!-- END tinyMCE -->

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
functions_tiny.php

Code: Select all

<?
/***************************************************************************
 *                            function_tiny.php
 *                            -------------------
 *   begin                : Oct 1, 2006
 *   copyright         : (C) 2006 Selven
 *   email                : N/A
 *
 *   $Id: function_tiny.php,v 1.0.0 2006/10/01 Selven Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/
if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

// 
// This switch is for enabling the wysiwyg html editor addon "tiny mce"
// 
if ( file_exists( $tiny_path . 'blank.htm' ) )
{
	//
	//Definining language convertor array (phpbb use extended name tinyMCE use international code)
	//
	$convert = array( 
					'arabic'						=> 'ar', 
					'bulgarian'              		=> 'bg', 
					'catalan'						=> 'ca', 
					'czech'							=> 'cs', 
					'danish'						=> 'da', 
					'german'						=> 'de', 
					'english'						=> 'en', 
					'estonian'						=> 'et', 
					'finnish'						=> 'fi', 
					'french'						=> 'fr', 
					'greek'							=> 'el', 
					'spanish'						=> 'es', 
					'gaelic'						=> 'gd', 
					'galego'						=> 'gl', 
					'gujarati'						=> 'gu', 
					'hebrew'						=> 'he', 
					'hindi'							=> 'hi', 
					'croatian'						=> 'hr', 
					'hungarian'						=> 'hu', 
					'icelandic'						=> 'is', 
					'indonesian'					=> 'id', 
					'italian'						=> 'it', 
					'japanese'						=> 'ja', 
					'korean'						=> 'ko', 
					'latvian'						=> 'lv', 
					'lithuanian'					=> 'lt', 
					'macedonian'					=> 'mk', 
					'dutch'							=> 'nl', 
					'norwegian'						=> 'no', 
					'punjabi'						=> 'pa', 
					'polish'						=> 'pl', 
					'portuguese'					=> 'pt', 
					'romanian'						=> 'ro', 
					'russian'						=> 'ru', 
					'slovenian'						=> 'sl', 
					'albanian'						=> 'sq', 
					'serbian'						=> 'sr', 
					'slovak'						=> 'sv', 
					'swedish'						=> 'sv', 
					'thai'							=> 'th', 
					'turkish'						=> 'tr', 
					'ukranian'						=> 'uk', 
					'urdu'   						=> 'ur', 
					'viatnamese'					=> 'vi', 
					'chinese_simplified'			=> 'zh', 
					); 
	//
	//Checking if language files are installed into tinyMCE
	//
	$user_lang = $userdata['user_lang']; 
	if ( !file_exists( $tiny_path . 'langs/' . $convert[$user_lang] . '.js' ) ) 
		{ 
			$user_lang = $board_config['default_lang']; 
			if ( !file_exists( $tiny_path . 'langs/' . $convert[$user_lang] . '.js' ) ) 
				{ 
					$user_lang = 'english'; 
				}  
		} 
	//
	//Converting the found language for using in template
	//
	$tiny_lang = $convert[$user_lang];
	
	//
	//checking what tinyMCE we want to use
	//
	if($board_config['gzip_compress'] == '1' & file_exists($tiny_path . 'tiny_mce_gzip.' . $phpEx))
	{
		$tiny_script = $tiny_path . 'tiny_mce_gzip.' . $phpEx;
	}
	else
	{
		$tiny_script = $tiny_path . 'tiny_mce.js';
	}
	
	$template->assign_block_vars( "tinyMCE", array(
					'SCRIPT'	=> $tiny_script,
					'LANG'		=> $tiny_lang,
					'TEMPLATE' => $phpbb_root_path . 'templates/'. $theme['template_name'] . '/' . $theme['head_stylesheet']
					));
}
?>
This integration also check multilanguage (if you have uploaded also tinymce files) but it no work with bbcode buttons i think is problem derived from textarea but i'm not sure can be a good solution trying to do an bbcode bar for tinymce....
No-more supporting phpBB

desiprints
Registered User
Posts: 95
Joined: Wed Sep 08, 2004 4:45 pm

Post by desiprints » Thu Jan 18, 2007 10:10 pm

worked on updatin the posting abit more, should work correctly except some features still workin gone

HTML TO BBCODE PARSING = 20% DONE
BBCODE TO HTML PARSING = 0% DONE

PhpBBx should also be ready for downloading as a pre-modded forum, current new features included are:

+ Almost exact phpbb 3 olympus cloning

+ TinyMCE Integration (Will be released in Beta)

purpleaxe
Registered User
Posts: 38
Joined: Sat Feb 10, 2007 1:18 am

Post by purpleaxe » Sun Feb 11, 2007 3:01 am

Is it poosible to add new font face ? Not language file .

desiprints
Registered User
Posts: 95
Joined: Wed Sep 08, 2004 4:45 pm

Post by desiprints » Sun Feb 11, 2007 12:15 pm

anyone want to help with development....??

Post Reply

Return to “[2.0.x] MODs in Development”