Hi
Im writing a plug-in which takes pictures from a photo album into the editor.
When I store my html in my database, I would like to represent my Photo with a user defined tag: <PHOTO _photoID=123 />. This is also how i would like my html to look like in the Source mode. But of course when I switch to WYSIWYG mode I would like to replace the PHOTO tag with real html which includes the img and some text.
Now I have this working in IE, but I have problems with the Firefox. The code for IE looks like this:
var aSpans = FCK.EditorDocument.getElementsByTagName('PHOTO');
for ( var i = 0 ; i < aSpans.length ; i++ )
{
if ( aSpans[i]._photoID)
{
var oSpan = FCK.EditorDocument.createElement( 'DIV' ) ;
oSpan._photoID= aSpans[i]. _photoID
// Removed som code here which is not relevant
aSpans[i].parentNode.insertBefore( oSpan, aSpans[i] ) ;
}
}
var html= FCK.EditorDocument.body.innerHTML;
html = html.replace(/<\/?PHOTO[^>]*>/gi, "" );
FCK.EditorDocument.body.innerHTML=html;
The code which does not work on FireFox is
oSpan._photoID= aSpans[i]. _photoID
Anyone knows how to do this??
Asbjorn
Im writing a plug-in which takes pictures from a photo album into the editor.
When I store my html in my database, I would like to represent my Photo with a user defined tag: <PHOTO _photoID=123 />. This is also how i would like my html to look like in the Source mode. But of course when I switch to WYSIWYG mode I would like to replace the PHOTO tag with real html which includes the img and some text.
Now I have this working in IE, but I have problems with the Firefox. The code for IE looks like this:
var aSpans = FCK.EditorDocument.getElementsByTagName('PHOTO');
for ( var i = 0 ; i < aSpans.length ; i++ )
{
if ( aSpans[i]._photoID)
{
var oSpan = FCK.EditorDocument.createElement( 'DIV' ) ;
oSpan._photoID= aSpans[i]. _photoID
// Removed som code here which is not relevant
aSpans[i].parentNode.insertBefore( oSpan, aSpans[i] ) ;
}
}
var html= FCK.EditorDocument.body.innerHTML;
html = html.replace(/<\/?PHOTO[^>]*>/gi, "" );
FCK.EditorDocument.body.innerHTML=html;
The code which does not work on FireFox is
oSpan._photoID= aSpans[i]. _photoID
Anyone knows how to do this??
Asbjorn