Sizzle, IE 8 and Paste

April 22nd, 2009 by 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 | 2 Comments »

TinyMCE trying to take a grip on the paste issue

April 20th, 2009 by Afraithe

Spocke has been working hard trying to solve the issue with pasting in various browsers, cleaning up MS Office junk etc. The result is that the new paste plugin is now included in the SVN trunk and will be released with the next TinyMCE version sometime very soon.

On other news, Microsoft has implemented TinyMCE in their many forums, MSDN, Technet, Answers, Expression and the http://social.microsoft.com/Forums.

Posted in Cool stuff, Development, Software, Work | 7 Comments »