Opened 13 years ago

Closed 13 years ago

#7363 closed Bug (fixed)

[CKEditor.Net] Configuration bug

Reported by: michaël acosta Owned by: kaga
Priority: Normal Milestone:
Component: Server : ASP.Net Version: 3.5.2
Keywords: CKEditor.Net Cc:

Description

hi,

I make migration from the ancien .net component to the new official component

i try to change a configuration value " toolBar " on the component function (OnInit, OnLoad, etc).

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.Toolbar = "MyToolBar";
        }
                        

but the value is not save on the config, i have always the FULL toolbar

after debug i found this code

 public CKEditorConfig config
		{
			get
			{
				if (ViewState["CKEditorConfig" + this.ClientID] == null)
					ViewState["CKEditorConfig" + this.ClientID] = new CKEditorConfig(this.BasePath);
				return (CKEditorConfig)ViewState["CKEditorConfig" + this.ClientID];
			}
			set { ViewState["CKEditorConfig" + this.ClientID] = value; }
		}

but this.ClientID is null when the affectation is make on constructor. And value change on the component life.

and after when test if (ViewState+ this.ClientID? == null) the result is true, and the ToolBar value(and other) are overwrite

why not use a private Guid, Created on the Constructor.

private Guid _guidId = new Guid();

public CKEditorControl()
        {
            base.TextMode = TextBoxMode.MultiLine;
            _guidId = Guid.NewGuid();
            
            this.config = new CKEditorConfig(this.BasePath.StartsWith("~") ? this.ResolveUrl(this.BasePath) : this.BasePath);    
        }

public CKEditorConfig config
        {
            get
            {
                if (ViewState["CKEditorConfig" + _guidId] == null)
                    ViewState["CKEditorConfig" + _guidId] = new CKEditorConfig(this.BasePath, Context);
                return (CKEditorConfig)ViewState["CKEditorConfig" + _guidId];
            }
            set { ViewState["CKEditorConfig" + _guidId] = value; }
        }

A Guid ensures is always the same ViewState is used throughout the life of the component.

Attachments (1)

WebSite4.zip (877.7 KB) - added by michaël acosta 13 years ago.
Little sample solution with the problem.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 13 years ago by michaël acosta

Summary: [CKEditor.Net][CKEditor.Net] Configuration bug

comment:2 Changed 13 years ago by Wiktor Walc

Component: GeneralServer : ASP.Net

comment:3 Changed 13 years ago by kaga

Owner: set to kaga
Status: newreview

This issue is related with ticket #7302, after the resolve, it should work fine. I see that you are configure CKEditora in method onInit for the control, I think it is better idea to configure it in the Page_Load.

comment:4 Changed 13 years ago by kaga

Could you check the problem still occurs after patching from ticket #7302? If the problem still exists, Could you send me a sample page with the problematic configuration?

comment:5 Changed 13 years ago by Wiktor Walc

Status: reviewpending

@silver65b The latest SVN version of the ASP.NET control is available here:
http://svn.ckeditor.com/CKEditor.NET/trunk/

If you are still able to reproduce the bug using the SVN version, as kaga already suggested, please attach a sample project so that we could reproduce it.

comment:6 Changed 13 years ago by michaël acosta

i reproduce the problem with the path.

I have a specific requirement : i encapsulate your component to give at my co-workers a pre-configured component who responding to 99% of cases for the remaining 1% it uses the config file or a parameter in the code.

to do that i need to configure it on constructor because my co-workers can overload in the page load after create component.

i send to you an sample

Changed 13 years ago by michaël acosta

Attachment: WebSite4.zip added

Little sample solution with the problem.

comment:7 Changed 13 years ago by kaga

Thanks for the uploaded example. Yes you are right the problem existed, but now if I change CKEditorConfig.cs CKEditorControl.cs files in your example to the latest version from svn - it seems that it's OK. Please check the newest version CKEditor for ASP.

comment:8 Changed 13 years ago by kaga

Status: pendingreview

comment:9 Changed 13 years ago by Wiktor Walc

Status: reviewpending

@silver65b - could you confirm that the reported issue is no longer valid? Otherwise please attach a project that is using CKEditor 3.6.1 and where this issue can be still confirmed.

comment:10 Changed 13 years ago by Wiktor Walc

Resolution: fixed
Status: pendingclosed

This issue is already fixed, as suggested by kaga in previous comment. I'm closing the ticket, however please feel free to reopen it if you are still having this problem in the latest release (3.6.2 at this moment).

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