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

Unable to Append Text

3 Answers 83 Views
Editor
This is a migrated thread and some comments may be shown as answers.
LeBear
Top achievements
Rank 1
LeBear asked on 12 Aug 2008, 01:21 AM

I hope I'm just missing something.  :)

I cannot, through the design view, append content to the very end of what is there - unless there is a <br> at the end.  I can switch to HTML view, but I don't always want to provide the HTML view for my non-web-savvy clients.

Example:  If I have code in the editor like this:

<div> 
  <p>....</p> 
  <p>....</p> 
  <p>....</p> 
</div> 

I can't append anything from HTML view without it appearing inside the div tag.

Thanks for any assistance.

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 12 Aug 2008, 12:28 PM
Hi Barry,

This is a browser behavior. RadEditor's content area is an editable IFRAME element which uses the Rich Text Editing engine of the browser and this scenario is controlled by the browser. You can test the same scenario with our competitors' editor as well as editable DIV / IFRAME elements and you will see identical results as in our editor.

    <div style="border: 1px solid red;width: 500px;height:300px;overflow: scroll;" id="editableDIV" contenteditable="true">
        <div>
          <p>....</p>
          <p>....</p>
          <p>....</p>
        </div>
    </div>

That is why the only possible way to add content outside of the DIV tag is to use the Real Time HTML module or switch to Html mode.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
LeBear
Top achievements
Rank 1
answered on 12 Aug 2008, 12:35 PM

I haven't researched custom buttons yet, but could you (or could I) create a button to append to the end of the content?  Thus, if a user can't do this, they could click the button that would do something like add a <br /> to the end of the content (or a <p></p>) and place the cursor there?

Thank you.

0
Rumen
Telerik team
answered on 12 Aug 2008, 12:57 PM
Hi,

Yes, you can create a custom button that will add a <br /> to the end of the content.

You can get the currently selected element in the content area with editor.getSelectedElement().
The current content can be obtained with editor.get_html(true) and you can set new content with editor.set_html(content).

You can find more information about the editor's client api in the help.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
LeBear
Top achievements
Rank 1
Answers by
Rumen
Telerik team
LeBear
Top achievements
Rank 1
Share this question
or