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

Pasting HTML into editor

3 Answers 45 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 04 Apr 2008, 12:38 AM
Hi,

I have just started using the Prometheus Editor, I am new to using the Telerik Editor, so I am not sure if the behaviour I experience is intended.

I want my users to be able to create an HTML document using the editor.
I want them to be able to paste HTML into the editor.
I expected that the Paste HTML right-click option would do this, but it changes the text so that the HTML tags are displayed in the editor rather than what the HTML represents.

i.e. I what I am looking for is the equivalent of switching the HTML mode and then pasting and then switching back again.

Is this possible?

Thanks

Rob

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 04 Apr 2008, 09:36 AM
Hi Rob,

This "Paste As HTML" tool allows to paste the HTML content of the Clipboard as code, which may be quite convenient for developer-oriented applications (e.g. support systems, forums, etc.) The pasted text will look something like this:
<IMG src=" radEditor-logo.gif"><BR><BR><FONT face="Arial"><STRONG>What's new </STRONG></FONT>

If you want to paste HTML tags in the editor and render them in Design mode, then you should switch to Html mode or paste the HTML content in the Real-Time HTML View module as it is shown in the attached video.
 
I hope this helps.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rob
Top achievements
Rank 1
answered on 04 Apr 2008, 08:09 PM
Ok, I suspected it was intended to work that way.
My users are not going to be the most computer literate, so I was hoping to make this as simple as possible. Having to explain to them to switch modes, then find he right place in the HTML before they paste is probably asking for trouble.
I have been look at the pasteHtml method that is documented - would that do what I want if I pass it some HTML?

I have tried to use this method, but I fall over at the first hurdle, which is locating the editor. I have written a JavaScript function which is called as an OnClientClick from a button on my page:

<script type="text/javascript">
function CopyImage() {
var tbCode = document.getElementById('ctl00_mainCopy_tbCode');
var imgCode = tbCode.value;v
ar editor = $find("<%=reText.ClientID%>");
editor.pasteHtml(imgCode);
}</script>

I am not that experienced with Javascript - the document.getelementbyid, hich I have used before, returns a reference to the textbox containing the text to be pasted OK, but the $find that I have seen recommended in other threads here returns Null. the editor's ID is reText, by the way.

I have no idea how $find works - it isn't mentioned in my only book on Javascript, and it doesn't show up in any Google search.

I have tried replacing reText with ctl00_mainCopy_reText, but that doesn't help.
I have tied to replace the $find with another document.getElementById, but that just returns a DIV.

It should be noted that I am using master pages, if that makes a difference.

I'm hoping that I am doing something very obviously wrong and someone here can point me in the right direction!

Cheers

Rob
0
Rumen
Telerik team
answered on 07 Apr 2008, 11:31 AM
Hi Rob,

For your convenience I have prepared and attached a sample running example which demonstrates how to paste content from a textbox to RadEditor "Prometheus" which are placed in a contentplaceholder control.

Let me know if you have any other questions.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
Rob
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Rob
Top achievements
Rank 1
Share this question
or