Closed Bug 232791 Opened 20 years ago Closed 15 years ago

Midas don't let user delete text after adding text with innerHTML

Categories

(Core :: DOM: Editor, defect)

x86
All
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 474255

People

(Reporter: dragoran, Unassigned)

References

()

Details

(Keywords: testcase, Whiteboard: midas)

Attachments

(2 files)

User-Agent:       
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.5) Gecko/20031007 Firebird/0.7

i have coded a wysiwyg editor and it works fine but when i change the innerHTML
to anything (designMode is still on) the user cannot change the text until
he/she type a char. in MSIE the user don't have to type anything it just works.




Reproducible: Always
Steps to Reproduce:
if you have a iframe with a id edit (designMode='on') 
and have button like this
<input type="button"
onclick="document.getElementById('edit').contentDocument.body.innerHTML='<b>test</b>'"
value="x" />
you will see this issue

Actual Results:  
the user must type a char to be able to edit the text

Expected Results:  
the user should be able to edit the text without typing a char
Can you provide with a testcase?
(In reply to comment #1)
> Can you provide with a testcase?
yes
http://dragoran.hockrad02.de/editor/editor2.html
klick test and try to edit the content...
then enter any char and try it again
I dont know exaclty whats wrong here, i press the test button, and it adds
"test", then i select the text and press bold, italic etc and it all works fine.
(In reply to comment #3)
> I dont know exaclty whats wrong here, i press the test button, and it adds
> "test", then i select the text and press bold, italic etc and it all works fine.

try to delete test (using backspace)
Confirming, to reproduce:
1. Press test button to insert "test" string
2. try to delete the inserted text with backspace.
Assignee: blake → mozeditor
Status: UNCONFIRMED → NEW
Component: General → Editor: Core
Ever confirmed: true
OS: Linux → All
Product: Firebird → Browser
QA Contact: sairuh
Version: unspecified → Trunk
Summary: Midas don't let user delete text → Midas don't let user delete text after adding text with innerHTML
Whiteboard: midas
Severity: normal → major
url doesn't find the testcase anymore
Attached file test case
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050619
Firefox/1.0+

I'm activating designMode on window.onload here, since Fx 1.0.x has trouble
with designMode in iframe onload.  500ms delay before setting innerHTML ensures
plenty of time for the iframe contents to completely load.
The workaround consists of toggling off/on designMode after setting innerHTML:

editor.body.innerHTML = 'abc';
editor.designMode = 'off';
editor.designMode = 'on';

Interestingly, this (along with the 0-delay setTimeout and nulling onload
workarounds) toggling allows Fx 1.0.x to activate designMode on iframe onload. 
That means I don't need the 500ms delay before setting innerHTML.
Keywords: testcase
After some more experimentation, the designMode toggling actually isn't
necessary.  designMode just needs to be set to 'on' again:

editor.body.innerHTML = 'abc';
editor.designMode = 'on';

Also, the mentioned Fx 1.0.x iframe onload fix is the 0-time setTimeout.
Flags: blocking1.8b4?
I take that back.

editor.body.innerHTML = 'abc';
editor.designMode = 'off';
editor.designMode = 'on';

is necessary for the latest build.

editor.body.innerHTML = 'abc';
editor.designMode = 'on';

works for 1.0.5.
Flags: blocking1.8b4? → blocking1.8b4-
toggling off/on designMode after setting innerHTML still needed in Firefox 1.5 and Firefox 2.0
QA Contact: bugzilla → editor
Assignee: mozeditor → nobody
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: