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

[Solved] Few Issues

9 Answers 184 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joe Reynolds
Top achievements
Rank 1
Joe Reynolds asked on 08 Oct 2010, 04:48 AM
Issue 1 - Load content into editor from database, edit, and save. All ok. However, if I use the browser back button the edit page comes up with the html code encoded in the edit box. Click save again and it does save but the content is all messed up of course. Seems like this is something where a user posting messages, for example, could cause all sorts of problems. Seems to be random. Sometimes the back key will show the unencoded proper material. How can this be avoided?

Issue 2 -- I've added a number of custom icons for adding images from a database, ieSpell, etc. Is there a way to get a text description shown to user when hovering over these added toolbar icons?

Issue 3 -- The fontname and fontsize items come up with a default name of Inherit. Any way to have the default names be Font and Font Size? I've added an onload function to set fontname and font size but I'm not sure this is the best approach since the fontsize drop down then doesn't work. Clicking on it produces only a vertical gray line. Again, randomly it works ok.

var editor = $('#About').data('tEditor');
editor.focus();
editor.exec('fontSize', { value: '12px' });
editor.exec('fontName', { value: 'Verdana' });

Thanks for any help.

9 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 08 Oct 2010, 11:26 AM
Hi Joe Reynolds,

 Up to your questions:

  1. I was able to reproduce this problem and investigated the issue thoroughly. It occurs because of the way browsers cache input elements (the editor uses a hidden textarea element to store its content) and the fact the editor is HTML encoding its value in order to avoid request validation exceptions. Request validation is enabled by default in ASP.NET MVC in order to prevent XSS attacks and disallows submitting anything that looks like HTML. This of course prevents all HTML editors from working out of the box. That's why our editor component HTML encodes its content. This is also why the component breaks when the back button is clicked - the browser remembers the last (html encoded value) of the editor and restores it in the hidden textarea. The editor then is unaware of that and displays the encoded HTML.

    I tried various ways to fix this behavior. There is a well known HTML attribute which avoids such caching - this is the autocomplete attribute. Unfortunately it does not work for textarea elements in any browser but FireFox. Using a hidden input element (<input type="hidden" />) mitigates the problem however it breaks client-side validation. Setting the autocomplete attribute of the <form> which contains the editor should also fix the problem. Unfortunately this does not work in Internet Explorer.

    The only way to make this work is to force the editor not to HTML encode its content. This is done like this:
    <%= Html.Telerik().Editor().Name(...).Encoded(false) %>
    This of course will trigger request validation so you must disable it by decorating  the action method which saves the value with the ValidateInput attribute:
    [ValidateInput(false)]
    public ActionResult Save()
  2. You can easily set the tooltip of the custom tool like this:
    .Custom(settings => settings.HtmlAttributes(new { @class = "t-html", onclick = "viewSource(event)", title = "Custom" }))
  3. Indeed it is not very user friendly to show "inherit" in those dropdowns. The end user will never know what those are until he opens them. I consider this a bug and we will address it in a few days. I will attach here an updated build or patched JavaScript file once we are ready.

Regards,

Atanas Korchev
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
Joe Reynolds
Top achievements
Rank 1
answered on 09 Oct 2010, 05:13 AM
Thank you for your helpful and prompt response.

Another issue -- I'm developing on a Windows 7 machine running IIS7. After uploading to a live server running Windows Server 2003 and IIS 6 the editor input window does not appear, just text links to the tools. Is there something special that needs to be done for use on IIS6?
0
Atanas Korchev
Telerik team
answered on 11 Oct 2010, 08:08 AM
Hello Joe Reynolds,

Are you using script combination?If yes you can check the asset.axd HTTP handler registration in the web.config of your application. IIS6 and IIS7 need HTTP handlers to be registered in different sections in web.config. Also you can try sniffing the response returned when requesting asset.axd. You can use Fiddler or FireBug to do that. In any case you can provide a live url if possible - we will see what went wrong.

Regards,
Atanas Korchev
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
Alex Gyoshev
Telerik team
answered on 13 Oct 2010, 02:53 PM
Hello Joe,

Regarding the 'inherit' labels -- we changed our defaults to "(inherited font)" and "(inherited size)". Here is why this seems a good idea:
  • naming them only "Font size" / "Font face" will remove the meaning that the values are actually inherited
  • placing the text in brackets implies that it is actually an inherited value, rather than a font with the name "inherit"
Both values can be changed through the FontSizeInherit and FontNameInherit localization strings. I'm attaching the updated build.

I'd be happy if you send us any feedback you may have.

Kind regards,
Alex Gyoshev
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
Joe Reynolds
Top achievements
Rank 1
answered on 14 Oct 2010, 05:45 AM
Thank you for the hotfix. I changed the text to Font Name and Font Size. A typical user hasn't a clue as to what inherit (font) migh mean, at least I don't think so. :)

I do note that when I load a page to edit something from the database the text names are actually blank. The text from the db is not formatted so nothing is inherited. This would also happen if content to be edited began with an image, or any content that does not contain opening span or font tags. Is there a way to have my "Font Name" and "Font Size" always appear if there is no font to inherit?
0
Alex Gyoshev
Telerik team
answered on 14 Oct 2010, 01:38 PM
Hello Joe,

Can you please post an exact HTML sample that shows this problem? By default, when there are no spans & font tags, the font face / size are still inherited from the page -- so the Font Face / Size labels should show.

All the best,
Alex Gyoshev
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
Joe Reynolds
Top achievements
Rank 1
answered on 14 Oct 2010, 05:08 PM
I see the issue of empty font name/size on your demo.
I load http://demos.telerik.com/aspnet-mvc/editor and there is no text in the two dropdown boxes, I suspect becasue it begins with an image.

I'm on Windows 7 and IE 8.

Joe
0
Alex Gyoshev
Telerik team
answered on 15 Oct 2010, 01:33 PM
Hello Joe,

Thanks for reporting that -- it is fixed in the attached build. It wasn't related to the content of the editor - IE renders the ComboBoxes as select boxes, because of issues with the selection implementation -- IE can have only one selection in the window & its child frames.

Best wishes,
Alex Gyoshev
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
SEAN
Top achievements
Rank 1
answered on 21 Jul 2011, 02:29 AM
Regarding #1. This is a pretty old thread, but unfortunately in the new 2011 Q2 release I am still seeing the issue with the editor content being encoded when hitting the Back button in the browser. Using some of Atanas' explanation I was able to get it working in my case so I figured I'd post what worked for me.

I'm doing the submit as a background Ajax post - so I use the JQuery serialize method to get the form data and then post it using the ajax or post methods. I have the Editor set not to encode with Encode(false). Right before I call serialize I put the encodedValue from the Editor into the hidden textarea, then serialize, then put the unencoded value back into the textarea.

I'd be interested to know if there is a better way to do this now in the newer version of the Editor, or if this works for anyone else?

My Javascript code is something like:
var editor = $("#MyEditor").data("tEditor");
var ta = $("#MyEditor-value");
ta.val(editor.encodedValue());
var formData = $form.serialize();
ta.val(editor.value());
//now post formData

Tags
Editor
Asked by
Joe Reynolds
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Joe Reynolds
Top achievements
Rank 1
Alex Gyoshev
Telerik team
SEAN
Top achievements
Rank 1
Share this question
or