Object.extend(Ajax.InPlaceEditor.prototype, {
onLoadedExternalText: function(transport) {
Element.removeClasName(this.form, this.options.loadingClasName);
this.editField.disabled = false;
this.editField.value = transport.responseText;
Field.scrolFreActivate(this.editField);
}
});
Object.extend(Ajax.InPlaceEditor.prototype, {
getText: function() {
return this.element.childNodes[0] ?
this.element.childNodes[0].nodeValue : '';
}
});
Add these two extensions after protaculous 8-) loads. The first one
removes the stripTags feature from the editor. The second one replaces
the innerHTML with nodeValue. Those two together are what I did to get
< and > and so forth to show up properly.
It is very important if you do this not to put htmlspecialchars() into
the mix. Something in prototype already does this, and it made quite a
dent in my forehead until I realized that. Double-escaped entities --
very nasty.
Walter
On Apr 20, 2007, at 8:13 AM, Tom V. wrote:
>
> Hi Walter,
>
> I use the live_tree plugin (http://www.epiphyte.ca/code/
> live_tree.html)
> to generate a file system browser.
> When a user clicks a file it is displayed using this partial:
>
> <div id="editme"><%= file_contents %></div>
> <%= in_place_editor 'editme',
> :url => url_for({ :action => 'save_file', :path => path }),
> :save_text => 'save',
> :rows => 20,
> :cols => 5
> %>
>
> File contents are displayed properly meaning all special characters
> (especially "bigger than", "less than", "ampersand" and "double
> quotes")
> are displayed as unescaped characters.
> However, when the user clicks the "editme"-div
> the in_place_editor is activated and those special characters get
> escaped.
> I don't want this to happen...
>
> I tried to make this work using a pure scriptaculous-inplaceeditor,
> something like:
>
> <script>
> //...
> var text = this.getText().unescapeHTML();
> var textField = document.createElement("input");
> textField.value = text;
> this.editField = textField;
> //...
> </script>
>
> however I have not succeeded so far...
> Thanks for your help,
> Tom.
>
>
> On Apr 19, 7:32 pm, Walter Lee Davis <[EMAIL PROTECTED]> wrote:
>> Where in the chain are you trying to escape/unescape the form
>> contents?
>> Are you describing a server-side or client-side process?
>>
>> Walter
>>
>> On Apr 19, 2007, at 12:20 PM, Tom V. wrote:
>>
>>> again sorry for the late reply!
>>> Could you please specify how to escape/unescape the contents of a
>>> form.
>>> This here doesn't work:
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---