Midas

From MozillaZine Knowledge Base
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

What is Midas?

Midas is a rich text editor built into Firefox that is similar to an editor built in to Microsoft Internet Explorer. Midas can be turned on by setting the designMode property of an HTML document to "on". This can be done via JavaScript. With Midas enabled, the page becomes completely editable by the user and a whole set of other JavaScript commands become available.

How is it similar to Internet Explorer's feature? How is it different?

You enable this editor in Internet Explorer by adding the "ContentEditable" attribute to that element in the HTML. Basically, it turns that element into a miniature text editor with a lot of neat features such as the ability to format text and insert images. Firefox does not support the "contenteditable" HTML attribute, but it does support a property of the document object in JavaScript called "designMode"

Rather than using the "contenteditable" attribute on individual HTML elements, Midas makes an entire document editable. Beyond that, the code for Mozilla's editor is very similar to the code for Internet Explorer's editor. Mozilla's editor can format text and insert links and images just like Internet Explorer's editor. Beyond the built in execCommand features of the editors, the other features you will want probably involve the selection and range objects. Mozilla handles the selection object different from IE. Mozilla also handles the range object according to standards, which is different from IE.

Can I see an example of Mozilla's editor?

Here's a simple example. Another example, cunaAform, demonstrates much more of what it can do. cuneAform is also available as a Firefox extension.

Here's another example that works in both IE and Mozilla.

If Firefox's editor only works on an entire document and not a specific element, then how do I embed an editor on a webpage?

Most people use an iframe to embed the editor on the page. See that simple example to get an idea.

Do any other web browsers support this kind of editor?

Safari has an implementation similar to IE.

Do any real-world websites use Mozilla's editor?

Where can I find the documentation

I'm not a developer. How'd I get here?

Maybe you were looking for rich text editing to answer questions about websites like Hotmail, Yahoo! Mail, and some forum websites.