Sizzle, IE 8 and Paste
Spocke We recently introduced the new Sizzle CSS selector engine to the TinyMCE core. But I guess we haven’t explained much what it really means for the users of TinyMCE.
The Sizzle engine enables you to use CSS level 3 expressions when developing plugins and integration logic. For example you can select all paragraphs that matches a specific class or all parent elements matching a specific pattern. We used to have a custom CSS level 1 engine in previous releases but maintaining it was moving us out of focus for the core development of the actual product.
Anyway here are some examples on how to use the Sizzle engine trough the TinyMCE DOM API:
// Will select all paragraphs with the someclass and with the someattr
var nodes = tinyMCE.activeEditor.dom.select('p.someclass[someattr=somevalue]');
// Will select all parent p and div elements of the specified element
var nodes = tinyMCE.activeEditor.dom.getParents('p,div', someElm);
// Or check if a specific element matches the expression
if (tinyMCE.activeEditor.dom.is(someElement, 'p.someclass'))
alert('Match.');
A complete reference of the selector patterns you can use can be found on the Sizzle documentation page.
The current version of TinyMCE has some issues with focus on IE 8 this will be addressed in the upcoming release. There has also been some rendering quirks in this new browser version. But it has otherwise not been any reports of IE 8 specific issues. It’s just a bummer that this browser is still so far behind when it comes to web standards.
TinyMCE has basically two types of code IE specific and W3C specific it’s a shame that even with this latest version it doesn’t have some of the core features other browser has. But I must say that IE is a very stable platform when it comes to it’s contentEditable support the things that work works extremely well compared to other browsers. IE is just old it’s not poorly written.
We recently merged the paste2 google code project into the TinyMCE trunk. We have been working hard on this new plugin since we think one of the most common tasks a end user does is pasting contents from standard office applications like Microsoft Word. The default HTML contents you get from Word is a total mess, some speculate that it is in this format to throw other browser vendors of track so they came up will all kinds of junk to beat Netscape and that junk is still in there.
Anyway, this new plugin makes it possible to auto detect word contents on normal Ctrl+V paste operations on all browsers. This means that you don’t need to use the old “paste from word” button in the toolbar. This button was hard to use for novice users and easy to miss.
This plugin uses lots of odd tricks to grab the HTML from the clipboard some of these tricks will be removed in the future when the browsers implement a proper way of dealing with the clipboard. There is a HTML 5 specification on how this should work and the Gecko and WebKit engines are pretty close to a good implementation of these specs.
We will release a new version of TinyMCE later this week. We just need to test it some more and especially the new paste plugin.
Posted in Development, Software, Uncategorized, Work
Excellent new release which helps use deliver an exceptional email marketing product. Makes it easy for us to custom configure TinyMCE as our Email Content Editor, leveraging our knowledge of email compatibility to produce robust email marketing software for effective email marketing.
April 30th, 2009 at 22:37Hey Spocke,
Since there is no longer any need to use the dialogs to paste contents from third party sources perhaps the “pasteword” option should be removed from the documentation?
http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste
May 8th, 2009 at 22:23As far as I can tell the problem with ie8 is, as of the 14th of march 2010, still very much alive: most commands using the selection do not work: the “b”, “i”, “u” buttons, to just name a few, do not format the selection, but reset the select point to the very begining of the edited text.
March 15th, 2010 at 00:31This behaviour is exhibited through viewing the page http://tinymce.moxiecode.com/examples/full.php via ie8 on windows XP.
PS: I am not an ie8 lover: I commonly use FF3; but I need to test on both platforms for compatibility issues…
I couldn’t reproduce this except when I click out side the buttons on the actual toolbar. File a bug report on SF with proper steps for us to reproduce it and we will take a look at it.
March 16th, 2010 at 14:03