dhtmlxEditor - Cannot edit in Firefox when setContent used t

I have initialised the editor correctly and everything works fine in both IE7 and FF3.

Until I use the setContent method to pre-populate my editor with some text.



In IE, this is fine but in FF, the text appears in my editor but it is not possible to edit this text until I start typing something.

The cursor keys work so I can navigate through the text but I cannot actually delete any characters - it’s as if the text is read only.

Only when I start typing characters into the editor does it then start working as normal.

If the setContent line is commented out, it works but that’s only because you have no text to actually delete.



Very simple setup is as follows:

        var editor = new dhtmlXEditor(“editorObj”);

        editor.setIconsPath(“dhtmlxSuite/dhtmlxEditor/codebase/imgs/”);

        editor.init();        

        editor.setContent(‘Some text’);

Any comment or update on this?
Is it just my browser or can you reproduce it?
It’s not a show stopper by any means but it’s a bit weird how you have to type some characters in before you can delete any of the others already there.

I’m using openWYSIWYG editor at the moment and would like to ditch it in favour of dhtmlxEditor as I’m using other dhtmlx controls in my web app.

The issue is confirmed. We will try to find a workaround to it.
We will necessary send you the fixed file when the solution is found.

I assume no solution has been found for this yet but is there any news on this?
Is it something that is inherent with the Firefox browser and the way they implement IE’s contenteditable=“true” (namely designMode=“on”)

I discovered this workaround for now which might be of interest:

In dhtmlxEditor.js:
    this.setContent = function(str){
        if(this.edDoc.body){
            this.edDoc.body.innerHTML = str;
            this.callEvent(“onContentSet”,[]);
            if(_isFF)
            {
                this.runCommand(‘InsertHTML’,’ ');
            }
        }
        else{
            var that = this;
            dhtmlxEvent(this.edWin, “load”, function(e){
                that.setContent(str);
            })
        }
    }

IE works fine so the inserted code is only for Firefox.
All you need to do is insert a blank character into the using the InsertHTML command and hey presto, the delete and backspace characters work on the newly set content.

Must be something to do with the contentReadOnly flag not being reset until you type in a character or something,
Using the insertHTML command must do something internally that you can’t do manually via command code.
I tried using the contentReadOnly command but it didn’t work.

Thank you very much for the excellent solution !

It fixes the issue in FireFox and will be included into the official editor’s version.

You’re very welcome - glad to help out :slight_smile:

You might want to check other browsers to see what they do.
I only use IE (v7) and FF (v3.0.3) so can’t vouch for other browsers.
You might need to extend the if (_isFF) to include other browsers that follow the Mozilla path???

We have tested the editor in different browsers (IE, Opera, Safari, FF) - the issue doesn’t appear.

The problem occured only in FF3. But it have been solved, thanks to your solution :slight_smile:

So, once again - thank you !