When my extension gets access to an INPUT (type "text") or TEXTAREA element of the currently displayed webpage in Firefox, I can use QueryInterface to cast it to a JS object of type nsIDOMNSEditableElement and then I can access the associated nsIEditor using .editor.
However, Firefox supports other elements to be editable as well, e.g. any element (and its children) is editable if it has the attribute contentEditable set to true. Further a whole document can be editable if it has designMode set to on. In either case, the editable elements are not instances of nsIDOMNSEditableElement; QueryInterface for nsIDOMNSEditableElement fails.
Since those editable elements can also have spell checking enabled (if they have the attribute spellcheck set to true), I assume that there is an instance nsIEditor associated with them.
How would I get a reference to it?
For editable frames (via
designModeproperty) you can retrieve it like this:As to
contentEditable– you seem to be out of luck. I couldn’t find a way to access the editor from JavaScript:nsGenericHTMLElementclass has aGetEditormethod but it is only accessible throughnsIDOMNSEditableElementinterface that only few elements implement.nsIAccessibleEditableTextinterface has anassociatedEditorproperty but it is marked as[noscript]for some reason.contentEditableis a relatively new feature in Gecko and it looks like somebody forgot to make the editor accessible for JavaScript – probably worth filing a bug at https://bugzilla.mozilla.org/.