Extension:TinyMCE MW

Note about MediaWiki 1.12
'''Several users have reported errors installing this extension in MW 1.12 (see section below); at best it is unstable. Until patches or other fixes are posted, it is not recommended for use with MW 1.12 or later.'''

Note from the Developer
It is free and open source and I am no longer developing this extension at this time. Please feel free to update it and post a new version or send it to me and I will update the wiki. -- Later, Joe

What can this extension do?
If you already have pages written in Mediawiki wikitext, this extension enables Moxiecode's TinyMCE and does not break a majority of Mediawiki wikitext. Also, TinyMCE_MW has a new 'msword' configuration theme. msword follows the MS Office 2003 toolbar layout. Call TinyMCE's,   and a built-in   theme from LocalSettings.php. TinyMCE_MW was built and tested on Mediawiki-1.10.0, IE 6. Successfully tested CategoryTree extension for compatibility with new tags.

Usage
TinyMCE is not naturally a Wikitext editor. TinyMCE is a javascript WYSIWYG editor. With this extension, you can easily use TinyMCE with Mediawiki and provide users with a toolbar editor they may be more familiar with.

Installation
$wgUseTinymce = true;#Init needed for clicking on a new article link $wgDefaultUserOptions ['showtoolbar'] = 0; #new users get this default or modify DefaultSetting.php $wgTinymceTheme = "msword";                #"simple", "advanced", "msword", else none $wgMyWikiURL = "http://$wgDBserver/$wgScriptPath/index.php/"; $wgExt_valid_elements = "data[table|template],repeat[table|sort],categorytree[mode|depth],inputbox[type|bgcolor|width|default|preload|editintro|buttonlabel|searchbuttonlabel|break], big"; require_once("$IP/extensions/TinyMCE_MW.php");
 * 1) Download TinyMCE and unzip into your MediaWiki extensions path (the result should look like ..\Yourwiki\extensions\tinymce\...)
 * 2) please clarify what should be downloaded, there are a bunch of files!
 * 3) Unzip _everything_ in the archive into above specified directory.
 * 4) Copy and create TinyMCE_MW.php in your MediaWiki extensions path  (..\Yourwiki\extensions)
 * 5) Add the following lines to LocalSettings.php:
 * 1) TinyMCE_MW.php: Easily implement Moxiecode's TinyMCE into MediaWiki

Code
Copy and paste from TinyMCE_MW.php

Limitations and Bug/Error
I think this will work for the heading 1 stuff. Anyone care to poke some holes it it for us all? while (preg_match("|=[A-z0-9\s'.-]+=|is", $tinymcetext, $a)) { $value = implode(",", $a); $value = str_replace("=", "", $value); $r = preg_replace("|=[A-z0-9\s'.-]+=|is", "".$value." ", $a[0]); $tinymcetext = str_replace($a[0], html_entity_decode($r), $tinymcetext); } Thanks -Ryan rahst12 3:08am March 15, 2009
 * Does not support Wikitext Bullet list.
 * Does not support Wikitext Numbered list.
 * Does not support Wikitext Redirect to another article.
 * Does not support Wikitext Tables.
 * Does not support h1 tags because "|=.*?=|is" grabs too much. Just manually use h1 tags.
 * you could easily use this: "|(?<!=)=[^=]+=(?!=)|" to support h1 tags -- Rabbitt 18:26, 18 April 2008 (UTC)
 * 1) ==heading 1==

ERROR : on file upload
Php fatal error: maximum execution time of 30 seconds exceeded in TinyMCE_MW.php on line 231 and line 234 when file upload is selected. Results in blank page and hence cannot upload files.

(Please keep in mind that TinyMCE does handle these features)

there is a bypass to the problem by adding another flag

In LocalSettings.php (root wiki dir) add the following line before require_once("$IP/extensions/TinyMCE_MW.php"); $wgRunTinyMce = true;

In SpecialUpload.php (include dir) change the function wfSpecialUpload to look like this function wfSpecialUpload {	   global $wgRunTinyMce; global $wgRequest; $wgRunTinyMce = false; $form = new UploadForm( $wgRequest ); $form->execute; $wgRunTinyMce = true; }

and the last file you need to edit is TinyMCE_MW.php (extension dir) in function wfTinymceParserPaste

