Opened 13 years ago

Closed 12 years ago

#1069 closed defect (fixed)

Editor: In IE6, selecting an image and pressing backspace loses your document

Reported by: guest Owned by: liucougar
Priority: high Milestone: 0.9
Component: Editor Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

Use the editor demo at http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-widget/demos/widget/Editor.html

Insert an image into the document. The insert image button isn't enabled in the demo, but you can drag in an image from another browser window.

Click the image to select it, and then press backspace.

The image should be deleted, but instead IE acts as if you clicked the Back button. You can go forward to get back to the demo, but any changes to the document are lost.

It's clearly an IE bug, but considering the loss of data a workaround seems to be in order.

Change History (6)

comment:1 Changed 13 years ago by dylan

Milestone: 0.5

comment:2 Changed 13 years ago by Douglas Hays

Backspace is just ignored for me during image resize using IE6. Perhaps this was fixed in the latest IE6 service pack.

comment:3 Changed 13 years ago by guest

I'm still seeing this problem after installing latest Windows updates. It happens in IE7 as well.

Not sure what you mean by "during image resize". If you are in the middle of a drag to resize the image, then backspace does nothing, but if you simply select the image and press backspace, it does go back.

Also, you won't see this problem if you open the test page in a new window, because you have nowhere to go back to.

comment:4 Changed 13 years ago by bill

Component: WidgetsEditor
Owner: changed from anonymous to liucougar

comment:5 Changed 13 years ago by bill.blume@…

I am still seeing this defect with dojo 0.4.1. Fortunately, I was able to patch my copy of the editor to fix this defect. This code example, representing a subclassed Editor2 class, should resolve the problem:

dojo.provide("my.widget.PatchedEditor2");
dojo.require("dojo.widget.Editor2");

dojo.widget.defineWidget(
  "my.widget.PatchedEditor",
  dojo.widget.Editor2,
  {
    myOnKeyDown: function(e)
    {
      if (! e && this.object) {
        e = dojo.event.browser.fixEvent(this.window.event);
      }

      // IE has a bug where if a non-text object is selected in the editor,
      // hitting backspace would act as if the browser's back button was
      // clicked instead of deleting the object.
      if (dojo.render.html.ie &&
          e.keyCode == e.KEY_BACKSPACE &&
          this.document.selection.type == "Control") {
        e.preventDefault();
        e.stopPropagation();
        this.execCommand("delete");
      }
    }
   },
  "html",
  function() {
    dojo.event.connect(this, "onKeyDown", this, "myOnKeyDown");
  }
)

Just thought this would be helpful.

comment:6 Changed 12 years ago by liucougar

Resolution: fixed
Status: newclosed

(In [9892]) fixes #1069: Editor: In IE6, selecting an image and pressing backspace loses your document

Note: See TracTickets for help on using tickets.