[wp-testers] Problem with custom TinyMCE button
Karl Wångstedt
kalle at wangstedt.net
Sat Jan 17 17:14:12 GMT 2009
Hi all
I'm building an update to a site, and have decided to use xHTML5 to
make use of the new <video> element. On my developing server I've used
WP2.6.3, and now when it's time to release the site, I've upgraded to
WP2.7.
But when I did that, I ran in to a problem with a custom TinyMCE
button that I've built. The button is supposed to take a link to a
video file (<a href="video.mov">) and convert it to a <video> element
with the link intact inside it. The button works fine in 2.6, but in
2.7 it removes the link from the editor and nothing gets inserted but
a <span style="color: #000099; text-decoration: underline;"> </span>.
Can someone please point me in the right direction.
The code for the button is:
// Register button
ed.addButton('videolink', {
title : 'videolink.desc',
image : url + '/img/videolink.gif',
onclick : function() {
// Add you own code to execute something on click
var kewvalue = ed.selection.getContent({format : 'text'}); // Get
the selected text
var e = ed.dom.getParent(ed.selection.getNode(), 'A'); // Get the
link
var kewuri = ed.dom.getAttrib(e, 'href'); // The URL from the link
// Add new code to replace the selected text
ed.selection.setContent('<p class="align02"><video src="'+kewuri
+'" controls="true"><a href="'+kewuri+'">'+kewvalue+'</a></video></p>');
}
});
Thank you
Karl Wångstedt
----------------------------------
Wångstedt nova
www.wangstedt.net
Karl Wångstedt 0278-61 12 33
Stenhuggarvägen 3g 070-578 13 04
821 41 BOLLNÄS
----------------------------------
Det här brevet skickades med en Macintosh från Apple.
Garanterat virusfri med Mac OS X.
More information about the wp-testers
mailing list