add global definition for wgRunTinyMce at the beginning of the function change the following line: if ($ns_allowed and $wgUseTinymce ) {

to if ($ns_allowed and $wgUseTinymce and $wgRunTinyMce) {

sorry for my bad English feel free to rewrite the instruction

MW-Tables not correct
Hi! Thanks for this extension! I installed in on my wiki but now all old tables in wiki syntax are shown in plaintext code. What do i have to change for enabling the standard mw parser as well? -- 195.127.44.186 15:12, 4 July 2007 (UTC)


 * Hi, I don't recommend installing TinyMCE for already existing Mediawiki Installations. I have not had time to test Wikitext tables, in great detail, but I could see how it would not parse correctly.  Have you tried using the Disable Advanced Editor link the saving the wikitext table?  Some other ways could be implemented to handle this problem. 1) Detect the wikitext table tags and disable TinyMCE_MW (see function wfCheckBeforeEdit). 2)Add a wikitext handler in function wfTinymceParserPaste so it will get formatted properly. 3) Just reedit the tables using the advanced editor. --JoeSox 15:56, 4 July 2007 (UTC)

Hi! I've a related Problem with this extension. It seems to be impossible to include specialpages, when $wgUseTinyMCE is on. But I've no opinion what the reason is. If I include a special page e.g., then I get some suspecious text-dump like this: �UNIQ5a6b14b632c8782d-item49d3e5cb5347be63 Other Pages can be included without Problems. I've taken a look on TinyMCE_MW.php and found out, that there are some tags replaced with md5(tagopen)_number which looks similar. But I can't solve this Problem alone. Have you perhaps an idea what is causing this bug?

Sorry, my english may be bad.

regards

-Stefan- 79.211.199.52 15:19, 19 September 2007 (UTC)

Its me again! Line breaks do not work as well. In a standard mw installation, a blank line is interpreted as a line break. If it is possible i would like to use tinymce only for creating and editing tables. Is there a possibility? -- 195.127.44.186 15:17, 4 July 2007 (UTC)


 * I have had challenges with line breaks, which you may see in the extension code. Most of this is caused by TinyMCE's built-in reformating.  Some of it is customizable.  Just dig into the TinyMCE documentation and things may become clearer to you on how to customize TinyMCE_MW.  Let me know if you have more questions or have some useful additions for the extension. --JoeSox 15:56, 4 July 2007 (UTC)

Error: MediaWiki 1.10.1 + TinyMCE 2_1_1_1 + MSServer 200
Aftre integrating TinyMCE 2_1_1_1 in my project (MediaWiki 1.10.1 + WAMP + MSServer 2003), MediaWik correctly work with easy, small article only. And TinyMCE don't work.

"Hide Editor" is represented in an edit window. After click on this, it changes on "Enable Advanced Editor"

If article no easy then I take Errors Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\mediawiki\extensions\TinyMCE_MW.php on line 223 or Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\mediawiki\extensions\TinyMCE_MW.php on line 226 BunakovM 13:38, 9 August 2007 (UTC)

Another Error!
Fatal error: Cannot instantiate non-existent class: stripstate in /home/atuaesco/public_html/extensions/TinyMCE_MW.php on line 237 What can I do?

Error: MediaWiki 1.12 + TinyMCE
How can I fix it? Whats the new format?

Interner Fehler

Parser::replaceVariables called using the old argument format

Backtrace:


 * 1) 0 /data/apache/users/.../.../www/Wiki/includes/Parser.php(4526): Parser->replaceVariables('', Array)
 * 2) 1 [internal function]: Parser->attributeStripCallback('', Array)
 * 3) 2 /data/apache/users/.../.../www/Wiki/includes/Sanitizer.php(479): call_user_func_array(Array, Array)
 * 4) 3 /data/apache/users/.../.../www/Wiki/extensions/TinyMCE_MW.php(253): Sanitizer::removeHTMLtags('MediaWiki wurde...', Array)
 * 5) 4 [internal function]: wfTinymceParserPaste(Object(Parser), ' MediaWiki wu...')
 * 6) 5 /data/apache/users/.../.../www/Wiki/includes/Hooks.php(113): call_user_func_array('wfTinymceParser...', Array)
 * 7) 6 /data/apache/users/.../.../www/Wiki/includes/Parser.php(432): wfRunHooks('ParserAfterTidy', Array)
 * 8) 7 /data/apache/users/.../.../www/Wiki/includes/Article.php(3174): Parser->parse('MediaWiki wurde...', Object(Title), Object(ParserOptions), true, true, 21)
 * 9) 8 /data/apache/users/.../.../www/Wiki/includes/Article.php(821): Article->outputWikiText('MediaWiki wurde...')
 * 10) 9 /data/apache/users/.../.../www/Wiki/includes/Wiki.php(390): Article->view
 * 11) 10 /data/apache/users/.../.../www/Wiki/includes/Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
 * 12) 11 /data/apache/users/.../.../www/Wiki/index.php(90): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
 * 13) 12 {main}

With TinyMCE version 3.1.1, I have the same problem. To solve this problem, I have only replaced the line 4526 (is the same line number) $text = $this->replaceVariables( $text, $frame ); with $text = $this->replaceVariables( $text, false); But, I have another problem. The old articles are displayed without carriage return ! So an old document with 3 lines is now displayed on one single line ! Have somebody a solution to this new problem ?

Requested Features

 * Enable Ajax usage.
 * Enable Embedded of Youtube Vids like in FramedVideo (FramedVideo dosn´t work with the editor)

Changing TinyMCE Font and Font Size
After hours of trial and error and googling, I am deciding to share some very helpful information. NOTE:To change the default font and size for TinyMCE, add these two lines to your theme's editor_content.css body{} section: font-family: Arial; font-size: 14px; NOTE:To decrease the space between lines after a carriage return place this line to your theme's editor_content.css: p {margin: 0; padding: 0;}

NOTE: Delete all of your cache (temporary internet files), then close your browser. Then re-open your browser.

Conclusion
Moxiecode's TinyMCE is a very impressive WYSIWYG editor. I looked all over for a MediaWiki extention or any information. Hopefully, this works for you and is helpfull. --JoeSox 03:41, 24 June 2007 (UTC)

Comments/Other

 * Perhaps a mailinglist / forum would be helpfull? - I`ve run into a couple of problems, especially with special tags coming from other extensions.


 * I have a suggestion! How about responding the the above edits with errors. Your extension DOES NOT WORK with MW 1.12


 * It does work with MW 1.12! see discussion


 * I don't know what "discussion" you're referring to, but there's a big section above titled "Error: MediaWiki 1.12 + TinyMCE" listing a huge number of errors that I also experience when I try to install this. I don't see any responses to this section. Have you verified that this actually works with 1.12? You now have two users verifying that it does not work with 1.12. If you have some sort of fix or response please post it, otherwise this extension should be delisted as it's broken.


 * How could one integrate Semantic MediaWiki with TinyMCE? The factbox doesn't show. Is this a parser fault?