This is a migrated thread and some comments may be shown as answers.

No tools functioning

9 Answers 296 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matt Thrower
Top achievements
Rank 1
Matt Thrower asked on 22 Aug 2008, 01:18 PM
Hi,

I've been working recently to try and update our old RadEditor-based tools to RadEditor "Prometheus". Our controls inherit from RadEditor and then add some custom functionality.

Took me a while to get it to compile and run. Having done so the RadEditor is behaving very oddly. ToolBarMode is set to ShowOnFocus and when the user clicks into the RadEditor to focus, an empty toolbar appears right in the middle of the editable area, not above it as it should. On a second click into the editable region, the populated toolbar appears when it should.

Clicking on any tools in the toolbar - whether our custom tools or inbuilt RadEditor tools - has the same effect: nothing happens in the editable area but the browser pops the view back up to the top of the page.

The client-side error that comes up is "'RadEditorCommandList' is undefined" but on reviewing the documentation this still seems to be the Javascript array to use for these commands, so I'm unsure as to what's going wrong.

If I comment out the lines causing the RadEditorCommandList errors and run it again, I still get the same behaviour. This time the error states "sys,InvalidOperationException: 'iconurl' is not a property or an existing field". This doesn't appear to be associated directly with any code I've written and has me quite perplexed.

Cheers,
Matt

9 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 25 Aug 2008, 08:01 AM
Hi Matt,

It will be best if you open a support ticket and send a sample working project that demonstrates the different problems. We will do our best to solve them and make the migration faster.

In regards to the iconUrl property - The new editor use an enhanced toolbar architecture based on image sprites which optimizes the editor's loading. That is why the IconUrl property was removed and replaced by a css class, which allows the developer to specify the desired custom icon image. You can see the following help article on the subject which provides guidance how to create custom buttons: Adding Your Own Buttons

The following help article could be also useful: Migration from RadEditor Classic to RadEditor for ASP.NET AJAX.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matt Thrower
Top achievements
Rank 1
answered on 27 Aug 2008, 12:52 PM
Hi,

Thanks for your reply.

I am reluctant to open a ticket purely because it'd mean you looking through an awful lot of code and a number of files in order to fix what might well be a very simple problem. The link you sent about icons in the stylesheet fixed the iconurl problem, so thanks very much for that.

I'm finding the RadEditorCommandList error harder to fix. It seems to be related to using my modified editor inside a composite control - if I deploy a stand alone version of our editor on a page and attempt to add to the RadEditorCommandList array I get no error. However, the control is made to be deployed as part of a composite control, with the editor being placed inside an MS UpdatePanel during the CreateChildControls event of the composite. When the composite control is deployed, I get the error, even when no changes are made to the default property values of the editor.

Are you aware of anything in the control that would cause RadEditorCommandList not to be defined if the control is added as part of a composite?

Cheers,
Matt
0
Rumen
Telerik team
answered on 28 Aug 2008, 02:48 PM
Hi Matt,

Have you seen by any chance in the provided help article how to create custom commands and tools? In order to create a custom command you need to replace the old RadEditor Classic function

RadEditorCommandList["Custom1"] = function(commandName, editor, oTool)

with this one:

Telerik.Web.UI.Editor.CommandList["Custom1"] = function(commandName, editor, args)

Please, see the help article Adding Your Own Buttons once again and update your code following the provided instructions.

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matt Thrower
Top achievements
Rank 1
answered on 28 Aug 2008, 03:16 PM
Yes, I've tried using the syntax from that article.

I get a similar error - 'Telerik' is undefined.
0
Tervel
Telerik team
answered on 01 Sep 2008, 11:37 AM
Hi Matt,

To get this error means that no RadEditor is loaded on the page. This leads us to believe that your RadEditor control is loaded dynamically on the page if a certain condition is met, and is not always present.

If this is the case, you will need to add an extra check and wrap your custom tool in a if statement like this:

if ("undefined" != typeof(Telerik))
{
   Telerik.Web.UI.Editor.CommandList["Custom1"] = function(commandName, editor, args)
   {
   }
}




All the best,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matt Thrower
Top achievements
Rank 1
answered on 01 Sep 2008, 12:31 PM
Hi,

I have finally managed to track down the source of the problem.

By default the RadEditor on the page renders with .Enabled = false so that the editor will display the content but not allow the user to edit. In the old version of RadEditor I had .Editable = false to achieve the same effect. It seems that the inner workings of RadEditor have changed so that if the Editor is disabled, much of the pre-rendering process does not take place and the CommandList is not initialised - hence the javascript error.

So I tried using your suggested solution - putting in a if ("undefined" != typeof(Telerik)) check before attempting to modify CommandList. Unfortunately because there *is* a RadEditor on the page, even one that's disabled, this check doesn't work and I still get the error. Is there anything else I can check for - say the Enabled status of the Editor - to try and work round this?

Matt
0
Tervel
Telerik team
answered on 02 Sep 2008, 08:59 AM
Hi Matt,

When the editor's Enabled = false, the editor renders on the client as a non-editable container, and outputs no scripts. However, on your page you use other Telerik controls, and  this is why the Telerik namespace is defined on the client, but no the editor specific Telerik.Web.UI.Editor namespace.

Here is how you should modify your code to get it safely working:

if ("undefined" != typeof(Telerik.Web.UI.Editor))
{
   Telerik.Web.UI.Editor.CommandList["Custom1"] = function(commandName, editor, args)
   {
   }
}


Greetings,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
shyka
Top achievements
Rank 1
answered on 24 Jan 2011, 02:37 PM
i have the same problem: theres no radeditor on the page when its first loaded. there is radeditor in a popup when i get into edit mode with a radgrid.

i tried ur solution & its realy stopped the jscript error- but when i press the buttons i tried to defind, theres a javascript popup which say that the command is not yet defined.

what should i do?

thanks
0
shyka
Top achievements
Rank 1
answered on 24 Jan 2011, 02:47 PM
problem solved:

function

 

 

pageLoad() {

 

 

 

 

    if (typeof (RadEditorCommandList) != "undefined") {

 

        Telerik.Web.UI.Editor.CommandList[

 

"LTR"] = function (commandName, editor, args) {

 

 

 

        }

 

    }

}

Tags
Editor
Asked by
Matt Thrower
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Matt Thrower
Top achievements
Rank 1
Tervel
Telerik team
shyka
Top achievements
Rank 1
Share this question
or