Open Bug 285797 Opened 20 years ago Updated 2 years ago

ExecCommand only working for the first selection instance

Categories

(Core :: DOM: Editor, defect)

x86
Windows XP
defect

Tracking

()

REOPENED

People

(Reporter: martijn.martijn, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

See upcoming testcase.
I would expect that execCommand to work for all three selection instances.
Instead it works for only the first selection instance.
The 'createlink' execCommand works for the first two selection instances for
some reason.
Attached file Testcase
I am running the test case in FF1.1 without the patch so keep that in mind when
reading my comments.

If I click on 'createlink' once (this creates the multiple selections for me),
'bold', 'italic', and 'createlink' work as expected as well as both 'delete'
buttons.  What's even more interesting, is that if 'createlink' is clicked
first, then either 'bold', 'italic', or both are clicked next, 'unlink' works
properly as well whereas if 'bold' or 'italic' are not selected before 'unlink',
it works correctly but then forgets the selections.

I wonder if it would help if the test case started with the multiple selections
already made.  Also, Martijn, I would be willing to look at the code of the
relevant execCommands to see if I can determine what it is about them that
causes the varying behavior if you could point me in the right direction.
The three selection instances should be visible directly, so it's rather strange
that you're not seeing that.

I don't really know any c code, but perhaps this is the place where a large part
of the execcomands are carried out.
http://lxr.mozilla.org/seamonkey/source/editor/libeditor/html/nsHTMLEditorStyle.cpp#127

but this seems already take into account multiple selections:
http://lxr.mozilla.org/seamonkey/source/editor/libeditor/html/nsHTMLEditorStyle.cpp#168
So maybe this is unrelated.

Some more testing:
-clicking multiple times on a 'execcommand' button takes the following selection
and makes it bold/italic/underlined whatever your chose.
-It doesn't matter if the selections are in the same node, or not, the bug is
always there.
I assume this bug also applies to Composer and nVu.  Can someone confirm that it
is not specific to Midas?
Yes, this also applies to Composer. I just applied the patch from bug 73373 in
my debug build, and it exhibits the same behavior as the midas/richedit testcase.
QA Contact: bugzilla → editor
Assignee: mozeditor → nobody
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: