Opened 16 years ago

Closed 12 years ago

#2157 closed Bug (invalid)

editor strips off image comments containing wikitext

Reported by: Patrick Owned by:
Priority: Normal Milestone:
Component: Project : MediaWiki+FCKeditor Version: FCKeditor 2.5.1
Keywords: Cc: mike.dambrogia@…, david@…

Description

If an image's comment contains wikitext, the comment gets stripped off completely when loaded into the editor.

Steps to reproduce: In 'wikitext' editing mode, create an image, and in its comment, put some wikitext such as a media link (example: [[Image:samplefile.png|thumb|right|300px|some caption [[Media:somefile.pdf|PDF version]]]]), and then save or preview the page (if saving, go back to edit again). When the page is re-loaded into the editor, the caption is completely blank.

On line 202 of FCKeditorSkin.body.php, if

if (isset($fp['alt']) && !empty($fp['alt']) && false !== strpos(FCKeditorParser::$fkc_mw_makeImage_options, $fp['alt']) && $fp['alt'] != "Image:" . $orginal) {

is changed to

if (isset($fp['alt'])) {

, the caption will load, but with the wikitext stripped. So in the above case, the comment would become ("some captionPDF version"). This is better than no caption at all, but still not desired behavior.

Until the interface can be modified to allow WYSIWYG caption editing, it should put the raw wikitext into the caption.

I am using FCKeditor 2.5.1 with MediaWiki 1.12.0

Change History (7)

comment:1 Changed 16 years ago by Wojciech Olchawa

Keywords: Confirmed added

Confirmed using MediaWiki 1.12 and the latest FCKeditor SVN release.

comment:2 Changed 16 years ago by Wojciech Olchawa

#2230 has been marked as DUP

comment:3 Changed 16 years ago by Wiktor Walc

Tempoary fix: [2089].

It seems that it can't be fixed without overwriting replaceInternalLinks function from the old Parser. There is no other way to affect this code:

if ( $ns == NS_IMAGE ) {
	wfProfileIn( "$fname-image" );
	if ( !wfIsBadImage( $nt->getDBkey(), $this->mTitle ) ) {
		# recursively parse links inside the image caption
		# actually, this will parse them in any other parameters, too,
		# but it might be hard to fix that, and it doesn't matter ATM
		$text = $this->replaceExternalLinks($text);
		$text = $this->replaceInternalLinks($text);

		# cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
		$s .= $prefix . $this->armorLinks( $this->makeImage( $nt, $text ) ) . $trail;
		$this->mOutput->addImage( $nt->getDBkey() );

		wfProfileOut( "$fname-image" );
		continue;
	} else {
		# We still need to record the image's presence on the page
		$this->mOutput->addImage( $nt->getDBkey() );
	}
	wfProfileOut( "$fname-image" );
}

this is the line which should be changed before going further...

$this->replaceInternalLinks($text);

it doesn't look like an easy task though.

comment:4 Changed 16 years ago by MikeD

Cc: mike.dambrogia@… added

new user, working on resolving this. mediawiki 1.12 with fck 2.5.1. There appear to be 4 points of impact: fck editor load, change from fckeditor to wikitext, change from wikitext back to fckeditor, and saving page.

the links that we are seeing trouble with look like:

[[Image:Protozoa.jpg|right|200px|thumb|(Source: [http://www.biodiversity.uoguelph.ca Biodiversity Institute of Ontario])]]

*when the article is loaded*: wikitext, including the caption tag (held as "alt") is translated correctly up to the point where the sanitizer is run. line 4618 in \mediawiki\includes\Parser_OldPP.php. interesting comment in that snippet that states: "make sure there are no placeholders in thumbnail attributes that are later expanded to html- so expand them now and remove the tags", no explanation as to why or what the benefit to other tags might be. notice that the sanitizer is only run against the alt tag portion of the image wikilink. looks like the only way to remove this is to comment out that line but still working towards a more independent fix, perhaps via mw hooks

comment:5 Changed 15 years ago by Andy Owen

Having same problem still, which is a shame.

Running latest Dev release, with WikiMedia 1.13.3.

Also is "parsing out" the 'new' Link= tag in WikiMedia

(i.e.

{{{[[Image:Counts2 database dropped tables001.png|thumb|left|200px|Link=Media:Counts2_database_dropped_tables.pdf|Counts2 Dartabase Dropped Tables]] }}} Becomes

[[Image:Counts2 database dropped tables001.png|thumb|left|200px|Counts2 Dartabase Dropped Tables]]

comment:6 Changed 14 years ago by David Ward

Cc: david@… added

Has there been a resolution to this?

I am experiencing the exact same issues.

Thank you.

PS How do you know which version of FCKeditor you are running?

Thanks

comment:7 Changed 12 years ago by Jakub Ś

Resolution: invalid
Status: confirmedclosed

Since FCKeditor is no longer supported and was replaced with CKEditor, active development of the MediaWiki extension and support for it are also finished.

I’m closing this ticket as it is no longer valid.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy