Err.. there's no *documented* hook, and it's not available via the  
options.

Two callbacks are defined (as empty) and called by the code, which  
might be useful to you:

onEnterEditMode: function() {}  and
onLeaveEditMode: function() {}

These are not assignable through options  (someone submit a patch?),  
but can be easily assigned after initialization:

var editor = new Ajax.InPlaceEditor('product_1', ... );
editor.onEnterEditMode = function () {
        // conquer the world
}
editor.onLeaveEditMode = function () {
        // abdicate the throne
}

Oddly, the onEnterEditMode is called before the form element is  
created, so you might need to play with timeouts.



TAG

On Feb 20, 2007, at 12:17 AM, Andrew Kaspick wrote:

>
> Your initial response was basically summed up as "attach an observer".
>  Sure, sounds great, but you have to "hack" that in since there is no
> predefined "hook" defined via the InPlaceEditor options, which is what
> I was simply referring to.
>
> If your response included a tad more info (one liner even) on
> where/how to attach the observer I wouldn't have been led to believe
> there was common way to do what I required.
>
> I am fully aware on how to go about overriding existing functions on
> the control as I've had to do exactly that for a different
> requirement.  Mentioning that would have been all I needed.
>
> I appreciate the example provided, but not the tone in which you  
> present it.
>
> Leaving that behind, you've still failed to convince me that this is a
> vendor issue...
>
> Are you telling me that the behaviour I'm looking for is an edge case
> and that everyone wanting this feature should use code similar to that
> in your example?  This is a pretty common requirement I would think
> for this control.  I don't like the default behaviour and want to
> change it and the browsers provide a way for me to do so, so all
> systems go.  Why should scriptaculous not make things easy for people
> and include an (optional) feature for this?  Saying that, I've never
> asked scriptaculous to do this, but I did originally ask IF
> scriptaculous could do this (which it does not).
>
> Feel free to ignore my questions, but if you have further information
> to help me see things your way then please do so without the
> condescending tone.
>
> Thanks,
> Andrew
>
> On 2/19/07, Marius Feraru <[EMAIL PROTECTED]> wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Andrew Kaspick wrote:
>>> I don't see a hook for InPlaceEditor to add these observers.
>> True.
>>
>>> Based on your response, I take it that adding the functionality I  
>>> need
>>> is a straight forward task, but I fail to see what it is.
>> Repeating: "attach a 'focus' observer on that element to do
>> that (you know, the usual selection/text range operations)".
>>
>>> Scriptaculous/Prototype deal with various browser details for  
>>> certain
>>> functions, so I don't see why Scriptaculous couldn't provide a  
>>> way to
>>> allow no initial selection when the input/textarea elements are
>>> created regardless of browser.
>> As I anticipated, the problem in fact is that you have a WRONG  
>> impression
>> about this issue and that's what I wanted to correct in my first  
>> message.
>> You're living under the impression it's Prototype/SAU's job to  
>> take care
>> about this. IT'S NOT! This is an accessibility feature. It's your  
>> user
>> environment vendor who decides how "focusing a control element"  
>> should work,
>> or if it should provide tools for tweaking its default behavior.
>>
>> OK, class adjourned, time to do your homework. ;-)
>> Not nice to let others do it for you, but anyway, here it is:
>> http://rubyonrails-spinoffs.googlegroups.com/web/in-place-editor- 
>> test.html
>>
>> enjoy. :)
>> - --
>> Marius Feraru
>> -----BEGIN PGP SIGNATURE-----
>>
>> iD8DBQFF2oaOtZHp/AYZiNkRAn5fAKCVXWEhKyAZaBj4LZ5ntQ60qsjdOACdHcFd
>> O0f/Sf05cVRE/F3dF0BbRNE=
>> =l/XH
>> -----END PGP SIGNATURE-----
>>
>>>
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to