From 49adaaf6ab7283ed4b0808ee367105fd18e78fea Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 7 Oct 2011 05:13:04 -0400 Subject: [PATCH] Make sure we end the transaction for the correct editor. Closes issue #683. --- common/content/editor.js | 15 ++++++++++----- common/skin/global-styles.css | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/content/editor.js b/common/content/editor.js index 28c56dcc..14a4a11b 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -440,6 +440,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { tmpfile.remove(false); if (textBox) { + DOM(textBox).highlight.remove("EditorEditing"); if (!keepFocus) dactyl.focus(textBox); for (let group in values(blink.concat(blink, ""))) { @@ -478,9 +479,9 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { throw Error(_("io.cantCreateTempFile")); if (textBox) { - DOM(textBox).highlight.add("EditorEditing"); if (!keepFocus) textBox.blur(); + DOM(textBox).highlight.add("EditorEditing"); } if (!tmpfile.write(text)) @@ -779,14 +780,18 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { Map.types["editor"] = { preExecute: function preExecute(args) { - if (editor.editor) - editor.editor.beginTransaction(); + if (editor.editor && !this.editor) { + this.editor = editor.editor; + this.editor.beginTransaction(); + } editor.inEditMap = true; }, postExecute: function preExecute(args) { editor.inEditMap = false; - if (editor.editor) - editor.editor.endTransaction(); + if (this.editor) { + this.editor.endTransaction(); + this.editor = null; + } }, }; Map.types["operator"] = { diff --git a/common/skin/global-styles.css b/common/skin/global-styles.css index 5192ab73..4f9c1464 100644 --- a/common/skin/global-styles.css +++ b/common/skin/global-styles.css @@ -135,7 +135,8 @@ Dense /* Arbitrary elements which should be packed densely together margin-top: 0; margin-bottom: 0; EditorEditing;;* /* Text fields for which an external editor is open */ \ - -moz-user-input: none !important; -moz-user-modify: read-only !important; + -moz-user-input: none !important; -moz-user-modify: read-only !important; \ + background-color: #bbb !important; *EditorEditing>*;;* background-color: #bbb !important; EditorError;;* /* Text fields briefly after an error has occurred running the external editor */ \ background: red !important;