Opened 16 years ago
Closed 16 years ago
#2432 closed Bug (fixed)
FCKeditor extension does not recognize tags registered by other extensions
Reported by: | Dan Barrett | Owned by: | |
---|---|---|---|
Priority: | Must have (possibly next milestone) | Milestone: | |
Component: | Project : MediaWiki+FCKeditor | Version: | FCKeditor 2.6.3 |
Keywords: | Confirmed Review- | Cc: | candrews@…, gdoermann@…, andrew.tereshko@… |
Description
- Edit a new MediaWiki page with FCKeditor.
- Click the "Wikitext" button to switch to wikitext editing.
- Enter this text:
<mytag>foobar</mytag>
- Save the article.
- Disable FCKEditor on the MediaWiki preferences page.
- Edit the same page.
- The wikitext is now:
<mytag>foobar</mytag>
The wiki parser tag is now broken.
Attachments (1)
Change History (18)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Keywords: | Confirmed added |
---|
Changed 16 years ago by
Attachment: | 2432.patch added |
---|
comment:3 Changed 16 years ago by
Keywords: | Review? added |
---|
Usage: Add in LocalSettings.php:
$RTEprotectedTags[ 'mytag' ] = array(
'protect' => true, false=wiki parsing, true=protect content as <special>
);
To define custom tag with attributes:
$RTEprotectedTags[ 'source' ] = array(
'args' => array('lang','arg2','arg3'),
'protect' => true,
);
comment:4 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
Looks good. Please initialize this variable in FCKeditor.php:
//associative array with definitions of tags to protect $RTEprotectedTags = array();
and add some clean examples and a short comment. It may be an example with source
tag:
/* * Use tag name as a key. * "protect" attribute tells FCKeditor how to proceed with content. * Set it to false to allow wiki text transformation. * When set to true, protect content as a <special> tag */ $RTEprotectedTags[ 'source' ] = array( 'protect' => true, );
(at least until #2324 is solved).
One performance tip:
in_array($tagName, array_keys($RTEprotectedTags))
can probably changed into:
isset($RTEprotectedTags[$tagName])
AFAIK it executes much faster.
comment:5 Changed 16 years ago by
The code "looks good," but... is this really a good solution to the problem? It requires the administrator to predict what tags might exist in the future, and if he/she misses one, then FCKeditor silently modifies the author's text.
A much better solution, IMHO, is for FCKeditor+MediaWiki not to modify what people type! Is this not possible?
One of the things I love about FCKeditor+MediaWiki, compared to (say) some Drupal editors I've used, is that FCKeditor+MediaWiki gives you back what you put in. Write wikitext, get back the same wikitext. The last Drupal editor I used completely mangled my input, turning it into HTML with tons of extra tags, making it completely unmaintainable the next time I tried to edit it.
Silently changing the author's text is bad. Storage and retrieval of wikitext should occur as people expect -- what you put in is what you get out.
comment:6 Changed 16 years ago by
Keywords: | Review- added; Review+ removed |
---|
Unfortunately Review- due to problems with protect set to "false" when using ImageMap and SyntaxHighlight_GeSHi extensions.
djb comment sounds reasonable. "What you put in is what you get out" is something that we would really like to have, however it's not easy to achieve.
Anyway, let's give at least one more configuration option to the administrator.
/* * Regardless of this setting, $RTEprotectedTags settings have higher priority. * * If set to 0, all unknown tags <tag> are changed into HTML entities: <tag> * * If set to 1, all unknown tags are treated by FCKeditor as a special tag. * When switching back to wikitext, <tag> will be displayed as <tag>. * When editing in WYSIWYG mode, all contents inside of this tag will be * transformed into HTML. * * If set to 2, all unknown tags are treated by FCKeditor as a special tag and * content inside of them is displayed as a raw wikitext. */ $RTEprotectAllUnknownTags = 0;
comment:8 Changed 16 years ago by
The patch is not finished and didn't pass the review so please don't use it unless you know how to finish it.
comment:10 Changed 16 years ago by
Is there a copy of the review? What failed? What needs to be fixed?
comment:11 Changed 16 years ago by
Note: When you use the SyntaxHighlight_GeSHi extension and then insert XML code you may protect the source tag, but I don't know if it would be possible to protect the main "source" tag, but it would be impractical to protect all tags used in xml... as they are infinite! We might need a magic word to disable the rich text editor for just a section of the wikitext.
comment:12 Changed 16 years ago by
Cc: | gdoermann@… added |
---|
comment:13 Changed 16 years ago by
After installing the patch "fckLR" replaces the return char within the protected tag. Any ideas?
comment:14 Changed 16 years ago by
Cc: | andrew.tereshko@… added |
---|
Found solution that allows to fix this bug at least for tag extensions (hooks) included in mediawiki...
All we need it init parser object ($wgParser) before use it methots (like $wgParser->getTags() ) in files : FCKeditorParser.body.php ( method construct() ); FCKeditorSajax.body.php ( method wfSajaxSearchSpecialTagFCKeditor() ); mw12/FCKeditorParser_OldPP.body.php ( method construct() );
$wgParser->firstCallInit();
Sorry, but at that moment I don't have condition's to attach diff patch I also sorry for my english =)
comment:15 follow-up: 16 Changed 16 years ago by
The editor is not also mangling links that are inserted via WikiText example:
Would it be possible to add a tag so that the FCK editor would display all text inside of it as WikiText.
eg: <fck-no-parse> Click this? </fck-no-parse>
comment:16 Changed 16 years ago by
Replying to avran:
The editor is not also mangling links that are inserted via WikiText example:
Would it be possible to add a tag so that the FCK editor would display all text inside of it as WikiText.
eg: <fck-no-parse> Click this? </fck-no-parse>
Sorry the first line of my comment should read 'The editor IS also mangling links that are inserted via WikiText example:'
comment:17 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Summary: | Unknown parser tag has brackets changed to < and > → FCKeditor extension does not recognize tags registered by other extensions |
The solution posted by atereshko worked with tested random extensions, good job!
Fixed with [3241].
@avran - please create a separate ticket for issue described in comments 15 & 16 (if this bug still occurs in the latest version of the extension).
Got right the same mistake trying to use the Imagemap tag fr the Impagemap extension