edit-current-field-in-external-editor: better file extensions for temp files
commitab3ed1d01c3dd7c6fe4b5a4ad8e0837d3b669925
authorJohn Foerch <jjfoerch@earthlink.net>
Fri, 31 Dec 2010 05:53:31 +0000 (31 00:53 -0500)
committerJohn Foerch <jjfoerch@earthlink.net>
Fri, 31 Dec 2010 18:25:06 +0000 (31 13:25 -0500)
tree0776aa1c7e8c38830da1058092f1198f05900060
parentb4c3b3fd366532500f5ff6c3d7bbe74a70499e95
edit-current-field-in-external-editor: better file extensions for temp files

Since edit-current-field-in-external-editor now supports external editing
of richedit fields, whose contents are html, the previous system of always
giving the temp file an extension of "txt" is no longer adequate. This
patch makes the command choose the default extension based on the mime
type being edited, but also provides a user variable that can be used to
override these choices.

This patch contains two breaking changes:

 * variable edit_field_in_external_editor_extension has been removed, and
   superseded by a mime-type table external_editor_extension_overrides
   which maps mime types to extensions.  If you previously used this
   variable to set the temp file extension to "foo", for example, you
   would update your rc to do the following instead:

     external_editor_extension_overrides.set("text/plain", "foo");

 * function get_filename_for_current_textfield has been superseded by
   external_editor_make_base_filename, which takes as its arguments the
   root element being edited and the top document of the buffer containing
   the element.  The top document is more useful than the element's own
   ownerDocument in some cases, such as when about:blank is used for the
   document of an editable iframe.  The new function returns only the base
   filename, with no extension, as the extension is generated by means
   described above.
modules/content-buffer-input.js