Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9163 closed Bug (invalid)

IE8 & IE 7: not getting CKEditor.instances in IE8 and below version of IE

Reported by: Amit.Mukherjee Owned by:
Priority: Normal Milestone:
Component: General Version: 3.6.2
Keywords: Cc: deepak.bakshani@…

Description (last modified by Jakub Ś)

I am trying to attach the change , focus and blur events to my CKEditor instances that are dynamically generated.Find below the code. Its working fine for Ie9 and other browsers but not getting the instances in IE8 and below IE versions. Here is the code.

<script type="text/javascript">
        if (window.addEventListener) {

            window.addEventListener('load', onpageload, false);

        }
        else {

            window.attachEvent('onload', onpageload);
        }
    </script>

and the function is :

function onpageload(e) {
    var dirtyField = document.getElementById("dirtyfield");
    for (var i in CKEDITOR.instances) {
        CKEDITOR.instances[i].on('change', function () { dirtyField.value = true; });
        CKEDITOR.instances[i].on('focus', function () {
            this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#ebf5d0';
        });
        CKEDITOR.instances[i].on('blur', function () {
            this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#FFFFFF';
        });
    }
}   

Unable to get the instances in IE8 so the code in not able to loop and attach the events with the instances.

Attachments (1)

replacebycode2.html (4.4 KB) - added by Jakub Ś 12 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 12 years ago by Amit.Mukherjee

Keywords: IE 8 CKEditor.instances added

comment:2 Changed 12 years ago by Jakub Ś

Description: modified (diff)
Keywords: IE 8 CKEditor.instances removed

Changed 12 years ago by Jakub Ś

Attachment: replacebycode2.html added

comment:3 Changed 12 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

Please note that the CKEditor development website is not the right place for support requests.

Please refer to the following article for information on where to get support for all issues related to CKEditor: http://docs.cksource.com/CKEditor_3.x/Howto/Support

Also try using our forums for advice: http://cksource.com/forums/

If you are looking for professional assistance, the CKEditor development team is available via a dedicated support channel that is included in all our commercial licenses: http://ckeditor.com/license


Please note that I have tried your code and didn't have problem with running it in any browser. I have tested it in CKEditor 3.6.4.Perhaps you haven't refreshed cache properly.

comment:4 Changed 12 years ago by Jakub Ś

Try to look for any JavaScript errors. IE9 supports addEventListener so if this is not cache problem then for some reason you have problem with attachEvent which is used in IE6-8.

comment:5 in reply to:  3 Changed 12 years ago by Amit.Mukherjee

Replying to j.swiderski:Hello,

I have tried your code on my side, its not working I mean if you focus on any editor its background color in not changing to green. Also you are replacing the textarea by its ID but we can't use Id. We are replacing them by class name. Find below the code for the same. Its not working with class name.

CKEDITOR.config.height = "90px"; CKEDITOR.config.autoParagraph = false; CKEDITOR.config.fillEmptyBlocks = false; CKEDITOR.config.resize_enabled = false; CKEDITOR.config.removePlugins = 'elementspath';

CKEDITOR.config.toolbar = 'Cms'; CKEDITOR.config.toolbar_Cms =

[

['Bold', 'Underline', 'Italic', '-', 'Subscript', 'Superscript'],

];

CKEDITOR.replaceClass = 'supersub_scripts';

Please note that the CKEditor development website is not the right place for support requests.

Please refer to the following article for information on where to get support for all issues related to CKEditor: http://docs.cksource.com/CKEditor_3.x/Howto/Support

Also try using our forums for advice: http://cksource.com/forums/

If you are looking for professional assistance, the CKEditor development team is available via a dedicated support channel that is included in all our commercial licenses: http://ckeditor.com/license


Please note that I have tried your code and didn't have problem with running it in any browser. I have tested it in CKEditor 3.6.4.Perhaps you haven't refreshed cache properly.

comment:6 Changed 12 years ago by Amit.Mukherjee

If u are testing the code then the background of editor should change to green on Focus also if u put an alert in the change event it should give you an alert when you type something. Please check these behaviours in IE8 & IE7

comment:7 Changed 12 years ago by Jakub Ś

Drop native eventListeners and use CKEditor api. We have created it for a reason you know.

CKEDITOR.on('instanceReady', function onpageload() {
					var dirtyField = document.getElementById("dirtyfield");
					for (var i in CKEDITOR.instances) {
						CKEDITOR.instances[i].on('change', function () { dirtyField.value = true; });
						CKEDITOR.instances[i].on('focus', function () {
							this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#ebf5d0';
						});
						CKEDITOR.instances[i].on('blur', function () {
							this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#FFFFFF';
						});
					}
				});

comment:8 in reply to:  7 Changed 12 years ago by Amit.Mukherjee

Replying to j.swiderski:Hello

As per your suggestion i have tried the same but still i am not getting the instances in IE8,IE7

Drop native eventListeners and use CKEditor api. We have created it for a reason you know.

CKEDITOR.on('instanceReady', function onpageload() {
					var dirtyField = document.getElementById("dirtyfield");
					for (var i in CKEDITOR.instances) {
						CKEDITOR.instances[i].on('change', function () { dirtyField.value = true; });
						CKEDITOR.instances[i].on('focus', function () {
							this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#ebf5d0';
						});
						CKEDITOR.instances[i].on('blur', function () {
							this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#FFFFFF';
						});
					}
				});
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy