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

RadEditor custom dialog is not working on chrome and safari

5 Answers 250 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Than Htat Aung
Top achievements
Rank 1
Than Htat Aung asked on 13 Oct 2010, 01:19 PM
Hi,

The telerik demo for radeditor custom dialogs "http://demos.telerik.com/aspnet-ajax/editor/examples/customdialogs/defaultcs.aspx" is not working on the safari and chrome browser.In detail, when "Insert special link" button is clicked, nothing happened in safari and chrome although a dialog box is displayed in firefox ,IE8,IE7.


I am currently using this technique to load my custom dialog. Is there any solution?

Best Regards,
THA

5 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Oct 2010, 05:12 PM
Hello Than,

I tested the demo but I was unable to reproduce the problem. You can see my test at: http://screencast.com/t/wFxEQItVnyo.
Am I missing some step?

Please, make sure that you are using the latest versions of Chrome and Safari.


Best wishes,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Than Htat Aung
Top achievements
Rank 1
answered on 15 Oct 2010, 06:37 PM
Hi,

Sorry about that i did not describe in detail.
The scenario is that I even don't select any text and click inside the radeditor.
As soon as the page is finished loading , I clicked that button from the radeditor as the first action.

The dialog cannot be loaded in safari and chrome.

0
Rumen
Telerik team
answered on 20 Oct 2010, 09:45 PM
Hello Than,

I debugged the problem and found that it is due to the following error:

Uncaught TypeError: Cannot read property 'tagName' of null

When calling the custom link manager you should notify your users that a selection is needed inside the content area, e.g.

<script type="text/javascript">
Telerik.Web.UI.Editor.CommandList["InsertSpecialLink"] = function (commandName, editor, args) {
var elem = editor.getSelectedElement(); //returns the selected element.
if (elem == null) {
alert("Please, make selection in the content area.");
}
else if (elem.tagName.toUpperCase() == "A") {
editor.selectElement(elem);
argument = elem;
} ...

Please, note that the Custom Link Manager is just a demo, but not a complete solution as the built-in LinkManager of RadEditor.

Sincerely yours,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
-DJ-
Top achievements
Rank 1
answered on 31 Jul 2013, 03:42 PM
Hi,

I am dealing with the same problem basically.
I've replaced the image manager with my own dialog, and I get the "Uncaught TypeError: Cannot read property 'tagName' of null" error if the user hasn't placed his cursor in the editor before clicking the custom dialog button.

However, instead of telling the user to do so, I would prefer to simply set the focus to the editor and let the user get on with his work.

For some reason, this doesn't seem to be sufficient:

if (elem == null) {
var editor = $find("<%=RadEditor2.ClientID%>"); //get a reference to RadEditor client object
editor.setFocus(); //set the focus on the the editor
}

Any thoughts?

Regards,
-DJ-
0
-DJ-
Top achievements
Rank 1
answered on 02 Aug 2013, 01:51 PM
I managed to fix this, here is the code if anyone needs it

// image manager
Telerik.Web.UI.Editor.CommandList["YourDialog"] = function (commandName, editor, args) {
 
 
    if (editor.getSelectedElement() == null) {
        var editor = $find("<%=RadEditor2.ClientID%>"); //get a reference to RadEditor client object
        editor.setFocus(); //set the focus on the the editor
        argument = null;
    }
    else {
        var elem = editor.getSelectedElement(); //returns the selected element.
        if (elem.tagName == "img") {
            editor.selectElement(elem);
            argument = elem;
        }
        else {
            //remove links if present from the current selection - because of JS error thrown in IE
            editor.fire("Unlink");
 
 
            //remove Unlink command from the undo/redo list
            var commandsManager = editor.get_commandsManager();
            var commandIndex = commandsManager.getCommandsToUndo().length - 1;
            commandsManager.removeCommandAt(commandIndex);
 
            var content = editor.getSelectionHtml();
 
            var link = editor.get_document().createElement("img");
 
            argument = link;
        }
    }
 
    var myCallbackFunction = function (sender, args) {
        editor.pasteHtml(String.format("<img src={0} />", args))
    }
 
    //showExternalDialog(url (aspx/html file), argument, width, height, callbackFunction, callbackArgs, title, modal, behaviors, showStatusbar, showTitlebar);
    editor.showExternalDialog(
        'YourUrl',
        argument,
        600,
        600,
        myCallbackFunction,
        null,
        'Image Manager',
        true,
        Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
        false,
        true);
};
Tags
Editor
Asked by
Than Htat Aung
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Than Htat Aung
Top achievements
Rank 1
-DJ-
Top achievements
Rank 1
Share this question
or