Bug 787673 - "Create Table from Selection" no longer works in Composer and Thunderbird and other issues with deleteSelection r=neil a=philip.chee for CLOSED TREE
authorIan Neal <iann_cvs@blueyonder.co.uk>
Mon, 03 Sep 2012 19:59:05 +0100
changeset 30852 f884da2e73ac0c8a439d804e64304cbc3a3c3828
parent 30851 edd78fb4d7a911b91f078ced9925f2d14bf5bff9
child 30853 5b2c353dc1b1588cd4e41df36d9742299d28eb9a
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, philip
bugs787673
Bug 787673 - "Create Table from Selection" no longer works in Composer and Thunderbird and other issues with deleteSelection r=neil a=philip.chee for CLOSED TREE
editor/ui/composer/content/editor.js
editor/ui/dialogs/content/EdConvertToTable.js
editor/ui/dialogs/content/EdReplace.js
--- a/editor/ui/composer/content/editor.js
+++ b/editor/ui/composer/content/editor.js
@@ -1681,17 +1681,18 @@ function SetEditMode(mode)
       } catch (e) {}
     }
 
     // Clear out the string buffers
     gSourceContentWindow.commandManager.removeCommandObserver(gSourceTextObserver, "cmd_undo");
     gSourceTextEditor.removeDocumentStateListener(gSourceTextListener);
     gSourceTextEditor.enableUndo(false);
     gSourceTextEditor.selectAll();
-    gSourceTextEditor.deleteSelection(gSourceTextEditor.eNone);
+    gSourceTextEditor.deleteSelection(gSourceTextEditor.eNone,
+                                      gSourceTextEditor.eStrip);
     gSourceTextEditor.resetModificationCount();
 
     gContentWindow.focus();
     //goDoCommand("cmd_moveTop");
   }
 
   switch (mode) {
     case kDisplayModePreview:
--- a/editor/ui/dialogs/content/EdConvertToTable.js
+++ b/editor/ui/dialogs/content/EdConvertToTable.js
@@ -248,17 +248,17 @@ function onAccept()
   str = "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"2\">\n<tr><td>" + str + "</tr>\n</table>\n";
 
   editor.beginTransaction();
   
   // Delete the selection -- makes it easier to find where table will insert
   var nodeBeforeTable = null;
   var nodeAfterTable = null;
   try {
-    editor.deleteSelection(0);
+    editor.deleteSelection(editor.eNone, editor.eStrip);
 
     var anchorNodeBeforeInsert = editor.selection.anchorNode;
     var offset = editor.selection.anchorOffset;
     if (anchorNodeBeforeInsert.nodeType == Node.TEXT_NODE)
     {
       // Text was split. Table should be right after the first or before 
       nodeBeforeTable = anchorNodeBeforeInsert.previousSibling;
       nodeAfterTable = anchorNodeBeforeInsert;
--- a/editor/ui/dialogs/content/EdReplace.js
+++ b/editor/ui/dialogs/content/EdReplace.js
@@ -201,17 +201,17 @@ function onReplace()
     newRange = selection.getRangeAt(0).cloneRange();
     newRange.collapse(true);
   }
 
   // nsPlaintextEditor::InsertText fails if the string is empty,
   // so make that a special case:
   var replStr = gReplaceDialog.replaceInput.value;
   if (replStr == "")
-    gEditor.deleteSelection(0);
+    gEditor.deleteSelection(gEditor.eNone, gEditor.eStrip);
   else
     gEditor.insertText(replStr);
 
   // For reverse finds, need to move caret just before the replaced text
   if (gReplaceDialog.searchBackwards.checked && newRange)
   {
     gEditor.selection.removeAllRanges();
     gEditor.selection.addRange(newRange);
@@ -285,17 +285,17 @@ function onReplaceAll()
       {
         selecRange = foundRange.cloneRange();
         selecRange.setEnd(selecRange.startContainer, selecRange.startOffset);
       }
 
       // nsPlaintextEditor::InsertText fails if the string is empty,
       // so make that a special case:
       if (repStr == "")
-        gEditor.deleteSelection(0);
+        gEditor.deleteSelection(gEditor.eNone, gEditor.eStrip);
       else
         gEditor.insertText(repStr);
 
       // If we're going forward, we didn't save selecRange before, so do it now:
       if (!gReplaceDialog.searchBackwards.checked)
       {
         selection = gEditor.selection;
         if (selection.rangeCount <= 0) {
@@ -342,17 +342,17 @@ function onReplaceAll()
       {
         selecRange = foundRange.cloneRange();
         selecRange.setEnd(selecRange.startContainer, selecRange.startOffset);
       }
 
       // nsPlaintextEditor::InsertText fails if the string is empty,
       // so make that a special case:
       if (repStr == "")
-        gEditor.deleteSelection(0);
+        gEditor.deleteSelection(gEditor.eNone, gEditor.eStrip);
       else
         gEditor.insertText(repStr);
 
       // Get insert point for forward case
       if (!gReplaceDialog.searchBackwards.checked)
       {
         selection = gEditor.selection;
         if (selection.rangeCount <= 0) {