#3483: Editor removes all attributes of <source> element except 'lang'
-------------------------------------------+--------------------------------
Reporter: RalfSchmelter | Owner:
Type: Bug | Status: new
Priority: Normal | Milestone:
Component: Project : MediaWiki+FCKeditor | Version:
Keywords: |
-------------------------------------------+--------------------------------
Hi,
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!
</source>
}}}
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
--
Ticket URL: <http://dev.fckeditor.net/ticket/3483>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac