taoguan / jwysiwyg

Automatically exported from code.google.com/p/jwysiwyg
0 stars 0 forks source link

Issues with IE7 when used to put contents from overlay into WYSIWYG editor. #116

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Integrate an overlay which will put data on each row and click of data 
row should put data in WYSIWYG editor
2. this data should be put @ cursor position before clicking overlay link.
3. This is working fine with mozilla firefox

What is the expected output? What do you see instead?
Currently instead I see message saying object does not support this 
property.

following is the function definition.

        insertContent : function( newContent )
        {   
            if ( this.editor[0].contentWindow.document.selection ) {
                range = this.editor
[0].contentWindow.document.selection.createRange();                
            }
            else {
                selection = this.editor[0].contentWindow.getSelection();
                range = selection.getRangeAt(0);
            }           

            range.deleteContents();
            newNode = document.createElement('span');
            newNode.innerHTML = newContent;
            range.insertNode( newNode );
        },

What version of the product are you using? On what operating system?
We are using 0.5 version of plug-in on windows XP with service pack 3.

Please provide any additional information below.

Following revised definition, puts the content in WYSIWYG editor, but 
instead of putting it at cursor position, it appends text.

Example of it is as follows.
current text is : my  text and cursor position is between my and text. 
Upper definition does not put contents from overlay which reads new content
and below modified definition puts content after text word.

insertContent : function( newContent )
        {      

                if ( this.editor[0].contentWindow.document.selection )  {

range = this.editor[0].contentWindow.document.selection.createRange();

                                                this.editor
[0].contentWindow.document.write(newContent);
                   }
            else {

selection = this.editor[0].contentWindow.getSelection();

range = selection.getRangeAt(0);

                                                newNode = 
document.createElement('span');                 

                newNode.innerHTML = newContent;

range.insertNode( newNode );
            }
        },

Expecting your help.

Original issue reported on code.google.com by nitin4...@gmail.com on 10 Jun 2009 at 9:36

GoogleCodeExporter commented 8 years ago
Use $('#ed').wysiwyg('insertHtml', 'html') instead of Your code.

This method added in version 0.6.

Additionaly - minor fix added into trunk (future 0.7).

Original comment by akzhan.a...@gmail.com on 28 Dec 2009 at 3:36