Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#10663 closed Bug (invalid)

problems with the setData function

Reported by: Avital Owned by:
Priority: Normal Milestone:
Component: General Version: 4.1.1
Keywords: Cc:

Description

Hello,

I have a big problem with the setData function, after using it many of the editor button stop working(disable), like undo, redo, colors, font and more. Another effect of that is that events stop working, like onchange plugin for example. Another issue is in IE, i get Access denied error when i am trying using instanceReady event.

Is there alternative way to change all data?

Thanks, Avital

editor.setData(newEditorData);

Attachments (1)

simpleCKEditorExample.rar (804.8 KB) - added by Avital 6 years ago.
This is simple example of the bug - in IE only

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

You have written that you have error with code you are using and nothing more.

I know that setData works thus I'm closing this issue as invalid for now.

@4avital please provide exact step by step scenario that allows reproducing this bug. If possible please provide reduced sample code that allows reproducing this problem.

comment:3 Changed 6 years ago by Jakub Ś

  1. If possible could you please send reduced project that only shows this problem and not whole project? But before you do that...
  2. I have noticed that you are using CKEditor for JavaScript only. For projects like ASP.NET you should use CKEditor for ASP.NET. I know this is still version 3.6.4 but you can update client side code to latest 4.x while having 3.6.4 server side code.

Please also note that you may use CKE 4.2 client-side with CKe ASP.NET 3.6.4 server side.

  1. Go to CKEditor site and download CKE 4.2 FULL Package
  2. Extract it into ckeditor folder
  3. Go to ckeditor_aspnet/_Samples/ and replace existing ckeditor folder with the one you have downloaded.

The only thing you won't be able to set from ASP.NET Control is ACF:

http://ckeditor.com/blog/Upgrading-to-CKEditor-4.1 http://ckeditor.com/blog/CKEditor-4.1-RC-Released http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter http://docs.ckeditor.com/#!/api/CKEDITOR.filter-method-addTransformations http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraAllowedContent[[BR]]

which you would have to configure or disable from config.js file.

comment:4 Changed 6 years ago by Avital

Hi j.swiderski,

I appreciate your quick response, here are my replies:

  1. I have removed any unnecessary files from the project, but left the basic structure that reflects our project.

The link: https://docs.google.com/file/d/0Bw7vmvkiNZBeT1V4LWJXcFRfb0U/edit?usp=sharing

  1. We aren't using CKEditor for ASP.NET, as our solution is a client only component, and uses javascript and knockout only.

More details:

  1. We initialize the editor in the freeStyleEditorHandler binding handler in the homeScript.js.
  2. When page is loaded (in IE), and text is entered in editor- notice that there's no undo/redo buttons.
  3. After choosing <source> and then clicking it again to get back, format buttons (text color, bg color, etc.) are disabled.
  4. After choosing <source> and then clicking it again to get back, the 'onchange' event stops firing (except for 'Enter' button).

Please reply as soon as possible, We are in the QA stage and have little time before we launch.

Thanks.

comment:5 Changed 6 years ago by Jakub Ś

Hi,

It seems to me that all of these issues might have 1 or two reasons.

  1. Please check what is inserted into editor because this might be some invalid html that is breaking editor:
    var editorData = $('<html>').html(editor.getData());
    var newEditorData = "<html>" + editorData.html() + "<html>";
    //after setData run all buttons stop working (UNDO/REDU for example)
    //remove setData line and you will see everything is working fine.
    editor.setData(newEditorData);
    

I don't quite inderstand what do you want to do here. When mode changes to wysiwyg you get data from editor and insert it once more. Please check what gets inserted as this may be the key thing here.

  1. This is just a guess as I didn't wasn't able to check working code. For some reason I wasn't able to fire application and I'm not .NET expert but here is the question... are you sure that your knockout doesn't for example rebind events (duplicates them) which simply breaks editor?

Changed 6 years ago by Avital

Attachment: simpleCKEditorExample.rar added

This is simple example of the bug - in IE only

comment:6 Changed 6 years ago by Avital

Hello j.swiderski,

Thanks for the quick response, I Attached a new simpler example that contains only one html page + 1 script page + ckeditor. I removed all Knockout, now it's pure jquery and javascript...

About your request, when mode is 'wysiwyg' I am trying to change the data to another html (because my editor configured to be in full html mode). You can test it with just text (textData variable) or with html (htmlData variable) (I added both of the options) - it's not work either way... My purpose is: Our site will be secured and when someone insert at source mode http image, I need to change it to https...

Please check only in IE...

Thanks, Avital.

comment:7 Changed 6 years ago by Jakub Ś

DUP of #10501.

@4avital you are right this is happening only in IE and this is known problem. Please try using below:

setTimeout(function(){editor.setData(htmlData);},10);

It has even worked for me when I used 0 for time interval.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy