Bug 1067318 - update markup.js for live HTML edit draft
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 13 Feb 2017 09:46:25 +0100
changeset 581149 c5586226441ec288d3e7cbbaac7b6007dc6e5858
parent 581148 6eff0f199756e19a6dcf0510f4a16413358aef9a
child 581150 298a10a1df94a52b92f9b18dd6fa3b9f6fdfd7c3
push id59782
push userjdescottes@mozilla.com
push dateFri, 19 May 2017 10:02:20 +0000
bugs1067318
milestone55.0a1
Bug 1067318 - update markup.js for live HTML edit MozReview-Commit-ID: L4Mk7EYD5tQ
devtools/client/inspector/markup/markup.js
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -538,24 +538,29 @@ MarkupView.prototype = {
    * - if it's "test" (this is a special case for mochitest. In tests, we often
    * need to select elements but don't necessarily want the highlighter to come
    * and go after a delay as this might break test scenarios)
    * We also do not want to start a brief highlight timeout if the node is
    * already being hovered over, since in that case it will already be
    * highlighted.
    */
   _shouldNewSelectionBeHighlighted: function () {
+    if (this.editedNode) {
+      return false;
+    }
+
     let reason = this.inspector.selection.reason;
     let unwantedReasons = [
       "inspector-open",
       "navigateaway",
       "nodeselected",
       "test"
     ];
     let isHighlight = this._hoveredNode === this.inspector.selection.nodeFront;
+
     return !isHighlight && reason && unwantedReasons.indexOf(reason) === -1;
   },
 
   /**
    * React to new-node-front selection events.
    * Highlights the node if needed, and make sure it is shown and selected in
    * the view.
    */
@@ -1436,16 +1441,17 @@ MarkupView.prototype = {
         this.updateNodeOuterHTML(editedNode, value, oldValue);
       };
 
       this.htmlEditor.show(container.tagLine, oldValue);
       this.htmlEditor.on("change", onHtmlEditorChange);
 
       this.htmlEditor.once("popuphidden", (e, commit, value) => {
         this.htmlEditor.off("change", onHtmlEditorChange);
+        this.editedNode = null;
 
         // Need to focus the <html> element instead of the frame / window
         // in order to give keyboard focus back to doc (from editor).
         this.doc.documentElement.focus();
 
         if (commit) {
           this.updateNodeOuterHTML(node, value, oldValue);
         }