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

Modify element attributes without pasteHtml

1 Answer 63 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 30 Apr 2009, 09:32 PM

I would like to know if there is way to modify the attributes of html element in the editor without having to use the pasteHtml function. It appears that both internal dialogs (e.g. image manager, table properties) and custom dialogs insert new html to reflect the changes that occurred in the dialog (e.g. table borders, image alt text). The issue I am having is that the new html isn't always being inserted in the same location in the editor as the tag that launched the dialog. See examples below:

Example 1
Before: This is what the html looks like before modifying the table border using the Table Properties dialog.
<p>This is a paragraph<sup>1</sup>:</p>

 

 

 

 

<table >

 

 

 

 

    <tbody>

 

 

 

 

        <tr>

 

 

 

 

           <td>Cell 1</td>

 

 

 

 

           <td>Cell 2</td>

 

 

 

        </tr>

 

    </tbody>

 

 

 

 

</table>

 

 

 

 

<p>

 

 

 

 

    <sup>a</sup> Footnote for table 1.</sup>

 

 

 

 

</p>

After: Applying table border
<p>This is a paragraph<sup>1</sup>:</p>

 

 

 

 

<p>

 

 

 

 

    <sup>

 

        <table bordercolor="#000000" border="1">

 

 

 

 

            <thead/>    
            <
tbody
>

 

 

 

 

                <tr>

 

 

 

 

                   <td>Cell 1</td>

 

 

 

 

                   <td>Cell 2</td>

 

 

 

                </tr>

 

 

 

 

         </tbody>

 

 

 

 

        </table>

 

 

 

 

 

        a
    

 

</sup> Footnote for table 1.

 

 

 

 

</p>

The table is inserted in the sub tag of the second paragraph.

I also have the same problems with images being moved around after changing the alt text using the image manger.

Is there way to modify the attributes of an existing element in the editor while maintaining its exact location?

Thanks,
Alex

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 04 May 2009, 03:38 PM
Hello Alex,

Could you please try the solution provided in the following help article: getRange?

If you unable to fix the problem, please open a support ticket and send a sample working project that demonstrates the issue. I will examine your code and try to provide a solution for your scenario.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Alex
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or