Opened 15 years ago

Closed 12 years ago

#3483 closed Bug (invalid)

Editor removes all attributes of <source> element except 'lang'

Reported by: RalfSchmelter Owned by:
Priority: Normal Milestone:
Component: Project : MediaWiki+FCKeditor Version:
Keywords: HasPatch Cc:



the editor removes all attributes of the <source> element (used for syntax highlighted code), except the 'lang' attribute. While it would be nice, if all attributes could be edited by the FCKEditor, the non-editable ones should at least not be removed when switching back to Wikitext.

You can reproduces this bei adding the following to a Wiki page:

<source lang="java" line="on" start="1" enclose="pre" strict="on">
Hello World!

Open it in the editor and switch to Wikitext. Every attribute is gone, except the 'lang' one.

A simple fix is to just include the other supported attributes in 'fckplugin.js':

case 'fck_mw_source' :
    var refLang = htmlNode.getAttribute( 'lang' ) ;
    var refLine = htmlNode.getAttribute( 'line' ) ;
    var refStart = htmlNode.getAttribute( 'start' );
    var refEnclose = htmlNode.getAttribute( 'enclose' );
    var refStrict = htmlNode.getAttribute( 'strict' );

    stringBuilder.push( '<source' ) ;
    stringBuilder.push( ' lang="' + refLang + '"' ) ;
    stringBuilder.push( ' line="' + refLine + '"' ) ;
    stringBuilder.push( ' start"' + refStart + '"' ) ;
    stringBuilder.push( ' enclose="' + refEnclose + '"' ) ;
    stringBuilder.push( ' strict="' + refStrict + '"' ) ;
    stringBuilder.push( '>' ) ;
    stringBuilder.push( FCKTools.HTMLDecode(htmlNode.innerHTML).replace(/fckLR/g,'\r\n') ) ;
   stringBuilder.push( '</source>' ) ;

   return ;

Maybe a more general solution would be better, which just includes all the supplied attributes, since you would not have to update this code every time a new one was added. I tried this, but the simple approach got me all the synthetic FCKEditor attributes too.

Best regards, Ralf

Change History (2)

comment:1 Changed 15 years ago by Artur Formella

Keywords: Confirmed HasPatch added

comment:2 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