Extension talk:TinyMCE MW

Code TinyMCE_MW.php
'''Click edit THEN copy and paste. If you don't, special characters will convert and the extension will not work.'''

|is", $text, $a)) {		$wgUseTinymce = false;}	else{$wgUseTinymce = true;}	return true; }

?>

6/24/07 v0.2.1

 * Misc. fixes

6/25/07 v0.3.0

 * Fixed TinyMCE_MW to work with inputbox extension.
 * Section now for custom extension tags.

6/26/07 v0.4.0

 * Updated inputbox handler to fix 'p /p' tags
 * Does not support wikitext h1 tags because "|=.*?=|is" grabs too much.
 * Support toggling. Enable and Disable TinyMCE toolbar by a link in upper right corner of editpage.

6/27/07 v0.4.1

 * Set 'convert_newlines_to_brs : false' ; it was inserting new br tags on each re-edit

6/28/07 v0.4.3

 * WikiDB tag support. Disables TinyMCE before editing any articles with WikiDB tags.

7/1/07 v0.5.3

 * Added better link support. Added relative_url, remove_script_host, document_base_url

9/20/07 v0.5.4

 * Modified #Allow_repeat_tagsm and #Allow_categorytree_tags replacements

Error.
Fatal error: Cannot instantiate non-existent class: stripstate in /home/atuaesco/public_html/extensions/TinyMCE_MW.php on line 237 I have this error when i try to edit a page

Try version 0.5.4 --JoeSox 18:33, 20 September 2007 (UTC)

Stilling having this problem. Fatal error: Cannot instantiate non-existent class: stripstate in mysite\extensions\TinyMCE_MW.php on line 245 -2009.6.21

Slight fix
I use a wiki with quite a lot of rewriting happening. In my case I need to be able to set $wgTinymceDir from my LocalSettings.php. This small modification makes this possible. Line:283 if(!isset($wgTinymceDir)) $wgTinymceDir = "tinymce"; --Rob 02:39, 4 October 2007 (UTC)

The new bugfix 0.5.4 has trouble with Extension:CategoryTree
If I turn TinyMCE_MW on, end save an article with the &lt;categorytree&gt;-tag into the Editorbox (makes no difference if "hide editor" is used), then I get this error: Fatal error: Maximum execution time of 30 seconds exceeded in /srv/www/htdocs/wiki/extensions/TinyMCE_MW.php on line 119 This is on line 119 of TinyMCE_MW.php: $tinymcetext = str_replace($a[0], html_entity_decode($r), $tinymcetext);#htmlentities With your earlier version 0.5.3 this doesn't appear, so it seams to cause a bug and not fix. By comparation of these version there are big differences between the lines around 119, especialy this looks a little bit supecious: New in 0.5.4: #Allow_categorytree_tags while (preg_match("| |is", $tinymcetext, $a)) { ... Old code in 0.5.3: #Allow_categorytree_tags while (preg_match("|&amp;lt;categorytree&amp;gt;(.*?)&amp;lt;/categorytree&amp;gt;|is", $tinymcetext, $a)) { ... We now rollback to 0.5.3 but I'll be greatefull if this plugin will improved in future.

Regards -Stefan

79.211.199.93 12:02, 4 October 2007 (UTC)

mediawiki 1.12.0
Does anyone have this installed on mediawiki version 1.12.0? I tried following the directions over here: TinyMCE_MW.

Setup: MW 1.12 | Windows 2003 w/ IIS. | MYSQL 5.x | PHP 5.25

But i had no luck, i got the following error: Internal error

Parser::replaceVariables called using the old argument format

Backtrace:

Mlong212 05:29, 20 April 2008 (CEST)
 * 0 W:\Wiki\mediawiki-1.12.0\includes\Parser.php(4526): Parser->replaceVariables('', Array)
 * 1) 1 [internal function]: Parser->attributeStripCallback('', Array)
 * 2 W:\Wiki\mediawiki-1.12.0\includes\Sanitizer.php(479): call_user_func_array(Array, Array)
 * 3 W:\Wiki\mediawiki-1.12.0\extensions\TinyMCE_MW.php(255): Sanitizer::removeHTMLtags(' Me...', Array)
 * 1) 4 [internal function]: wfTinymceParserPaste(Object(Parser), ' Medi...')
 * 5 W:\Wiki\mediawiki-1.12.0\includes\Hooks.php(113): call_user_func_array('wfTinymceParser...', Array)
 * 6 W:\Wiki\mediawiki-1.12.0\includes\Parser.php(432): wfRunHooks('ParserAfterTidy', Array)
 * 7 W:\Wiki\mediawiki-1.12.0\includes\Article.php(3174): Parser->parse(' '''MediaWi...', Object(Title), Object(ParserOptions), true, true, 8)
 * 8 W:\Wiki\mediawiki-1.12.0\includes\Article.php(821): Article->outputWikiText(' '''MediaWi...')
 * 9 W:\Wiki\mediawiki-1.12.0\includes\Wiki.php(390): Article->view
 * 1) 10 W:\Wiki\mediawiki-1.12.0\includes\Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
 * 2) 11 W:\Wiki\mediawiki-1.12.0\index.php(90): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
 * 3) 12 {main}

You need to change the following line in TinyMCE_MW.php (~line 255) $tinymcetext = Sanitizer::removeHTMLtags( $tinymcetext, array( &$q, 'attributeStripCallback' ) );

to the following $tinymcetext = Sanitizer::removeHTMLtags( $tinymcetext, 'attributeStripCallback', array( &$q ) );

Very close to working! The above change allowed me in to the main page without halting on error, however:
 * 1) Additional html code is shown on everything & the page layout is not as it was (without even editing yet)
 * 2) When trying to edit a page it displays the error: PHP Fatal Error: Maximum execution time of 30 seconds exceeded in (filepath)\extensions\TinyMCE_MW.php on line XXX
 * 3) XXX because it is different each time though it does seem to hit on a line containing: $tinymcetext = str_replace($a[0], html_entity_decode($r), $tinymcetext);#htmlentities

Cannot modify header information
I got several warnings like

"Warning: Cannot modify header information - headers already sent by [...]"

my solution:

"eliminate additional whitespace before and after the and tags in the TinyMCE_MW.php file" (http://tinymce.moxiecode.com/punbb/viewtopic.php?id=8233) which was for me to delete the tags: and

by Magnus Rode

All's well in 1.12 except...
Have TinyMCE_MW.php working in 1.12 but  tags are displaying as: UNIQ229ef7f677e8689b-pre-00000004-QINU If I remove the following line from TinyMCE_MW.php: $tinymcetext = $q->replaceVariables($tinymcetext); ..the  tags then work

...but are not parsed.

So there's something in 1.12 that doesn't appreciate replaceVariables when parsing  tags.

In Eric Hartwell's Technotes he has a similar problem caused by recursively calling the parse function in parser.php.

It seems TinyMCE_MW.php may be flawed following changes to MediaWiki's parsing since 1.10.

Anyone have any suggestions as to how to fix the extension for 1.12?

--Nigelm 20:39, 26 May 2008 (UTC)

Announcement: New TinyMCE Plugin
I am currently working on a new TinyMCE plugin that takes a slightly different approach to WikiText.

Instead of trying to use the MediaWiki plugin to make MediaWiki understand HTML, the plugin that I have written (and will be posting in the next week or so) simply uses the MediaWiki plugin to embed TinyMCE into MediaWiki, and uses a separate TinyMCE plugin (also written by me and that will be included in the package) that handles Translation of WikiText into HTML so that TinyMCE can work with it, and HTML into WikiText so that what is saved into the Wiki is as compatible with the rest of the wiki as possible.

This approach ensures that only limited HTML markup is saved in the articles, and also has the advantage of being able to view the source of the page (in TinyMCE) as WikiText instead of HTML. Also, since we are not tampering with the Wiki's guts, the  tags work. I also have tested this with many of the advanced TinyMCE plugins such as "inlinepopups", and the add-on plugins such as "TinyMCE SpellChecker" and "TinyMCE Compressor". (As well as several other custom plugins I have written).

The new plugin works with version 3.2.2.3 of TinyMCE (the most recent version of TinyMCE as of this writing.)

I am currently testing with MediaWiki 1.12.0, but will be upgrading to 1.14.0 in the next week, and will release the code shortly afterwards.

This plugin is being used by a project that I am actively involved with, and will be actively developed for use in that project. Currently, the plugin supports only basic WikiText markup, but I have plans to try to add buttons for the  tags, as well as advanced features such as templates, categories, and other features to the plugin.

One question I DO have is this: should I post the plugin here, or create a new project for this plugin?

--Draxxon 03:55, 17 April 2009 (UTC)

Post here
I'd post it here, as the current plugin isn't fully functional it is of little use to anyone. I'd rather see a working plugin available. Please let us know when you do release it.

--Craigbruce 11:33, 19 May 2009 (UTC)